This has been a long ride but…
The new shadows (maps) have been merged!
Note that this isn’t the whole new shadow implementation. Other shadow related features will come later.
For instance current implementation is lacking soft shadows.
The benefits of the new implementation:
- Fixed shadow budget (user controlled)
- High number of shadows maps (4096 visible instead of less than 1024 per scene) without per light type restriction (there can be 100 sun in the scene now)
- Cached directional shadow (less costly when navigating)
- Improved scalability (simplify option)
- Optimized shadow map density (precision is put only where it is needed)
- Really high precision / sharp shadows (up to 8K shadows per cube-face projection)
- Less peter-panning artifacts due to shadow bias
- No more self shadowing artifacts (but aliasing is still present)
- Less quality settings to tweak (no more cascades control, bias, high bit-depth) because quality is adaptive
Downsides:
- Needs big shadow pools allocation upfront that cannot be shared between viewports.
- The rendering of the shadow-maps is more expensive.
- Sampling them is a bit more expensive.
There is 3 ways to hit memory limitations:
- If the shadow pool is bigger than what the GPU can support, then performance could degrade drastically as it will start to swap the textures to CPU memory or even to disk. The application could also run out of memory and quit unexpectedly.
- If there is many visible shadow enabled lights in the current view, then it is possible to run out of shadow mapping tiles. This results in missing shadow tiles and an error message will be displayed in the viewport.
- Too many shadowed lights might result in completely missing shadows on some lights.
This implementation of virtual shadow mapping was not as straight forward to make and required a lot of refactors of the draw manager to be made efficiently. The implementation itself was rewritten twice and the project grew in complexity. Along with that came other projects that needed my attentions. Future updates will be more regular.
There is still discussions about whether or not we will add some more parameters:
- Maximum resolution: Would allow adding a higher bound to the quality of sun shadows. This could be split between volume and opaque options as volumes might ask way too many shadow pages.
- Normal Bias: The new shadows being way sharper than previous implementation, it makes the shadow terminal problem much more noticeable. This bias would be a way to avoid this artifact. We cannot provide a per object solution like cycles does, so we have to make it either a per light option or a global per scene / render option. The later is preferred for simplicity of use.
Edit: There seems to be a driver issue affecting AMD GPUs which makes shadows not work at all. This has been reported and is being worked on by AMD.