Multiple shadow casting lights?

Is it possible to have multiple lights that cast shadows? For example street lights down a road, or hallway lights? Of course, the shadow rendering distance would be rather low to reduce lag, but I am not sure how to make a PSSM shadow renderer attached to a point-light, or for that matter if it’s possible to have multiple PSSM shadow renderers at one time.

Light and shadow have few to do with each other in computer graphics actually unless you are raytracing. What you would have to do is in fact have multiple PSSM renderers with different light positions set. But that is too much work for most graphics cards so you will have to either use premade lightmaps or a nifty postprocessing/material shader to have a whole scene lit like that.

Its possible, just that we didn’t do it yet

Maybe I could make it so only one shadow is cast at a time by making bounding spheres for the light’s radius and only activating shadows when the player enters this sphere. But another thing is, does the PSSM shadow renderer support point-light shadows, or just directional?

The problem is that the PSSMRenderer flush the shadow queue after rendering, so if you have 2 pssmRenderer the second one does not have any object to render in the shadow queue

@Momoko maybe just a flag like ‘flushQueues’ could do the trick…

Here we go

What do you think Kirill?

@vinexgames, once it’s in i suggest you sort out carefully which objects need dynamic shadow and which don’t. Pssm is a performance killer, so 2 of them won’t make things better.

You can use lightmaps for static shadows, and pssm only for moving objects.

@vinexgames it’s in last svn.

usage is

PssmRenderer pssm1 …

…init pssm1


PssmRenderer pssm2 …

…init pssm2



Just a note that this method isn’t exactly efficient and it will only work for directional lights.

Me and @nehon are kind of brainstorming of a better solution

Quite a lot of storm in my brain right now :stuck_out_tongue:

Maybe a shadow renderer where you can register more than on light? I think there is no such kind of a renderer so far, right? What I also did not understand what are static light/shadow and how can I have them? I suppose my point light shadow renderer and a static light/shadow together will also have issues when my point light lights the static shadow, right?