Jump to content
  • Advertisement
Sign in to follow this  
theHOUSE16

Is it possible to apply a variable number of shadow maps in one pass?

This topic is 1339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sorry, a bit of a noob question but, is it possible to apply a variable number of shadow maps in one pass?  By variable i mean having a single pixel shader that can take any number of light matrices and shadow maps and calculate the lighting on that pixel from all the lights in one pass. Is that possible? What I’d like to do and what seems most efficient to me is to have all of my shadow maps and light matrices in arrays of something similar and pass them to glsl so that I could do all of my shadowing in one pass but from what I’ve been able to find I don’t think its possible to pass an array of matrices or an array of structs to glsl. Is the only option to do a pass per light and save the previous lighting in a texture? It seems like there would be a more efficient method.

 

If this isn't possible whats the standard method for rendering with multiple shadow maps?

 

Share this post


Link to post
Share on other sites
Advertisement

Yes, it is no problem to sample multiple shadowmaps in a single shader pass. How many will depend on your hardware.

 


If this isn't possible whats the standard method for rendering with multiple shadow maps?

This is one way to do it, and it sounds valid. Thought the major issue with multiple shadow maps is the efficient creation of a shadow maps, regardless of how you render them.

Share this post


Link to post
Share on other sites

You can also pack a large number of shadow maps into a single texture. It's common to create a large (e.g. 2048 x 2048) depth map, and then divide it up into a large number of smaller regions for different shadow maps.

e.g. within that single 2048 texture you could have 2x 1024 maps + 4x 512 maps + 8x 256 maps + 32x 128 maps biggrin.png (or any other combination -- more lights = less pixels per light, less lights = more pixels per light)...

 

You could then have an array of view-proj matrices for each light, and an array of texture coordinate min/max values for each light, specifying which part of the large shadow buffer belongs to each light.

Edited by Hodgman

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!