Sign in to follow this  
nietger

GLSL shadow mapping moire pattern

Recommended Posts

nietger    100
Hi,

I'm trying to learn how to do shadow mapping using GLSL and I'm running into a problem where I'm getting a moire pattern. The first screen is without glPolygonOffset and the second is with glPolygonOffset. Even with glPolygonOffset I'm still getting shadow acne which I can't remove. Even with GLSL pcf it only makes it worse. Can anyone help me get rid of the moire/shadow acne problem I'm having.

Thanks



moire1

moire2


moire pattern

Share this post


Link to post
Share on other sites
xzminx    100
Hard to give you any advice without viewing your shader code. Perhaps your offset is not apropriate. What value(s) are you using?

Are you doing front face culling while rendering to texture?

Share this post


Link to post
Share on other sites
Geometrian    1810
Hi,

The second picture is correct. The artifacts you notice on the edge of the objects are expected and are due to the quantization of the scene depths. At glancing angles, the shadowmapping algorithm's quality suffers unavoidably.

To reduce this effect, you can enable bilinear filtering on your depth texture, and/or increase the shadowmap resolution. The artifacts will also be reduced if you tightly bound your objects with your light's frustum, so as to better capitalize on the depth buffer and FOV.

G

Share this post


Link to post
Share on other sites
kauna    2922
Hello,

You can reduce a your artifacts (at least) by:

- use the shadow map only for pixels facing the light. Pixels not facing the light are always in shadow. Use a simple dot product to test this.

- when rendering shadow geometry, you can render the back faces instead of front faces. This will reduce shadowing artifacts on the triangles facing the light.

there is plenty of documentation on the net to further improve shadowmapping.

Cheers!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this