Deferred rendering together with shadow mapping

Hello,
I am playing with Vulkan and trying to write multi pass rendering. I generate for each light its shadow map and then use this shadow map in next pass to calculate illumination. Its 2 passes per light, all summed together in final framebuffer by blending:

render()
{
    for each light
    {
    render shadow map    (1)
    render scene for given light (2)
    }
}

I am using 1 depth attachment which I am reusing light after light. It works well for 1 light but for multiple lights it looks like all the lights are using same shadow map content.
Does it mean I need to add some synchronization to be explicit that (1) and (2) are dependent on each other?

Thanks for any help!

It’s kinda hard to say. There are any number of reasons why such things could happen. Lack of proper synchronization between render passes. Misuse of render passes. Etc. We would have to see the actual code, rather than pseudo-code like this, to know for sure.

But really, it’s probably not a good idea to try to reuse the shadow map light this. Unless the number of shadow-casting lights is substantial (ie: more than 2 or so), it would be better to give them their own individual image. That way, you can do the lighting passes all within a single subpass, avoiding the need to break render passes.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.