Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Shadow Mapping not working after porting to Qt 6,8
Forum Updated to NodeBB v4.3 + New Features

Shadow Mapping not working after porting to Qt 6,8

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 691 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DavideCaldara
    wrote on last edited by
    #1

    Hello!

    I'm developing an application in QtQuick3D in which i'm rendering some Models and casting shadows from a DirectionalLight. After porting from Qt 6.7.2 to 6.8 shadowmapping does not work anymore. Does anyone know why? I already tried to set model properties castsShadows and receivesShadows to true but shadows are not showing at all.
    This is my light.

    DirectionalLight {
                id: light1
                eulerRotation.x: 45
                eulerRotation.y: -45
                // ShadowMapping
                castsShadow: true
                shadowMapQuality: Light.ShadowMapQualityVeryHigh
                shadowFactor: 75
                brightness: 0.75
                pcfFactor: 2.0
                softShadowQuality: Light.PCF4
            }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Sounds like a possible regression.
      On which OS are you ?
      Can you provide a minimal compilable reproducer ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DavideCaldara
        wrote on last edited by DavideCaldara
        #3

        Thanks for the reply,
        I'm using windows 11.
        Here is an example qml file I have the issue with

        import QtQuick3D
        import QtQuick
        import QtQuick3D.Helpers
        import QtQuick.Controls
        import QtQuick.Dialogs
        import QtQuick.Layouts
        import MyQMLItem
        
        MyQMLItem {
            View3D {
                anchors.fill: parent
                environment: ExtendedSceneEnvironment {
                    id: sceneEnvironment
                    clearColor: "grey"
                    backgroundMode: SceneEnvironment.Color
        
                    // Anti-Aliasing
                    antialiasingMode: SceneEnvironment.MSAA
                    antialiasingQuality: SceneEnvironment.VeryHigh
        
                    // Ambient Occlusion
                    aoEnabled: false
                    aoStrength: 100
                    aoDistance: 20
                    aoSampleRate: 4
                    aoSoftness: 50
                }
        
                Node {
                    id: rotationNode
                    eulerRotation.x: 40
                    eulerRotation.y: -40
                    // Camera inside the rotation node to rotate around the center of the scene
                    OrthographicCamera {
                        id: camera
                        z: 6000
                        horizontalMagnification: 1.0
                        verticalMagnification: 1.0
                        clipNear: 10.0
                        clipFar: 15000.0
                    }
                }
        
                DirectionalLight {
                    id: light1
                    eulerRotation.x: 45
                    eulerRotation.y: -45
                    // ShadowMapping
                    castsShadow: true
                    shadowMapQuality: Light.ShadowMapQualityVeryHigh
                    shadowFactor: 75
                    brightness: 0.75
                }
        
                DirectionalLight {
                    id: light2
                    eulerRotation.x: -45
                    eulerRotation.y: 45
                    brightness: 0.75
                }
        
                Model {
                    source: "#Cube"
                    materials: DefaultMaterial {
                        diffuseColor: "lightgreen"
                    }
                }
        
                Model {
                    source: "#Cube"
                    scale: Qt.vector3d(5, 0.1, 5)
                    position: Qt.vector3d(0, 100, 0)
                    materials: DefaultMaterial {
                        diffuseColor: "lightgreen"
                    }
                }
            }
        }
        

        In Qt 6.7.2 I can see shadows (Desktop Qt 6.7.2 MSVC2019 64bit)
        8bca0680-16a7-4a39-becf-9110f1f0b833-image.png
        while in Qt 6.8 I don't see them (Desktop Qt 6.8.0 MSVC2022 64bit)
        d2709e5a-8798-43fa-b1e3-606c19913c6d-image.png

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jonas Karlsson
          wrote on last edited by
          #4

          So there seems to actually be two bugs in one in this example. 1) The shadow mapping is invalid when using an orthographic camera and 2) When using two Directional lights the shadow seems to get painted over. I'll made two bug reports for them here: https://bugreports.qt.io/browse/QTBUG-132080 and https://bugreports.qt.io/browse/QTBUG-132081

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jonas Karlsson
            wrote on last edited by
            #5

            This bug has been fixed in Qt 6.8.2 and later so try with that version and mark the issue is solved if it works.

            1 Reply Last reply
            1
            • SGaistS SGaist has marked this topic as solved on
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Thanks for the feedback and bug reports !

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved