can any one help me with shadow mapping in large scenes please?
is there a tutorial on parallel shadow mapping , or cascaded shadow mapping ?
What is the SIMPLEST way ? (!!!!)
thanks in advance.
Jump to content
Posted 14 January 2013 - 12:58 AM
I have implemented directional and perspective SINGLE shadow maps.
But now I wanna learn cascaded shadow maps or parallel split shadow maps.
I want to start with a simple (compared with DirectX SDK , june sample) tutorial or sample.
Posted 14 January 2013 - 01:26 AM
If you already have implemented shadows for a single directional light, ie. the sun, then you are well on your way to implementing CSM for large outdoor areas. The DX sample is indeed very messy but the accompanying article is very nice: http://msdn.microsoft.com/en-us/library/windows/desktop/ee416307(v=vs.85).aspx
I implemented CSM using this article a few months ago. I had to read through the article four times or so before I understood everything, but that should not be a problem. Get a cup of <insert beverage here>, and start reading. You'll get it.
Posted 14 January 2013 - 06:56 AM
Be prepared to write some debug code, as there are many things that can go wrong. I had some problems with shadows disappearing in certain places and I had no solid idea what was going on. Possible reasons were incorrect culling for light frusta, limited depth precision, incorrect near/far plane placement etc. Eventually I wrote code to display the scene from the point of view of each light and was able to pinpoint the problem.
Posted 14 January 2013 - 07:07 AM
I also found the ability to have the CSM "user camera" be some other camera than the one you are actually using. In other words, position the cascades for one camera and then render the scene from another "free flight" camera. That way you can fly around and look at the whole scene from any direction. Like jmakitalo said, drawing the cascade frusta using debug lines is good. I also modified my shaders to color the geometry in a cascade with some color, like they do in the article I linked to. That way it's really easy to see what goes where. Finally, it's helpful to draw the contents of the actual shadow map to the screen, in grayscale or something.
Posted 14 January 2013 - 12:02 PM
After I learned how to do regular, single shadow mapping and apply some basic filters to it, I tried my hand at PSSM using tutorial and sample code. At first I just copied most of it straight, but much later when I got into XNA, I ported it for that. This GPU Gems article goes into detail. You should also look at how make shadows move more naturally, by reducing the "swimming" in the textures. You know, when the pixels of the shadows move when the camera moves.
I first found it easier to render large shadows using the multiple pass method, splitting up the scene by distances to render each shadow map. Then I went for the accelerated version combining all the splits into one pass. As with jmakitalo, I had issues where shadows disappear, for me it was in between the splits, and only when I point the camera at certain angles.
The shadows weren't sprawling far enough, so I tossed aside the PSSM scheme and used traditional CSM. By this I meant that all the light frustums start at the same near distance, instead of having their near distances start at the last frustum's far distance. Although this results in more wasted pixels, all the shadows overlap and there no disappearing shadows.