Author Topic: Wrong Materials  (Read 4888 times)

Cirko

  • Guest
Wrong Materials
« on: February 24, 2006, 11:34:45 am »
Hi! I'm an italian students that wants to use jpct for a GT simulation. My problem is that when i import my 3ds model, the material colors  are all wrong.
My 3ds file is composed by several parts, and each part has own material. When i launch the program  i obtain:
Adding Lightsource: 0

Adding Lightsource: 1

Adding Lightsource: 2

Loading Texture...textures\rocks2.jpg

Loading file models\audi.3ds

File models\audi.3ds loaded...367520 bytes

Processing new material Pl!

Processing new material Mir!

Processing new material Si!

Processing new material Car!

Processing new material Ph!

Processing new material Pho!

Processing new material Des!

Processing new material Fe!

Processing new material Phv!

Processing new material Fr!

Processing object from 3DS-file: car

Object 'car_jPCT0' created using 5584 polygons and 3474 vertices.

Processing object from 3DS-file: Fr

Object 'Fr_jPCT1' created using 80 polygons and 64 vertices.

Processing object from 3DS-file: P1

Processing object from 3DS-file: P

Object 'P_jPCT2' created using 1428 polygons and 1242 vertices.

Processing object from 3DS-file: fd

Object 'fd_jPCT3' created using 62 polygons and 56 vertices.

Processing object from 3DS-file: fa

Object 'fa_jPCT4' created using 84 polygons and 58 vertices.

Processing object from 3DS-file: cr

Object 'cr_jPCT5' created using 4806 polygons and 2938 vertices.

Processing object from 3DS-file: ve

Processing object from 3DS-file: ve1

Object 've1_jPCT6' created using 168 polygons and 175 vertices.

Processing object from 3DS-file: sc

Object 'sc_jPCT7' created using 6047 polygons and 4076 vertices.

Processing object from 3DS-file: pn

Processing object from 3DS-file: pn1

Object 'pn1_jPCT8' created using 1968 polygons and 1348 vertices.


But only the first object ( car ) has the right colour: the others object has ugly and wrong colours. Where's the problem?

(PS : jpct is fantastic....thanks!)

Cirko

  • Guest
wrong materials 2
« Reply #1 on: February 24, 2006, 11:38:18 am »
i forgot to write that my Audi model is a model brought by a 3d car site, and i'm able to see it correctly coloured in 3dStudioMAX, MilkShape and Cinema4d.

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Wrong Materials
« Reply #2 on: February 24, 2006, 05:00:42 pm »
Well, i post a reply before but it didnt appear.

load the textures on the textureManager before rendering the world

what are the results you got, I mean, what does exactly do you see?

all textures have to be on the jpg format, 3dsmax accept many other format but use jpg for jpct.

make sure your mateials in 3d studio max are not noly colors but textures from a jpg file.

I made a programm in which a car is loaded, you can rotate the cam to view it from diferent angles and change it color, visit the download section, I dont know why but it runs well on my PC but it doesnt work on others,  I think its a problem of the package, review it, may help you.
Nada por ahora

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Wrong Materials
« Reply #3 on: February 24, 2006, 06:05:12 pm »
Also make sure how the color is defined in the model. jPCT uses texture information for texturing and the DIFFUSE color information in case that no textures are assigned. Maybe a screen shot of how it looks (and how it should look) will help.

Cirko

  • Guest
screenshots
« Reply #4 on: February 25, 2006, 11:00:01 am »



the first is in the real colour, the second shows how the colours seems so strange... Only the rear light is in the right material( a dark red), the others are all wrong! Help please!

Offline Cirko

  • byte
  • *
  • Posts: 3
    • View Profile
Wrong Materials
« Reply #5 on: February 25, 2006, 11:07:14 am »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Wrong Materials
« Reply #6 on: February 25, 2006, 12:29:31 pm »
I need the model or at least a model that shows the same behaviour to see where the problem could be. Looking at the screen shots, i have no clue what's going on there...
Does this happen when using jPCT's hardware OpenGL renderer in exactly the same way? It somehow reminds me of what i'm getting when using SUN's Java2D OpenGL pipeline on Windows, but you've obviously started the app out of JBuilder, so if you haven't enabled it explicitly, i doubt that this causes the problem... :?:

Offline Cirko

  • byte
  • *
  • Posts: 3
    • View Profile
Wrong Materials
« Reply #7 on: February 25, 2006, 01:19:45 pm »
i've added a link in that page for download audi.3ds (rename the extension)...could you check it? thanks

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Wrong Materials
« Reply #8 on: February 27, 2006, 05:44:31 pm »
Ok, i've looked at the model...it's strange and i don't really know what to make of it. It has a 24 byte long color chunk for a material's diffuse color where my other models have only 15 bytes. According to some specs that i've found for 3ds, the chunk length is 15 bytes and the colors are in unsigned byte format...that's what the previous loader tried to load. According to another spec, the chunk may be 24 bytes in size as well to include some additional color information (not gamma corrected, but otherwise still 3*unsigned byte). This is simply not true for your model. In your model, the colors are stored in float format (i.e. 3*float). I've now modified the loader to handle it this way: If the chunk size is 15, parse for unsigned bytes and if it's 24, parse for floats. But this isn't based on any specs or sources that i've seen. It's solely based on this one model. I hope it's correct behaviour anyway, because the model loads fine in DeepExploration too...an updated jar is here: http://www.jpct.net/download/beta/jpct_111pre1.jar
Let me know if it works.

Offline Cirko

  • byte
  • *
  • Posts: 3
    • View Profile
GREAT
« Reply #9 on: February 28, 2006, 01:01:06 pm »
i've no words to describe your ability...Thanks a lot, you're GREAT!!!!