Depth buffer and multiple lights

Posted By: 3run

Depth buffer and multiple lights - 04/17/20 12:24

Hey!

So after I went through shader workshop #6 and #7 (shadow mapping), I came across this question. How to add support for multiple light sources? In theory. Would be glad if anyone will poke me in right direction.

Greets!
Posted By: Emre

Re: Depth buffer and multiple lights - 04/17/20 15:29

I used the txesmi's omnidirectional sample once for multiple light source, long time ago.
But this method not good for performance. So I kept the clip_far of shadow views low. in fact sometimes i even turned off the views and used cubemap as static shadows. My goal was to get rid of stencil shadow bugs.

In one way or another afaik you will need six camera for each light source (for pointlights). i don't know if is there any other way.
Posted By: 3run

Re: Depth buffer and multiple lights - 04/17/20 15:42

Hey Emre! I remember that project of yours! I used to test it back at the time laugh
Originally Posted by Emre
In one way or another afaik you will need six camera for each light source (for pointlights). i don't know if is there any other way.
Yes, it seems so... Shader workshop also says this:
Quote
Thus shadow mappers usually render two 180° views per light (hemispheric shadow mapping), or - for better quality - six 90° views (six-sided shadow mapping). Rendering six view per light makes shadow mapping quite slow, therefore advanced renderers skip views depending on which of the 90° sectors of the light sphere are outside the camera view frustum.
But what I fail at is, understanding, how to pass stuff from all those views (6 per light) into the shader.
Posted By: Emre

Re: Depth buffer and multiple lights - 04/17/20 16:33

For better answers and explanation, txesmi is best i guess. laugh

Also i made a small example while working on the subject. I don't know if it works for you, but maybe you want to take a look in the meantime.

https://drive.google.com/file/d/1DffukQjfw-LovNPslxR8givJMQeUtfuH/view?usp=sharing

My example is old and codes are not clean. Sorry for that. I didn't think I'd share it with someone while doing it.
Posted By: 3run

Re: Depth buffer and multiple lights - 04/17/20 18:08

It looks very good, thank you for sharing! :> It will be useful to learn from!
Posted By: txesmi

Re: Depth buffer and multiple lights - 04/18/20 12:44

Originally Posted by Emre
i don't know if is there any other way.

I am afraid there is not other way of rendering shadows of dynamic objects from an omnidirectional light. Its true, it is very expensive in performance.
© 2024 lite-C Forums