Pregunta

I'm currently trying to extend my current basic shadow mapping system to allow objects to have shadows cast from multiple lights. At the moment I have generated both shadow maps correctly but the problem is getting them both to be rendered on the scene.

My draw function currently goes like this:

for (int iLight = 0; iLight < mNumLights; iLight++)
{
    mShadowMap[iLight]->SetNullRenderTarget(md3dImmediateContext);

    DrawSceneToShadowMap(iLight);

    RestoreRenderTarget();

    SetShadowMap(iLight);
    SetShadowTransform(iLight);

    DrawScene();

}

mSwapChain->Present(0, 0)

Only the second shadow map is used and drawn, what am I missing here?

¿Fue útil?

Solución

The two standard ways of combining shadow maps in a forward renderer are either to do multi-pass lighting with additive blending where each pass adds in the light contribution from a different light or single-pass lighting where the shader loops over lights in the scenes and accumulates their light contributions. MIN blending isn't really the right way to combine contributions from multiple lights in a multi-pass lighting approach. I'd suggest trying additive blending instead.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top