shadow map z-depth problem

Started by
4 comments, last by Tim Ingham-Dempster 14 years, 10 months ago
I did shadow mapping with FBO+glsl using a point light. At the moment it works fine but if I have an object rotating using glRotatef then an artifact that only appears on the cube appears. I can't really think of what it can be other than I'm just not accounting for rotation when creating the shadow projection. Here's a pick of what I mean: shadow map In the picture, I'm rotating the cube which is fine as the shadow stays in place and rotates according to the cube it's just that artifact on the cube which also rotates I did set an epsilon also so it not that though it helps a little but not really in this situation. Am I not accounting for something? should I consider using stencil?
Advertisement
I'm not sure if what you're describing is any different from the usual shadow acne issue, it looks exactly like it. Just to be sure, check that you're using exactly the same object world matrix when rendering to the shadow map and to the screen.

Stenciling can't really be used here, but tricks like depth slope biasing, blurring/smoothing the shadow map or rendering the back faces of the objects to the shadow map do help. Then there are a plenty of totally different shadow mapping techniques.

There are lots of threads at GameDev alone that discuss shadow map sampling artifacts. Just to name a few:

Self Shadowing of Terrain - Which method to use?
Reduce shadow swimming for rotating camera
Feature: Shadow Map Aliasing
Doesn't really look like shadow acne to me, but its hard to tell. One trick that I find useful with shadow mapping is to render the shadow map to the screen as a projective texture, it lets you get a better idea of whats going on. My first geuss would be that you aren't rotating the cube before rendering into the shadow map.
inherently interactive - my game design blog
Thanks for the reply's guys.

clb:

I'm not to sure I would call it acne as acne usually looks like a bunch of wavy lines if that what you mean. Thanks for the resources sometimes you can google for days and only find little things here and there to help out.


Tim Ingham-Dempster:

Well I do rotate the object during the depth pass. What I see happening is that the rotations don't seem to match up.

--setup FBO
--setup Projections
--set texture unit multiply bias, projection, lightView projection.
--render objects for the depth texture.
-I make sure I rotate my object here to match what it does during regular viewing.
--return everything to normal.

well essentially that's what I did. I followed this tutorial here. It works well if you don't rotate your objects. In the tutorial the light rotates not the object.
Quote:Tim Ingham-Dempster:
My first geuss would be that you aren't rotating the cube before rendering into the shadow map.


You were right I missed setting up the rotation for the shadow matrix when the shader was active.

Is there a better way to composite the shadows with the scene than using glblendfunc( GL_ONE, GL_ONE) and gldepthfunc( GL_LEQUAL )? It's what I use now but I don't think you can get very dark shadows with this method.

picture above was before I tried making the shadow pass mix with the light pass.

[Edited by - Asem on June 21, 2009 3:14:23 AM]
Done that myself a number of times. One option to get darker shadows would be to do the shadow test in the shader where you light the object. That way you can adjust the lighting value directly. Although it's possible that you can't do that for some reason. I've never actually done shadow mapping in GL, so I couldn't really say beyond that.
inherently interactive - my game design blog

This topic is closed to new replies.

Advertisement