Hi again, people.
I’m having some camera troubles that I smell are very basic, and for that I’m embarrased enough already
First of all, I wanted a orthographic camera, and to set it, I used this code:
[java]
cam.setParallelProjection(true);
final float aspect = (float) cam.getWidth() / cam.getHeight();
cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize);
[/java]
I have attached a box (textured with Lighting.jme3) and a directional and ambient lights to the rootNode.
But when moving the camera (using a FlyByCamera and WSADQZ keys), object shading moves along with the camera. I’ve attached what happens when moving
Does anyone know what I’m doing wrong, or if I’m not doing anything wrong (unlikely), what I can do to have my lighting fixed (like moving the scene instead of the camera)?
Thanks in advance
Probably you have specularity enabled on the box. Change specular color to black and it should work
Hi.
Thanks for your response.
I’ve changed it to black, but no luck. Also, I’ve noticed I have Minnaert enabled on the material (Object seems nicer that way). Here’s my full code for the material:
[java]_defMat = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);
_defMat.setFloat(“Shininess”, 12);
_defMat.setBoolean(“UseMaterialColors”, true);
_defMat.setBoolean(“Minnaert”, true);
_defMat.setColor(“Ambient”, ColorRGBA.LightGray);
_defMat.setColor(“Diffuse”, ColorRGBA.Brown);
_defMat.setColor(“Specular”, ColorRGBA.Black);[/java]
Actually minnaert can cause the issue you’re talking about, because it uses the view direction.
Does it work correctly when in perspective mode?
In perspective, the only issue is that cube is completely gray, that’s why I used Minnaert, but maybe I got my lighting wrong.