Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116885

Improved shadow mapping in Qt Quick 3D

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.8
    • Quick: 3D
    • None
    • 3400bd701 (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

      □ Fix "soft shadow" bug (QTBUG-119622) while also adding VSM or similar PCF.

      □ Texture arrays for all lights: 

        - 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, vsm, light bleed etc.

      Make DirectionalLight use Cascading shadow maps https://codereview.qt-project.org/c/qt/qtquick3d/+/557566

      □ Make all new exposed required properties work in QDS

      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

          For Gerrit Dashboard: QTBUG-116885
          # Subject Branch Project Status CR V

          Activity

            People

              jokarlss Jonas Karlsson
              esabraha Eskil Abrahamsen Blomfeldt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are 4 open Gerrit changes