if i set up an ambient light, the scene looks like this: the surface of the cube all are brightness , see attachment bad.png
i want it looks like good.png , but i can't find direct light to implement that effect.
help me out pls
There's a Light class for lights. Just turn down the ambient light and place a light source in front of the cube. Depending on the object, that might still not create such sharp edges. If that's an issue, post again.
I turn down the ambiant light of the world, and setup a light (seems a spot light).
here are the code:
world.setAmbientLight(1, 1, 1);
Light light = new Light(world);
light.setIntensity(128, 128, 128);
light.setAttenuation(800);
light.setPosition(new SimpleVector(-100, 0, 100));
obj.setAdditionalColor(Color.blue);
world.addObject(obj);
is better ,but the sharp edges still not show up. :(
i think the Light in JPCT is omni light (light ball, all directional).
if you want to simulate sunlight shining on earth, place a light 100000 units away, and make its intensity not fade.
if you want multiple lights with multiple directions in one scene, i don't know how.