4

How to render mesh texture, without this default, grey background? I mean, use Scene2D component, to generate texture with alpha. Now it's look like there was PhonMaterial underneath my red rectangle.

Entity {
id: root

components: [cubeTransform, cubeMaterial, cubeMesh]
PlaneMesh {
    id: cubeMesh
    width: 10
    height: 10
}
Transform {
    id: cubeTransform
    translation: Qt.vector3d(0, 4, 0)
    scale3D: Qt.vector3d(1, 1, 1)
}
TextureMaterial   {
    id: cubeMaterial
    texture: textureId
}
Scene2D {
    id: qmlTexture
    output: RenderTargetOutput {
        attachmentPoint: RenderTargetOutput.Color0
        texture: Texture2D {
            id: textureId

            width: 100
            height: 1024
            format: Texture.RGBA8_UNorm
            generateMipMaps: true
            magnificationFilter: Texture.Linear
            minificationFilter: Texture.LinearMipMapLinear
            wrapMode {
                x: WrapMode.ClampToEdge
                y: WrapMode.ClampToEdge
            }
        }
    }
    Rectangle {
        x: 50
        width: 50
        height: textureId.height
        color: "red"
    }
}
 }

Now, half of the mesh is red (as it should), but the second one is white, rather than transparent.

enter image description here

Rajju
  • 357
  • 3
  • 13

0 Answers0