Imported .obj Not Affected by Light

Hey guys,



So, I’ve been trying to import a custom model to my program. I’ve been largely successful, but it doesn’t seem to be affected by light. I know i have the lights configured correctly, because the rest of my program uses them successfully. Here is the code I’m using:



[java]Spatial oddFace = assetManager.loadModel(“Models/oddFace.obj”);



Material oddF_mat = new Material(

assetManager, “Common/MatDefs/Light/Lighting.j3md”);

oddF_mat.setTexture(“DiffuseMap”, assetManager.loadTexture(

“Models/oddFace.png”));



oddFace.setMaterial(oddF_mat);



oddFace.setLocalTranslation(0f, -20f, 0f);



rootNode.attachChild(oddFace);[/java]



The model shows up in the world perfectly, and is textured perfectly, but it is very dark and light doesn’t brighten it up at all. I’ve also noticed that on the back of the model, there seems to be a little overlap of a brighter color (the brighter color is about the shade the model is supposed to be).







I’ve looked around here for a solution, but I can’t find anybody with this problem. I’ve also looked through the tutorials regarding materials and lights and found no help. I am relatively new to the engine, though, so I apologize if it’s something simple I’m overlooking!



Any help?



Thanks,

Dan

Make sure the node it is attached to or that node’s parent node has a light on it. Also if you are using normal maps you will need to generate tangents on it (right-click on it in the SDK, → tools… → Generate tangents).

If you are using a point light, try setting an ambient light in the scene.

The light is attached to the rootNode. It is successfully illuminating Geometry objects in the program that are also attached to rootNode. I have both a point light and a directional light active.



Also, upon further tests, I concluded that the “overlap” I mentioned, and that you can see in the picture, is the only part of the model that IS affected by light.



It seems that there are two models on top of each other, but I don’t understand that.

I only added one model to the rootNode.

I also noted that the object appears black as in the image when I am far away, but shows proper light relfection when I get very close.

hmm

If you look in the scene explorer window in the SDK (bottom left tree window) what does it list under your model? Just the model and a mesh, or multiple meshes?

You also might have to check what way your normals are facing on the model; confirm that they are facing out like you expect.

You code doesn’t show the light code.



I’m suspecting a very low light intensity.

It illuminates other map objects successfully, and the overlapping model shows the light.



[java]DirectionalLight sun = new DirectionalLight();



sun.setColor(ColorRGBA.White.mult(1.8f));

sun.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal());



rootNode.addLight(sun);





AmbientLight amb = new AmbientLight();



amb.setColor(ColorRGBA.White.mult(1.0f));



rootNode.addLight(amb);[/java]



I’m just trying to figure out why it renders two overlapping models instead of just one.