Jump to content
  • Advertisement
Sign in to follow this  
SiS-Shadowman

Shadowmapping & Quality improvement

This topic is 4011 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've recently implemented shadow mapping, but the quality isn't what I expected. I'm using the highest resolution for the texture (2048²) with D3DFMT_R32F as its format, so I can get a 32bit resolution for the pixel depth. Video link As you can see in this video, I do have aliasing problems (apart from some artifacts) with the shadows. How can I improve the quality of the shadows? I've heard about perspective shadow mapping, but I don't have a clue how I could implement them.

Share this post


Link to post
Share on other sites
Advertisement
Avoid Perspective Shadow Mapping. It has some dead ends, better alternatives do exist. Such as Light Space Perspective Shadow Mapping, Trapezoidal Shadow Mapping and some others I forgot. All of them work by applying a perspective projection on the shadow map, but due to the nature of it all of them fall back to uniform shadow mapping if the view direction and light direction are close to parallel.

There are other techniques. Among the most popular are Cascaded Shadow Mapping and Parallel Split Shadow Mapping, two names for nearly the same technique: applying multiple (uniformly distributed) shadow maps for different distances. Easy to implement, excellent results, but at the cost of rendering multiple shadow maps.

And there's an own developed technique, recently named Circular Distorted Shadow Mapping. It works by applying a lense effect on the shadow map so that close objects are much larger at the shadow map, therefore providing better resolution close to the viewer at the expense of distant regions. You can find a rough description under http://www.gamedev.net/community/forums/topic.asp?topic_id=405955 Of course there are downsides as well: the distortion is non-linear, meaning that triangle edges above a certain length get noticable distortions. The maximum gain possible by this technique is limited, around 20x for my personal use case. It had some additional problems on certain angles that are mentioned at the linked thread but they're no actually not a problem: they're already solved in the code presented there, I just didn't realise it.

Make your choice. If you want to be safe, PSSM is propably the best choice.

Bye, Thomas

Share this post


Link to post
Share on other sites
I have implemented Shrompf's method and it works very well in most cases (but only for directional lights).

However, I strongly recommend doing the shadow projection distortion in the pixel shader, not the vertex shader, as that will have far fewer artifacts.

However, I don't think your video looks so bad, at least nothing that couldnt be fixed by a nice percentage-closer filtering.

Share this post


Link to post
Share on other sites
Now that I had a look at the video I have to agree with Matt: for the camera in the video the shadows are good... they won't get much better. All techniques I proposed in my first post will be only necessary if you aim for a first person camera walking through the church. At the moment, PCF or maybe Variance Shadow Mapping might provide a better gain in visual quality.

@Matt:

<900 rating? Did you post in the lounge lately? :-)

Share this post


Link to post
Share on other sites
Quote:
Original post by Schrompf
Now that I had a look at the video I have to agree with Matt: for the camera in the video the shadows are good... they won't get much better. All techniques I proposed in my first post will be only necessary if you aim for a first person camera walking through the church. At the moment, PCF or maybe Variance Shadow Mapping might provide a better gain in visual quality.


I am aiming for a first person camera. The video was made with flying mode, to have a better look at the shadows.

About the techniques you proposed. I had a look at the link you posted and I also ran the demo. Looks really impressive, however I don't think I'm advanced enough to implement it yet. I think I'll try out several techniques and stick to the one that looks the best.

I'll start with perspective shadow mapping, I think. You said something about a flaw, the algorithm has. However I have a question about that. If I'm understanding perspective shadow mapping right, the only thing different is, that the shadowmap has the dimensions of the standard viewport and that the depth values are stored in camera screen space, but with their distance to the light source. Thus, there won't be the case as in normal shadow mapping, when one shadowed pixel is mapped to about 10 screen pixels. How can this be a "problem" when the view and light direction are nearly aligned? In any case, one shadowed pixel should be mapped to one screen pixel, shouldn't it?

Share this post


Link to post
Share on other sites
Quote:

I'll start with perspective shadow mapping, I think. You said something about a flaw, the algorithm has. However I have a question about that. If I'm understanding perspective shadow mapping right, the only thing different is, that the shadowmap has the dimensions of the standard viewport and that the depth values are stored in camera screen space, but with their distance to the light source. Thus, there won't be the case as in normal shadow mapping, when one shadowed pixel is mapped to about 10 screen pixels. How can this be a "problem" when the view and light direction are nearly aligned? In any case, one shadowed pixel should be mapped to one screen pixel, shouldn't it?


Only if your scene is a single plane in parallel to the far plane, for example. As soon as there's some depth complexity all mapping work is in vain. If you read the Perspective Shadow Mapping paper you'll soon notice there are numerous problematic areas where the technique is not just looking ugly but failing completely. As mentioned before, Light Space Perspective Shadow Mapping is a better place to start - it's basically an enhancement of PSM.

Bye, Thomas

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!