Strange directional light bug

Hey guys,
I’m facing a problem since a few weeks: I have several objects with a lighting material (the block chunks of my world, 1 geomtry per chunk).
If I now add an object into the scene, which has a lighting material and look at it, the chunk under the camera becomes a bit darker.

When looking at the cow (lighing material):

When changing the ground material to unshaded:

It’s not easy to explain, I’ll try again: If I look away from the cow, the ground becomes brighter (as the other chunks, same result as in the second picture). Since this behaviour must be somehow related to the camera, I tracked down the error to the directional light. If I change the light’s direction from (-0.5f, -1, -0.5f).normalize() to something like (-1, -10, -1).normalize(), the effect becomes weaker. (If I remove the light from the scene, all works fine - Adding/Removing the DirectionalShadowRenderer doesn’t change anything)

I hope, you understand the problem^^ Any clues? :slight_smile:

<span style=“text-decoration:line-through;”>I… Maybe… It’s…

A video/picture of it’s not real. XD :P</span>

cough Nevermind.

Your screenshots aren’t showing up for me but I’m pretty sure I ran into this problem about a year ago when I was working on the lighting system for my game. I believe it has something to do with how multiple lighting passes are handled. I ran into it when I was using an ambient light and a directional light but I don’t really remember the specifics.

Yeah, I’m using an Ambient and a Directional one, too. Thanks for the hint. :slight_smile:

Looks to me to be shadow related and not light related. You are using JME shadows?

…or maybe I’m still not clear on what the problem is. In the first picture, I saw an extra big shadow at the bottom that is not in the second picture.

Shadows were my first guess, too. But even when removing the DirectionalLightRenderer, the texture gets darker when looking at the cow and brighter, when not looking at it. (It’s always the geometry under the camera -So when I move to the next chunk and look at the cow, another chunk becomes dark instead of the old one)

I’m only using the DirectionalShadowRenderer, initialized with the used DirectionalLight. (And an AmbientLight)
I can’t really reproduce the error, I tried making a test case, but it didn’t work out. :frowning:

EDIT: Yes, it’s the shadow renderer from jME, not a custom implementation.

Can you do something to more clearly illustrate the issue? I’m still not seeing it, I guess.

Are you talking about this darkness here:

If so, can you illustrate the problem with all shadowing turned off so that we are convinced that it is not shadows?

mhhh so the darker area matches a chunk of your terrain right?

About shadows, I can’t see a way the directional renderer would make a shadow with a corner and with a brighter intensity than the rest of the shadow. And with shadows inside shadows. (Yo dawg!)
Unless you have 2 shadow processors and that you are unaware of the second one…

Exactly, it matches the chunk geometry surface that’s under the current camera location.

@pspeed said: If so, can you illustrate the problem with all shadowing turned off so that we are convinced that it is not shadows?
@nehon said: mhhh so the darker area matches a chunk of your terrain right?

I’m currently not at my desktop pc, so I can’t shoot more footage from the app. Don’t read every post here as it would be my last answer. :stuck_out_tongue:

Ok, here’s a video - It should show, what’s so hard to explain in words^^

http://destroflyer.mania-community.de/other/videos/videos/light_bug.avi

EDIT: >.> I forget every time, that Fraps records the system’s audio^^ So you can enjoy at least a part of “Wind of Change” :smiley:

It does look rather like shadowing gone wrong?

That’s all I do related to lights and shadows:
[java]AmbientLight ambientLight = new AmbientLight();
ambientLight.setColor(ColorRGBA.White.mult(2.5f));
mainApplication.getRootNode().addLight(ambientLight);

DirectionalLight directionalLight = new DirectionalLight();
directionalLight.setDirection(lightDirection);
directionalLight.setColor(ColorRGBA.White.mult(0.5f));
mainApplication.getRootNode().addLight(directionalLight);

DirectionalLightShadowRenderer shadowRenderer = new DirectionalLightShadowRenderer(mainApplication.getAssetManager(), 2048, 3);
shadowRenderer.setLight(directionalLight);
shadowRenderer.setShadowIntensity(0.3f);
mainApplication.getViewPort().addProcessor(shadowRenderer);[/java]

(private final Vector3f lightDirection = new Vector3f(-0.5f, -1, -0.5f).normalizeLocal():wink:

@pspeed said:If so, can you illustrate the problem with all shadowing turned off so that we are convinced that it is not shadows?
... it's not that we think you are using shadows wrong, we are trying to narrow down where the error is coming from

Ok, sorry. Here’s a second video with the DirectionalShadowRenderer being not added:
http://destroflyer.mania-community.de/other/videos/videos/light_bug2.avi

But as I said, the bevaviour is the same. :frowning:

@destroflyer said: Ok, sorry. Here's a second video with the DirectionalShadowRenderer being not added: http://destroflyer.mania-community.de/other/videos/videos/light_bug2.avi

But as I said, the bevaviour is the same. :frowning:

I hope you understand why we couldn’t take your word for it. :slight_smile:

I think we will have to know more about your geometry and material setup to diagnose what might be wrong. Your best approach is to put together a simple test case since once you replicate the problem in the test case then you will know what is wrong. The fact that you are having trouble replicating the issue points even further to something in your code.

Does each chunk share a material or does each chunk have its own material? How are these materials setup? Do you do camera-specific changes to any part of your scene such as LOD, etc…? All of these are things to look into.