Next step (after basic Shadow Mapping)

Started by
2 comments, last by RavNaz 16 years, 10 months ago
I know, I know another question about shadow mapping - but my question is more of a seeking of experience, and that's what forums are for, right :?) I've got some basic shadow mapping set up for my current project, but I was wondering what the next step is to improve upon it, both looks and performance wise, and if anyone has any specific tips for my personal case here. And quickly:- 1) OpenGL FBOs with CG shader for the shadowing. Firstly, here's a screenshot: my test ship Ok so what you see is basically: 1) First pass using a FBO depth buffer, rendered from the light view and also rendering a low polygon version of the actual rendered model, no textures, just the basic geometry. The shadows are for self-shadowing purposes only. 2) A small image (bottom left) of the light's view with the generated depth texture. The depth texture is currently 1024x1024. In my mind, this is insanely big for such a simple mesh (although I'd ideally want a high level of shadowing on the player's sihp) - would you agree? 3) And then the rendered ship, with the applied shadow. The shadowing looks HORRIBLE (but correct(ish)). So my question really is, are there any *easy* ways to improve these horrible shadowing artifacts? What would be a good, solid shadowing improvement solution be. I'm only midly aware of Variance Shadow Maps and PCF shadow maps. What did you use, and how did you find it? Frankly, maths isn't my strong point and I'd like to avoid a horrible long learning curve as graphics & effects aren't my forte. I wasn't also aware I would kind of get this.... almost z-buffer fighting with the shadow and the mesh that makes it look horrible, I just assumed this is because of the inherent aliasing effects of shadow mapping... or am I making an obvious mistake somewhere? Many thanks in advance to anyone who responds with their experience :)
- Teach a programmer an answer, he can code for a day. Show a programmer the documentation, he can code for a lifetime.
Advertisement
Getting accurate shadows is all about precision. Your first mistake is using a low poly version of the mesh to create depth information. How are the shadows supposed to appear accurate if the shadow depth data is different then the view depth data?

Second, the best way to increase usage of your huge map is to ensure that your depth map projection is tightly bound to the shadow casting objects (both in depth range and xy range). Try setting your depth map projection planes as close to the object as you can and you should see improved results.

Third, projection warping techniques will give greater depth map precision where it is needed (close to the view position). Give trapezoid shadow maps a look.

Also give PCF a try it is quick to implement and usualy provides good results. Though I've found that simply enableing linear filtering on the texture gives good enough results for very little performance hit.

Hope that helped and good luck with your tweaking.
Hi, as you might see from the bottom left corner of the screenshot, the object being rendered is indeed being tightly bound in all three axes, using an Orthographic projection simulating an infinitely distant light source.

I guess I'm using a low poly version of the ship just for "bad efficiency" reasons, and in retrospect is probably a bad idea.


Appreciate the tips. Thanks :)
- Teach a programmer an answer, he can code for a day. Show a programmer the documentation, he can code for a lifetime.
Using unit-cube clipping will probably help....

This topic is closed to new replies.

Advertisement