Hello,
I’m a beginner in this are yet, so I don’t understand shading and materials very well. Also I have limited knowledge of blender as I’m in the learning phase. I’m using models from internet (http://www.the3dmodelstore.com/free.php).
I’m having similar lighting problem in this post as well http://hub.jmonkeyengine.org/forum/topic/how-to-add-light-to-a-model-properly/#post-238708
Please point me some resources where I can get information how should I light up my models properly.
My current understanding is that when I import the model all materials etc gets imported automatically and I cant manipulate(change or edit) them. But if I import an unshaded model, then I can add materials etc.
The screenshot attached contains
- The unrotated image
- Rotated image from the same side
- Rotated image from the other side (which implies rotated image is black from all sides)
This is the related code that I’m calling form main function.
[java] private void setUpLight() {
// We add light so we see the scene
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.White.mult(1.3f));
rootNode.addLight(al);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White);
dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal());
rootNode.addLight(dl);
}
protected Spatial makeCharacter() {
// load a character from jme3test-test-data
//Spatial golem = assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);
//Spatial golem = assetManager.loadModel(“Models/jeep/jeep.j3o”);
Spatial golem = assetManager.loadModel(“Models/axe/axe.j3o”);
golem.scale(0.08f);
golem.setLocalTranslation(0f, 0f, 0f);
// We must add a light to make the model visible
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
golem.addLight(sun);
shootables.attachChild (golem);
golem = assetManager.loadModel("Models/jeep/jeep.j3o");
golem.scale(0.02f);
golem.setLocalTranslation(0f, 5f, 0f);
// We must add a light to make the model visible
sun = new DirectionalLight();
sun.setDirection(new Vector3f(-1f, -1f, -1.0f).normalizeLocal());
golem.addLight(sun);
// Quaternion Quaternio = new Quaternion();
//golem.setLocalRotation(Quaternio.fromAngleAxis(FastMath.DEG_TO_RAD*15, new Vector3f(0,1,0)));
shootables.attachChild (golem);
return golem;
}[/java]
