Questions about Deferred shading and its implications for shadows and lighting

Hi there,

I’ve been working on an openGL game engine for awhile and I’ve recently started learning about and implementing deferred shading and I have some questions about its effects on lighting and shadows.

So before I started working on deferred shading I rendered my scene from the perspective of every light source to create a shadow map. Then rendered from the camera’s perspective and used the shadow map(s) as well as phong-blinn to light the scene.

My first question is, do people still use shadow maps with deferred shading? Especially with multiple light sources? I’ve found a lot of resources for lighting with deferred shading but very little on shadows. I’ve been reading about light volumes and it seems like an efficient way to handle things but it seems like it still has the problem that if a piece of geometry is within the volume and occluded from the light source by another piece it will still be lit. It seems like if you could create shadow maps using the gBuffer things would be more efficient but also the gBuffer is rendered from the camera’s perspective which would contain different geometry than a light’s perspective.

Is there something I am missing here?

Thanks in advance for your help!

I haven’t read up on shadows with deferred shading in 6 years or so, so this may not be much use. But here’s a post from then that might help: LINK

At the time, “Deferred Shadows”, “Shadow Collector”, or “Screen-space Shadow Mask” were all terms describing the G-Buffer shadow channel. These might help you to websearch and catch up on what’s been done lately with shadows in deferred shading.

[QUOTE=Dark Photon;1287802]I haven’t read up on shadows with deferred shading in 6 years or so, so this may not be much use. But here’s a post from then that might help: LINK

At the time, “Deferred Shadows”, “Shadow Collector”, or “Screen-space Shadow Mask” were all terms describing the G-Buffer shadow channel. These might help you to websearch and catch up on what’s been done lately with shadows in deferred shading.[/QUOTE]

Hey Dark Photon, thanks for your response, you helped me a lot already with your answers on here to deferred shading posts. I’ll check out your link and do some searching with your terms.

Just out of interest do you know if modern game engines do shadows by default? It seems like based on what I’ve found it would be hard to create an engine you could give a user and say “put lights where ever you want and set some variables and the engine will handle the rest”. Especially, when there’s different scenarios like being able to bake shadows into textures, or having to filter your shadow maps, etc. Doesn’t seem like there’s a turn key solution.

Anyway, thanks again for your help!

For visual quality reasons, shadows are pretty ubiquitous nowadays, so I’d expect all of them to support them in various forms (CSM, SSAO, etc.). That said, I haven’t surveyed which engines support what. Perhaps someone else here has though (?) and could follow-up.

Since modern game engines now do PBR, this would look very weird without any shadows at all :slight_smile:

I would suggest you to have a look at free engines, or even UE4. Variants of CSM are generally used for outdoor shadows.

Thanks guys for your responses. I still have a lot more research do to but the point I’ve arrived at is that typically engines implement CSMs (or a variant). And do this using multipass, in combination with deferred techniques.

One optimization to this I found helpful was that rather than skinning every model in every pass, you can make use of Transform Feedback. To capture the skinned model and reuse it for subsequent passes.

If anyone finds this and is in the same spot I was in I found this guy’s WordPress to be incredibly helpful https://mynameismjp.wordpress.com/ . Both for this topic and to learn more about current/last gen game engines and their typical techniques.

Cheers.