Jump to content
  • Advertisement
Sign in to follow this  
Quat

DX11 Updating Shadow Maps

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

I have deferred renderer in DX11 so I can support many lights. I have the option to make each light cast shadows with shadow maps. I am looking for good ideas on a system to determine when a shadow map needs to be updated. Examples that could cause a shadow map update:

1. Light moves
2. An object in the scene moves
3. An object is animated
4. An object is removed/added to the scene

My current idea is for each light to keep track of an object visibility list. If one of the above events occurs, then each light updates its visibility list and checks if it changed. If it changed, then it updates its shadow map using its updated visiblity list. If a light contains an animated object, then it always updates its shadow map. Obviously, a good data structure to query visibility is needed.

Another idea I had was to process one light per frame. So one light would check if its visibility list has changed, and update the shadow map if it had. Assuming I have less that 90 lights and am getting over 30 FPS, all shadow maps would be updated within 3 seconds (if I had to update all at once, which really should be never except at level load time). Although, I doubt it would happen, this also prevents a stall if I had to update all my shadow maps at once for some reason, as it spreads the work across frames.

Anyway, I'm just checking to see if anyone had good ideas / data structures for this. Edited by Quat

Share this post


Link to post
Share on other sites
Advertisement
I've always wanted to try caching each lights shadow map for purely static geometry and then using that to cull out dynamic stuff. I.E. from the shadow maps point of view never draw anything beyond the cached static shadow maps reach and only draw dynamic geometry when updating. If the light is static then who cares about redrawing all of the geometry every frame?

For that matter, I was also musing earlier today that you could use a tiled deferred approach to help you decide when to update shadow maps as well. I.E. an object moves in tile X, then you only have to update shadow casting lights that affect tile X, of course it won't work that way specifically, no way to tell from that what specific lights are affected, but the point is a scheme built around that might work. There are plenty of other things to consider, how far away is the light? How much screenspace does it actually take up? (If it's only a few pixels maybe you shouldn't care).

Honestly, use your imagination and experiment. The idea that you could even have 90 shadow casting lights in the same scene is pretty new, it's not like there's a ton of research or any best practices to deal with this sort of problem yet. Edited by Frenetic Pony

Share this post


Link to post
Share on other sites
Since this post got me thinking about it, in clearer and better explained manner I'd say:

Make sure you are using a tile base light culling scheme. See here: http://forum.beyond3...?t=61739&page=2 , DICE's presentations, etc.

Cull your lights out, and if it affects no tiles (the light doesn't show onscreen) then obviously don't update it the shadow map.

And as I mentioned above, always have a shadow maps purely static geometry cached if the light doesn't move. Then when updating only draw dynamic geometry with a depth closer than the cached static geometry. Because obviously nothing beyond that static geometry will ever need to be drawn, it could be a good performance win in the right situations.

Come to think of it, the cached shadow map could be very useful for culling out light as well. Assuming a much larger falloff radius for lights in future games it could get hard to cull out lights in the right scenarios. Just using the radius would get unwieldy. Say you had a dozen lights sitting in a house in an open world. They might all have a radius large enough to affect your current view, but most of them might be entirely occluded by geometry. You might be able to used those cached shadow maps to check and cull the lights when a tile based scheme might include them. Edited by Frenetic Pony

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!