Shadow Map Caching in Call of Duty

Started by
5 comments, last by Hodgman 5 years, 11 months ago

Hey guys!

 

I am going through Rendering in Call of Duty presentation.

I would like to double-check with you if I follow correctly their shadow caching scheme (slides 21, 22) .

 

As the first step, they cull light view frustums against camera frustum.

Then, they take from the stale cache all shadow maps which require update. Phrasing "DO NOT need update" sounds a bit odd to me in this context.

Among these shadow maps from the stale cache, they pick 4-8 of them based on importance (detected as visible on the first step?, distance, projection size, etc) and update them.

They are sort of trying to fill their stale cache as soon as possible.

If I understand correctly, the stale cache is the one which drives shadow map update as they want to populate it as soon as possible?

 

I guess, another strategy would be to pick 4-8 relevant shadow maps to the camera frustum.

For each shadow map, check if it is in the stale cache and update if needed. Otherwise, do nothing.

By doing this, stale cache gets populated not so aggressively.

 

BTW, what does keyword "FIN" mean in the slide?

 

Thanks!

Advertisement
31 minutes ago, _void_ said:

Then, they take from the stale cache all shadow maps which require update. Phrasing "DO NOT need update" sounds a bit odd to me in this context.

I think they mean, if it doesn't need updating (nothing moved, etc) then skip it / use cached value. Otherwise, add it to a prioritized list, from which the most important 4-8 will received updates.

32 minutes ago, _void_ said:

BTW, what does keyword "FIN" mean in the slide?

"The end" https://en.wiktionary.org/wiki/fin#Noun_6

@Hodgman Thanks for the input. They do use the first strategy I described trying to fill the stale cache asap, right?

On 5/9/2018 at 3:05 PM, _void_ said:

they want to populate it as soon as possible?

I'm not sure exactly what you mean by "asap" here - can you rephrase?

 If a light is going to cast a shadow, it has to be present in this cache. If it's present in the cache, but was generated on an older frame, the shadow will be present but outdated. They prioritize updates to try and make sure that you don't notice these "outdated" shadows.

@Hodgman Suppose, we have 128 shadow maps in the cache and 50 out of them require update. Say we can handle 8 shadow maps per frame and, currently, we have 6 lights visible in the camera with 1 up-to-date shadow map. So we need to update only 6-1=5 shadow maps. But since our budget for shadow map update is 8, I was under impression, they would pick 8-5=3 outdated shadow maps more from the cache so that to keep it up-to-date as much as possible. But if they do not want to update stale cache as soon as possible they would just update currently visible 5 shadow maps.

 

10 hours ago, _void_ said:

Say we can handle 8 shadow maps per frame and, currently, we have 6 lights visible in the camera with 1 up-to-date shadow map. So we need to update only 6-1=5 shadow maps. But since our budget for shadow map update is 8, I was under impression, they would pick 8-5=3 outdated shadow maps more from the cache so that to keep it up-to-date as much as possible

I didn't think of that! Yeah that would make sense, I guess, if you've budgeted for 8 SM updates, you may as well keep performance consistent -- optimizing for your worst-case rendering performance is way more important than optimizing your best-case performance.

However, they also mention on the previous slide that they often have 128(!!!) shadow casting lights in view at a time! :o 

This topic is closed to new replies.

Advertisement