Cascaded Shadow Map Issue

Started by
46 comments, last by riuthamus 11 years, 1 month ago

position_vs.xy = (screencoord.xy * screensize_ws.wx) * (far_ws*depth/near_ws);

screensize_ws.wx? Did you mean xy?

What range is screencoord supposed to be in? DX gives it as the actual on screen pixel coordinate. In my case screencoord.xy = x = 536.500000000, y = 308.500000000. position_vs is coming out to a huge number after the multiplication.

Advertisement

I've corrected my previous post. Screensize is the screensize in world space divided by the screensize in pixels. Best to look up my previous post.

I can't get the reconstructed position to even come close to the position_ws_VS. I found something else out, however, while reading MJPs blog about reconstructing linear depth. The GetCorners function in SharpDX returns the corners in a different order than XNA. So I switched the indexes around and now the first shader output seems a little closer to what it should be (at least I think so...). It no longer rotates with the camera, but it's still moving with it:

">

It no longer rotates with the camera, but it's still moving with it:

That's the desired behavior smile.png So, the world space transformation should work (better) now. Have you tested the complete shadowmap pipeline with this fix ?

Yea I did test them. Assuming I didn't leave in any weird test stuff (I didn't see any), the shadows don't make any sense at all now:

[attachment=13771:RuinValor 2013-02-21 01-58-54-96.png]

With 4 cascades and a recognizable object:

[attachment=13772:RuinValor 2013-02-21 02-04-45-41.png]

Edit - This is what it looks like with the precision increased from 8 to 32 bits:

[attachment=13773:RuinValor 2013-02-21 02-14-06-47.png]

[attachment=13774:RuinValor 2013-02-21 02-14-15-86.png]

the shadows don't make any sense at all now

It is hard to say, but you might have entered the next stage: fighting shadowmapping artifacts

Currently your scene could suffer from self-shadowing artifacts (or an other bug), but basically that could mean, that the transformation works. Best to use one recognizable shadow caster (e.g. sphere) and leave the rest only as shadow receiver (no caster).

precision increased from 8

8 bit depth buffer ?? You should use at least 24 bits (e.g. 2 half floats or 32f rendering target).

Increasing the shadow bias fixed the remaining issue:

[attachment=13775:RuinValor 2013-02-21 03-13-26-14.png]

So it's pretty much working now. I'm getting just about every other problem possible though. Peter panning, jittering when moving, shadows disappearing when the object is behind the camera, and some weird issue where a triangle of shadow pops in on the right hand side (you can see it in the screenshot). The last two issues are particularly problematic though.

Edit: Switching to our old ESM shadow filtering (instead of PCF from the sample) mostly fixes issues 1, 2, and possibly 4. 3rd one is still something I'd really like to fix.

Just checking to see if anybody else thought of anything? Thanks again for this help, would like to wrap up this shadow crap! :P

This topic is closed to new replies.

Advertisement