Okay, so, still hunting down the lighting bug, here is where I’m at:
I decided to start with one of the Cubes test programs so I know for sure that nothing is a factor when it comes to lighting but the lighting itself. The one I chose was the TestPhysics.java.
Here is the original lighting code for that program:
[java]
DirectionalLight directionalLight = new DirectionalLight();
directionalLight.setDirection(lightDirection);
directionalLight.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
simpleApplication.getRootNode().addLight(directionalLight);
simpleApplication.getRootNode().attachChild(SkyFactory.createSky(simpleApplication.getAssetManager(), “Textures/cubes/sky.jpg”, true));
DirectionalLightShadowRenderer directionalLightShadowRenderer = new DirectionalLightShadowRenderer(simpleApplication.getAssetManager(), 2048, 3);
directionalLightShadowRenderer.setLight(directionalLight);
directionalLightShadowRenderer.setShadowIntensity(0.3f);
simpleApplication.getViewPort().addProcessor(directionalLightShadowRenderer);
[/java]
And the result:
Beautiful lighting.
Now, after confirming it all works, I commented out the line that was initializing Lighting, and substituted my own code:
[java]
//CubesTestAssets.initializeEnvironment(this);
PointLight light = new PointLight();
light.setPosition(new Vector3f(1000, 1000, 1000));
light.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
light.setRadius(2000f);
this.rootNode.addLight(light);
getRootNode().attachChild(SkyFactory.createSky(getAssetManager(), "Textures/cubes/sky.jpg", true));
PointLightShadowRenderer plsr = new PointLightShadowRenderer(
this.assetManager, 2048);
plsr.setLight(light);
plsr.setShadowIntensity(0.3f);
getViewPort().addProcessor(plsr);
[/java]
I tried to keep it as original to the DirectionalLight code as possible while using a PointLight instead.
Here are my results: (The shadow direction is probably off, I chose a random number when plugging in the position of the PointLight)
So… I have no idea. I guess Point Light doesn’t work with cubes at all? Or am I doing something wrong? (I hope I’m missing something.) If nothing else at least I know I’m not overlapping chunks like I and @ulfgur previously thought
If someone gets the time and would like to test this code to see if they can replicate the lighting glitch, I’d be very grateful. Here is the pastebin of my edited file. (The edited part is under initBlockTerrain())
Thanks
(P.S. I’m curious as to why I got different triangle and vertex counts in those two images… I used a seed so it should have generated the exact same terrain. Anyone know?)