BUG in PointShadowRenderer

Well, i’m not shure if this is a bug of my hardware or a bug of PointLightShadows, but perhaps someone can give some advice…

Here you see a scene with show-normals-material. In the center is a PointLight (yes, i know, its not exactly centered to the fireball…) that is created like this:

[java]
ColorRGBA light = ColorRGBA.Yellow;
PointLight pl = new PointLight();
light.multLocal(2);
pl.setColor(light);
pl.setRadius(4f);
rootNode.addLight(pl);
PointLightShadowRenderer plsr = new PointLightShadowRenderer(assetManager, 512);
plsr.setLight(pl);
plsr.setEdgeFilteringMode(EdgeFilteringMode.Nearest);
plsr.displayFrustum();
viewPort.addProcessor(plsr);
plsf = new PointLightShadowFilter(assetManager, 512);
plsf.setLight(pl);
plsf.setEdgeFilteringMode(EdgeFilteringMode.Nearest);
plsf.setEnabled(false);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
fpp.addFilter(plsf);
viewPort.addProcessor(fpp);
[/java]

These walls are kind of quad-like meshes, the wood-pillar in the front (see pic below) is a jme3-box. What you can see is some kind of jitter that changes appearence when i move or change looking direction. Sometimes its not there at all but it is allways exactly where the ShadowRenderes frustum of the camera looking into world Z+ reaches the wall with normals to Z-. Another jittering occures where the renderers camera-frustum of World X+ comes to a wall with normals at X- (see first pic). THe effect is independent from the used material and i see it with shownormals-matdef and with lighting-matdef with and without additional normalmap.

Now this is actual texture, again, you'll see the jittering at World Z+. I wasnt able to find a position in this scene where you can see both Z+ and X+ jitters at the same time, but X+ is there, too. As the fireball is created dynamically, it has not the exact same position as above, hence the different size of the jittering rectangle.

The Material is created like this…
[java]
MaterialDef matdef = (MaterialDef) Manager.am.loadAsset(“Common/MatDefs/Light/Lighting.j3md”);
Material mat = new Material(matdef);
mat.setFloat(“Shininess”, 1.0f);
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
mat.setTexture(“DiffuseMap”, (Texture2D) texture); // <- the image already loaded
if (normal != null) //<- an optional normal texture
{
mat.setTexture(“NormalMap”, (Texture2D) normal);
mat.setBoolean(“PackedNormalParallax”, true);
mat.setBoolean(“SteepParallax”, true);
mat.setBoolean(“VTangent”, true);
mat.setFloat(“ParallaxHeight”, 0.02f);
}
if (isTransparent()) // <- this is also flagged at loading of the texture
mat.setTransparent(true);
}
[/java]

Here i have textured the walls with my testing-texture that helps me see errors in alignment. So i can confirm that all triangles in this scene are correctly aligned – at the least they're aligned all the same. I changed the light to white but exept the exact pos of the light that varies a little in the three pics and the material, everything else is the same. Here you can see the jitter at the jme3-box, so i think it has nothing to do with my custom meshes. The jittering always occures at world Z+ and X+.

Again with different material and at different world location, this shoot really took me a while to get captured because the flickering vanishes as soon as you just move the camera the tiniest bit. But here it is: this wall has normals at World X+, so we look into X- with a bit Z-. The cell to the right is correctly rendered, the cell in the walls middle is half in PointShadowRenderers X+ camera, where those strange jitter occures, obviously just in the lower right triangle. As those whole scenery is created dynamically from cubic cells, where each wall uses exaclty the same building-routine and all triangles are just the same setup (i confirmed this with my test-texture), i cant see any logical reason, why the right cell is not jittered at all while the middle one jitters at some special angles. You see that the part of the jittering triangle that is rendered with PointLightShadowRenderer’s Z–Camera is rendered correctly.

Now, any suggestions, please…?

I should add: it’s an nVidia Gainward Bliss 7900GS AGP with actual driver and nightly jme3.

You use both the shadow renderer and the shadow filter…it can’t help really…
Use one or the other and see if the issue is still there

@nehon:

This is just the PointLightShadowRenderer, current nightly.
Im trying to boil it down to a testcase, currently it happens always Z+ and X+ with this setting:

[java]
Vector3f posLight = new Vector3f(20.842857f, -2.5050735f, 15.389124f);
Vector3f posCamera = new Vector3f(19.682405f, -2.505795f, 15.291313f);
cam.setLocation(posCamera);
cam.lookAtDirection(new Vector3f(0.9964665f, 6.1957777E-4f, 0.083988905f), Vector3f.UNIT_Y);
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.White.mult(2));
pl.setRadius(4f);
pl.setPosition(posLight);
rootNode.addLight(pl);
PointLightShadowRenderer plsr = new PointLightShadowRenderer(assetManager, 512);
plsr.setLight(pl);
plsr.setEdgeFilteringMode(EdgeFilteringMode.Nearest);
plsr.displayFrustum();
viewPort.addProcessor(plsr);
[/java]

So whats that funny debug geometry you have there? Looks like it exactly matches the “shadow”. Maybe you should put that in another view instead of the main scene?
The content of this post is meant to be read as a straight information or question without an implicit dismissive stance or interest in having the other party feel offended unless there’s emotes that hint otherwise or there’s an increased use of exclamation marks and all-capital words.

@normen said: So whats that funny debug geometry you have there? Looks like it exactly matches the "shadow". Maybe you should put that in another view instead of the main scene?
That's the pointlightShadowRenderer frustum debug view that i did.
@rhavin said: Im trying to boil it down to a testcase,
that would help yep. Do you have the same issue with the test case? (TestPointLightShadows)

æhm, well… äh… that is displayFrustum()-method of PointLightShadowRenderer?
It just shows in what camera the bug occures. The bug comes also, when i just disable it, but then it is not clearly visible, that it happens exactly at the fustrums bonds.

@nehon said: Do you have the same issue with the test case? (TestPointLightShadows)

I need some minutes, i already have the exact viewpoint and direction, now i just have to get the exact coordinates of the two quads, the i’ll post the testcase. It has something to do with the coordinates involved, gimme 20 minutes…

@rhavin said: I need some minutes, i already have the exact viewpoint and direction, now i just have to get the exact coordinates of the two quads, the i'll post the testcase. It has something to do with the coordinates involved, gimme 20 minutes…
i give you 10! Don't ask for precise time, it so easy to halve it up :p

No seriously there is no rush, I won’t have time to look into it tonight anyway.

@nehon said: That's the pointlightShadowRenderer frustum debug view that i did.
@rhavin said: æhm, well… äh… that is displayFrustum()-method of PointLightShadowRenderer?
Heh, the things we have in our engine.. ^^

Well, my mother always loved my usual “im there in 20 minutes”… my current girlfriend tolerates it; lets see how long it’ll last :-Δ ^^

Here it is:
[java]

import com.jme3.app.SimpleApplication;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.material.MaterialDef;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.shadow.EdgeFilteringMode;
import com.jme3.shadow.PointLightShadowRenderer;

public class Main extends SimpleApplication {

public static void main(String[] args)
{
	Main app = new Main();
	app.start();
}

@Override
public void simpleInitApp()
{
	rootNode.setShadowMode(RenderQueue.ShadowMode.Off);
	Material mat = new Material(
			  (MaterialDef) assetManager.loadAsset("Common/MatDefs/Misc/ShowNormals.j3md"));
	mat.setReceivesShadows(true);

	Box b1 = new Box(1.25f, 1.25f, 1.25f);
	Geometry g1 = new Geometry("Xwall", b1);
	g1.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
	g1.setLocalTranslation(24.84375f, -2.5f, 15);
	g1.setMaterial(mat);
	rootNode.attachChild(g1);
	Geometry g2 = new Geometry("Zwall1", b1);
	g2.setLocalTranslation(20f, -2.5f, 17.34375f);
	g2.setMaterial(mat);
	g2.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
	rootNode.attachChild(g2);
	Geometry g3 = new Geometry("Zwall2", b1);
	g3.setLocalTranslation(22.5f, -2.5f, 17.34375f);
	g3.setMaterial(mat);
	g3.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
	rootNode.attachChild(g3);
	Vector3f posLight = new Vector3f(20.842857f, -2.5050735f, 15.389124f);
	Vector3f posCamera = new Vector3f(19.682405f, -2.505795f, 15.291313f);
	cam.setLocation(posCamera);
	cam.lookAtDirection(new Vector3f(0.9964665f, 6.1957777E-4f, 0.083988905f), Vector3f.UNIT_Y);
	PointLight pl = new PointLight();
	pl.setColor(ColorRGBA.White.mult(2));
	pl.setRadius(4f);
	pl.setPosition(posLight);
	rootNode.addLight(pl);
	PointLightShadowRenderer plsr = new PointLightShadowRenderer(assetManager, 512);
	plsr.setLight(pl);
	plsr.setEdgeFilteringMode(EdgeFilteringMode.Nearest);
	plsr.displayFrustum();
	viewPort.addProcessor(plsr);
}

}
[/java]

looks like this:

An absolute wild guess… maybe something with stripedtriangle-mode?

@rhavin said: my current girlfriend
lol that's not something to say if you want to keep her ;)

Thanks for the test case, i’ll look into it