Jump to content

  • Log In with Google      Sign In   
  • Create Account

Cascaded Shadow Map Issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
47 replies to this topic

#41 Telanor   Members   -  Reputation: 1338

Like
0Likes
Like

Posted 20 February 2013 - 05:10 AM

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.


Edited by Telanor, 20 February 2013 - 05:17 AM.


Sponsor:

#42 Ashaman73   Crossbones+   -  Reputation: 7573

Like
1Likes
Like

Posted 20 February 2013 - 07:11 AM

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.



#43 Telanor   Members   -  Reputation: 1338

Like
1Likes
Like

Posted 20 February 2013 - 10:22 PM

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:
 

Edited by Telanor, 20 February 2013 - 10:23 PM.


#44 Ashaman73   Crossbones+   -  Reputation: 7573

Like
1Likes
Like

Posted 21 February 2013 - 12:32 AM

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 ?


Edited by Ashaman73, 21 February 2013 - 12:48 AM.


#45 Telanor   Members   -  Reputation: 1338

Like
0Likes
Like

Posted 21 February 2013 - 12:59 AM

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:

RuinValor 2013-02-21 01-58-54-96.png

With 4 cascades and a recognizable object:

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:

RuinValor 2013-02-21 02-14-06-47.png

RuinValor 2013-02-21 02-14-15-86.png

#46 Ashaman73   Crossbones+   -  Reputation: 7573

Like
0Likes
Like

Posted 21 February 2013 - 01:40 AM

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).


Edited by Ashaman73, 21 February 2013 - 01:43 AM.


#47 Telanor   Members   -  Reputation: 1338

Like
1Likes
Like

Posted 21 February 2013 - 02:21 AM

Increasing the shadow bias fixed the remaining issue:

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.

Edited by Telanor, 21 February 2013 - 02:26 AM.


#48 riuthamus   Moderators   -  Reputation: 5531

Like
0Likes
Like

Posted 23 February 2013 - 03:01 AM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS