This sample shows how you can defer shadow map calculations to separate full-screen pass using a depth buffer, effectively decoupling your shadowing routines from your main lighting pass. The main benefits are that your pipeline can be greatly simplified, as well as improved efficiency during shadow occlusion generation. Uses XNA 3.0, includes PC and Xbox 360 projects. Hosted on Ziggyware.
http://www.ziggyware.com/readarticle.php?article_id=235
Also hosted here, since Ziggyware has been down.
I also wrote the code for a follow-up sample that implements Cascaded Shadow Maps, but never got around to doing a write-up. You can get that here.
Hi, I found this very good example of deferred shadows maps, but Ziggy is off ;-( I downloaded the source code, but it’s hard to read for me.. Does anybody has somewhere this article from Ziggy?
I forgot to add notification.. sorry
Hi, I’m designing an engine with XNA called Rapier3, and would love to integrate this sample into my deferred renderer – it would save me a whole lot of time and energy!
Would that be possible, obviously all acknowledgements etc intact, and acreditation where necessary and requested?
Kind regards.
Hi,
Playing around with this sample, noticed that the far plane will always receive shadows.
This is worse if the light’s camera is fixed (only cast shadows to a certain box volume), anything that falls outside that area will receive full black shadows, as it will be farther than the light’s far plane, this may or may not be the wanted result.
For example, for some games it might be useful to have some small shadow caster geometries on a delimited zone, but everything outside that zone may continue to receive the directional light illumination.
The only solution I have though is to wrap the shadow occlusion term evaluation with an “if else” branch.
Supposing that the distances are normalized:
if (pixelDistanceToLight < 1)
{ // Do all pcf stuff }
else
{ shadowOcclusion = 1; }
Is there another approach/solution to this? I have noticed that since dynamic branching tends to be expensive on gpu, experts come up with evaluations and formulas way beyond my understanding…
If not, is that branch really bad?
Hope I have explained myself.
Thanks in advance!
Also, great blog, full of interesting topics.
hai mjp, …
I have read documentation about the deferred shadowing which I downloaded a month ago. I know that it is the target for XNA 3.1. I’m using XNA 4.0, and can not use the code “deferred shadowng” in XNA 4.0. I’ve tried to modify in order to run in XNA 4.0., but I can not find a solution that runs on XNA 4.0.
I know that the XNA 4.0 version is a lot of changes to the graphics library.
what you can help me to solve this problem? I hope to help you,
thank you for your attention
I’ve got a very weak signal
I’m retired soft chewable kamagra (generic viagra) ⢠Idealizing the old country