Sign in to follow this  
theHOUSE16

Efficient shadow maps of multiple lights

Recommended Posts

I'm a little new to graphics programming so sorry if this question is a little on the basic side but what is an efficient implementation of a variable number of shadow maps? By variable i mean having a single pixel shader that can take any number of lights matrices and shadow maps and calculate the lighting on that pixel from all the lights without having to run the shader multiple times. Is this possible? I was thinking something like having an array of lights and their textures, passing that to glsl and iterating over the array in a single shader but from what I've read you can't pass an array of mat4s to glsl and you can't pass an array of structs either. 

 

And if its not possible what is the standard way of handling multiple lights?

Share this post


Link to post
Share on other sites

I would recommend looking into deferred shading. The biggest advantage to deferred shading is your material shader code is decoupled from your lighting code. This lets you create many different types of lights without touching a line of code in your material shaders.

Share this post


Link to post
Share on other sites

I've already implemented deferred shading and a single shadow map in my deferred shader but i'm interested in how to take that shader and add more shadow maps to it. 

 

ggWckcy.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this