Qt Quick 3D - 캐스케이드 섀도 맵 예제
캐스케이드 섀도 맵을 보여줍니다.
이 예시에서는 캐스케이드 섀도 맵과 함께 DirectionalLight 을 사용하는 방법을 보여줍니다.
씬의 QML 코드를 살펴보겠습니다:
View3D { id: view x: settings.viewX y: 0 width: parent.width - settings.viewX height: parent.height camera: camera environment: SceneEnvironment { clearColor: "lightblue" backgroundMode: SceneEnvironment.Color antialiasingMode: SceneEnvironment.MSAA antialiasingQuality: SceneEnvironment.High } PerspectiveCamera { id: camera position: Qt.vector3d(458, 300, 515) eulerRotation: Qt.vector3d(-14, 19, 0) clipFar: settings.clipFar } DirectionalLight { visible: true castsShadow: true shadowFactor: settings.shadowFactor eulerRotation: settings.eulerRotation csmSplit1: settings.csmSplit1 csmSplit2: settings.csmSplit2 csmSplit3: settings.csmSplit3 csmNumSplits: settings.csmNumSplits shadowMapQuality: settings.shadowMapQuality csmBlendRatio: settings.csmBlendRatio shadowBias: settings.shadowBias pcfFactor: settings.pcfFactor softShadowQuality: settings.softShadowQuality shadowMapFar: settings.shadowMapFar lockShadowmapTexels: settings.lockShadowmapTexels } Model { id: ground source: "#Cube" scale: Qt.vector3d(25, 0.01, 135) z: -5500 materials: PrincipledMaterial { baseColor: "gray" } castsShadows: false } Node { id: shapeSpawner Component.onCompleted: { var conesAndCylinderTrio = Qt.createComponent("ConesAndCylinderTrio.qml") var z_pos = 0 for (var i = 0; i < 25; i++) { conesAndCylinderTrio.incubateObject(shapeSpawner, { "z_positions": [ z_pos, z_pos - 125, z_pos - 250 ]}) z_pos -= 450 } } } }
장면은 DirectionalLight, PerspectiveCamera, 바닥 Model, 원뿔과 원통 Model의 긴 배열로 구성되어 있습니다. 이 긴 배열은 캐스케이드가 장면의 그래픽 충실도를 높이는 데 어떻게 도움이 되는지 보여주기 위해 다음과 같이 배치되어 있습니다. 섀도 맵을 하나만 사용하면 아티팩트가 발생하지만 캐스케이드를 사용하면 이를 해결할 수 있습니다. DirectionalLight 에는 UI의 설정 창을 통해 조정할 수 있는 많은 프로퍼티가 포함되어 있습니다.
다양한 속성에 대한 자세한 내용은 섀도 매핑 문서를 참조하고 예제를 통해 속성이 어떻게 상호 작용하는지 확인해 보시기 바랍니다.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.