I have successfully implement Cascaded Shadow Map and the result look very good in still shot.
But when the camera start moving , the shadow edge are start to flickering/swimming.
Right now I just want to fix the translation case first since my game is a 2.5d fighting game that doesn’t have much camera rotation.
After sometime of research on the Internet I found out the way to fix this issue in “Shadows & Decals: D3D10 Techniques in Frostbite (GDC’09)”.
http://www.slideshare.net/repii/02-g-d-c09-shadow-and-decals-frostbite-final3flat
They said you should “round light space translation to even texel increments” with the given code
float f = viewSize/(float)shadowMapSize;
translation.x = round(translation.x/f)*f;
translation.y = round(translation.x/f)*f;
My question is
-
What is viewSize ? Is it the size of the frustum of selected slice (but why ignore the second dimension) ?
-
is “translation” a fragment position after transform in to light space (the one you use to do shadow look up) ?
-
where should I apply this fix (I guess it must be fragment shader) ?