Lighting problem

Hey Guys…



I am exporting a model from 3ds Max 2010 to the old .3ds format, then I convert it to .jme using ModelLoader. When I import it into my game, the model is very much darker compared to the rendered image in 3ds Max. I tried to compensate for this by adding a few lights, but when i do i cant see any difference… I dont know if I add them in the right way… Can anyone find a problem in my code?



3ds Max rendered: http://rapidshare.de/files/47543537/3dsmaxrendered.JPG.html

Imported in jME: http://rapidshare.de/files/47543550/afterimport.JPG.html




/** This code is called in the initGame() method. My class extends BaseGame. */
       PointLight light = new PointLight();
       light.setDiffuse(new ColorRGBA(1.0f, 0f, 0f, 1.0f));
       light.setAmbient(new ColorRGBA(1f, 1f, 1.0f, 1.0f));
       light.setAttenuate(true);
       light.setLocation(new Vector3f(4, 4, 0));
       light.setEnabled(true);
 
         /** Attach the light to a lightState and the lightState to rootNode. */
       LightState lightState = display.getRenderer().createLightState();
      
       lightState.setEnabled(true);
       lightState.attach(light);
      
       scene.setRenderState(lightState);
       scene.updateRenderState();
      



Thank you!

check to make sure the normals are ok…

press n and they should show up on the model

The normals are facing outwards from the model, which they are supposed to (I assume), but if i zoom in through the walls of the cylinders I can see that the texture is inside out, (screenshot).

But if the normals are the wrong way, then how can i correct that?



http://rapidshare.de/files/47544490/normals.JPG.html

can you pm the file and i can take a look at it for you…

i have a tool to recreate normals and invert them if needed…

it might sort the problem out…

Which file would you like to have? The .max, .3ds or .jme ?

can i get the 3ds, jme and what ever textures you are using?

thanks…

I actually tried this myself, and the textures got turned the right way… But, they have lost all the shine and reflectiveness and i can still not see any difference in the scene when i add lights or materialstates.

hmmm…

try altering the position of your light and it's ambient coeffecient…

i would use as a test ambient light values of 0.2, 0.2, 0.2, 1; diffuse values of 0.8, 0.8, 0.8, 1; location 100, 100, 100…

Hmm, i must be doing something wrong… When i just try to import a basic cylinder with textures and high / low specular & glossiness level, it imports quite well in the modelloader, it retains shine & reflectiveness. But when i load it into my application it has a matted look… damn

if you want i can still have a look at the files…

see if they appear better in my app…

light.setAttenuate(true);


I am quite sure you don't intend to use attenuation, since for that you must configure the constant, linear, and quadratic parameters of the light for it to work correctly. Try removing this call and see how things look like. Another thing you can do is look at the source of ModelLoader and adapt the lighting configuration from there.

Im sorry to say that removing setAttenuate did not help. But ncomp had a look at my graphics and apparently i have a problem with my normals, too many i think. Im not sure what to do about it though :stuck_out_tongue: