2

I want to render a custom mesh (LAB.obj) with a certain transparency in a Qt3D scene. I use QDiffuseSpecularMaterial with diffuse color set to Qt.rgba(1,0.6,0.42,0.9) - alpha value is 0.9. I get strange horizontal stripes throughout my model when rendered and parts of the object which should be in the back erroneously appear in the front. See the following image:

enter image description here

What am I doing wrong?

Here is the code broken down to the important parts:

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"
                }
            ]
        }

    }



}

}

Florian Blume
  • 3,237
  • 17
  • 37
user137589
  • 163
  • 8
  • Does this also happen when you set alpha to 1? – Florian Blume Mar 13 '19 at 10:13
  • Yes it happens with every alphavalue, however it is best visible with high values such as 0.9 or 1. Does not happen when alphablending is set to false, however then transparency does not work anymore... – user137589 Mar 18 '19 at 06:49
  • Can you provide a link to the mesh? It's difficult to just guess and this way I could try out some things. – Florian Blume Mar 18 '19 at 13:45
  • That would be very helpful! Here is the link [link](https://wetransfer.com/downloads/96c75d96787b4746e5a86db155b1396820190327073943/10cd020fb52df74f93b57e1f2efcaa3f20190327073943/bbe74e) – user137589 Mar 27 '19 at 07:42

0 Answers0