multipass shadow mapping renderer in XNA
Posted
by
Nick
on Game Development
See other posts from Game Development
or by Nick
Published on 2012-10-17T07:16:21Z
Indexed on
2012/10/17
11:23 UTC
Read the original article
Hit count: 379
I am wanting to implement a multipass renderer in XNA (additive blending combines the contributions from each light). I have the renderer working without any shadows, but when I try to add shadow mapping support I run into an issue with switching render targets to draw the shadow maps. When I switch render targets, I lose the contents of the backbuffer which ruins the whole additive blending idea.
For example:
Draw()
{
DrawAmbientLighting()
foreach (DirectionalLight)
{
DrawDirectionalShadowMap() // <-- I lose all previous lighting contributions when I switch to the shadow map render target here
DrawDirectionalLighting()
}
}
Is there any way around my issue? (I could render all the shadow maps first, but then I have to make and hold onto a render target for each light that casts a shadow--is this the only way?)
© Game Development or respective owner