Hey guys
I have recently converted to a new camera orientation. (0,0,0) is in the left upper corner of the map. Y-axis increases when you move down, and x increases when you more right.
z is height over the map.
Light source is position at (7,0,10).
It seems that the lighting only light objects facing away from the light source. When i move the light source to (7,15,10), everything is dark.
How do i get the light to act normal???
http://www.cs-lan.dk/screen3.png
Code for light source:
// Game light
PointLight l = new PointLight();
l.setLocation(new Vector3f(7,0,10));
l.setDiffuse(ColorRGBA.red.clone());
l.setDiffuse(new ColorRGBA(0.5f, 0.4f, 0.4f, 0.2f));
l.setAmbient(new ColorRGBA(0.3f, 0.3f, 0.3f, 0.2f));
l.setEnabled(true);
l.setAttenuate(true);
l.setConstant(0.1f); // Attenuation constant
l.setQuadratic(.0004f);// Strength of light
l.setShadowCaster(true);
this.lights = display.getRenderer().createLightState();
this.lights.setEnabled(true);
this.lights.attach(l);
this.rootNode.setRenderState(lights);
this.rootNode.setLightCombineMode(LightCombineMode.Replace);
Camera:
int camAngle = 10;
cam.setLocation(new Vector3f(0, 0f, 20f));
cam.lookAt(new Vector3f(0,camAngle*-1, 0), new Vector3f(0, -1f, 0));
cam.setLeft(new Vector3f(-1f,0,0));
cam.setLocation(new Vector3f(7, 17f, 20f));
Cullstate and z buffering:
// Fix z buffering
ZBufferState buffer = display.getRenderer().createZBufferState();
buffer.setEnabled(true);
buffer.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
this.rootNode.setRenderState(buffer);
// Cullstate
CullState cs = DisplaySystem.getDisplaySystem().getRenderer()
.createCullState();
cs.setCullFace(CullState.Face.Front);
rootNode.setRenderState(cs);
Thanks!
Matthias