bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.42k stars 3.59k forks source link

Sample-Distribution Shadow Maps #4253

Open superdump opened 2 years ago

superdump commented 2 years ago

Cascaded Shadow Maps use multiple directional light shadow maps that cover overlapping sections of the view frustum. The goal is to provide good quality directional light shadow mapping across a large range of view z. This is not possible with a single shadow map and rather requires trying to match the shadow map texel to screen space fragment resolution.

A significant shortcoming of cascaded shadow mapping is that the cascades are normally configured to be at fixed view z distances. This means that if you're looking at the horizon or looking down at the ground, the cascades are at the same view z, so when looking at the ground you may only be using one cascade and the others, which still being rendered, are wasted. A cascade configuration that provides a good mapping of shadow map resolution to screen space fragments for one view, will have too low or high resolution for another view.

Sample-Distribution Shadow Mapping (Lauritzen et al, 2011) aims to combat this by dynamically reconfiguring the cascades based on what is in-view to achieve a consistently high quality by matching the shadow map resolution for each cascade to what is visible. https://dl.acm.org/doi/abs/10.1145/1944745.1944761

superdump commented 1 year ago

https://www.intel.com/content/dam/develop/external/us/en/documents/sampledistributionshadowmaps-siggraph2010-notes-181237.pdf

JMS55 commented 1 year ago

https://therealmjp.github.io/posts/shadow-maps/#gpu-driven-cascade-setup-and-scene-submission