Details
-
User Story
-
Resolution: Fixed
-
P1: Critical
-
None
-
6.8
-
None
-
3400bd701 (dev), a0e28fa87 (dev), 5454f5192 (dev), 12bc9512e (dev), 0c85d183b (dev), b20fd4dcc (dev), bd34c04b0 (dev), 013a0c981 (6.8), 95acc34e1 (dev), 5aad8d9aa (6.8), 0dbd0e42e (dev), 608caa5c0 (6.8), b71863d40 (dev), b4c996424 (6.8), d5af360bb (dev)
Description
There are several areas that could use some modernization in the shadow mapping in Qt Quick 3D: Certain artifacts due to the optimized but imperfect algorithm + missing support for things like cascading shadow maps, which makes directional lights work poorly for larger scenes.
It would be sensible to go through this topic from the ground up and refactor, implement new techniques, and raise the quality of the shadow mapping everywhere we can.
The plan is to change the current shadow-mapping approach using a texture or cubemap per light to instead use texture arrays. One for directional lights and one for point lights and spot lights. This should increase performance and make it easier to implement cascading shadow maps for directional lights which is also a part of this task. Fix the "soft shadow" bug where objects further apart have darker shadow than objects closer. We will also improve our soft shadow edges by implementing VSM (Variance shadow maps) or similar. While doing this we should also improve our shadow mapping debug tools.
Below is an outline of what should be done and an approximate order of doing it.
□ Debugging:
Add manual test scene for adding lights
DebugView: draw directional light bounding box in scene
DebugView: add drawing of shadowmap https://codereview.qt-project.org/c/qt/qtquick3d/+/566180
Fix "soft shadow" bug (QTBUG-119622) while also adding VSM or similar PCF.
Rework DirectionalLight to use texture array. https://codereview.qt-project.org/c/qt/qtquick3d/+/547094
Rework Point-light to use texture array and polar coordinates. Low prio.
Rework Spotlight to not use cube map https://codereview.qt-project.org/c/qt/qtquick3d/+/547462
Improve documentation. We should have a "shadows" topic in QQ3D describing how our shadow mapping works covering positives/negatives, depth bias, pcf, light bleed etc. https://codereview.qt-project.org/c/qt/qtquick3d/+/562471
Make DirectionalLight use Cascading shadow maps https://codereview.qt-project.org/c/qt/qtquick3d/+/557566
Make all new exposed required properties work in QDS https://codereview.qt-project.org/c/qt/qtquick3d/+/575361
Optional/nice to have:
Add soft/hard shadows property
* DebugView: overlay boundingbox on shadowmap
Shadow draw distance property
* default/dynamic shadow bias values (as described in learnopengl/shadowmapping shadow acne issue)
Attachments
Issue Links
- covers
-
QTBUG-124796 QT quick 3d physics- Cannon example- shadow flickering
- Closed
- relates to
-
QTBUG-112846 Shadow artifacts
- Closed
-
QTBUG-119622 Shadows are not working correctly
- Closed
-
QTBUG-82333 Support Cascading Shadow Maps for Directional Lights
- Closed