Advertisement Jump to content
Sign in to follow this  
StanIAm

Shadowmapping as Texture2DArray

This topic is 1868 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

Hey guys one question: I have a deferred rendering pipeline and wouldl ike to implement shadow mapping.Now I found out that the depth shadows -> projection is the fastest way to do that by rendering first a scene from the view of the light as a depthmap and then project that with the perspective in the final pass to the scene.

My question is now, how to do that for multiple lights.

Do I have to render the scene always again for each light or is it possible to generate some shadowmaps in one pass by generating the view matrix ( which is generated by the lights position and rotation) or do I have to render the scene for all lights.?? The second question is how to pass that lightmaps in the final pass.Do I have to use for each shadowmap a rendertarget and then use a Texture2DArray in the final pass and project each lights shadow ??

Thanks

Share this post


Link to post
Share on other sites
Advertisement

Yes, you need to render the scene again for each light for which you want a shadow map. You might be able to squeeze in multiple depth maps in one render target if you want to save memory (e.g. in a render target with 2 16bit components, say).

 


Do I have to use for each shadowmap a rendertarget and then use a Texture2DArray in the final pass and project each lights shadow ??

 

Do whatever you need to do to get the depthmap to the shader that is drawing the corresponding light. if you're using deferred rendering, I'm assuming each light is done in a separate pass anyway?

 

Generally shadows are only done for the most "important" lights in a scene, since it would be prohibitively expensive doing it for all lights.

Share this post


Link to post
Share on other sites

You may use a texture array for storing depthmaps. If you want to render to multiple slices at once, you'll need to use a geometry shader to define the array slice.

You may also pack multiple depth maps in a texture atlas (ie. one big texture). 

Easiest way is to render a depth maps individually, the fastest way is to update multiple maps at same time (geometry shader is needed). 

Of course, to save processing power you may update far away maps less often (especially if the light source doesn't move or nothing moves inside the light area).

 

Cheers!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!