Shadow Mapping not working after porting to Qt 6,8
-
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 }
-
Hi and welcome to devnet,
Sounds like a possible regression.
On which OS are you ?
Can you provide a minimal compilable reproducer ? -
Thanks for the reply,
I'm using windows 11.
Here is an example qml file I have the issue withimport 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)
while in Qt 6.8 I don't see them (Desktop Qt 6.8.0 MSVC2022 64bit)
-
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