我想在Qt3D场景中渲染具有一定透明度的自定义网格物体(LAB.obj)。我将QDiffuseSpecularMaterial
的漫反射色设置为Qt.rgba(1,0.6,0.42,0.9)
-alpha值为0.9。渲染时,在整个模型中出现奇怪的水平条纹,而应该在后面的对象部分错误地出现在前面。参见下图:
我在做什么错了?
以下是细分为重要部分的代码:
Item {
Scene3D {
id: scene
anchors.fill: parent
aspects: ["input", "logic"]
Entity {
id: sceneRoot
Camera {
id: camera
projectionType: CameraLens.PerspectiveProjection
nearPlane : 0.01
farPlane : 1000.0
fieldOfView: 45
position: Qt.vector3d(0,0,40)
upVector: Qt.vector3d( 0,1,0 )
viewCenter: Qt.vector3d(0,0,0)
}
OrbitCameraController {
camera: camera
linearSpeed: -200
lookSpeed: -180
}
components: [
RenderSettings {
ForwardRenderer {
camera: camera
clearColor: "transparent"
}
},
InputSettings {}
]
Entity {
id: customEntity
components: [
DiffuseSpecularMaterial {
diffuse: Qt.rgba(1,0.6,0.42,0.9)
alphaBlending:true
},
Mesh {
id: customMesh
source: "qrc:LAB"
}
]
}
}
}
}