PNG texture not coming as expected on material

I have added a png image on texture using the below code, :

            // Create a material with the image texture
            var planeMaterial = new BABYLON.StandardMaterial("imageMaterial", scene);
            planeMaterial.diffuseTexture = new BABYLON.Texture("products/tshirt1.png", scene);
            plane.material = planeMaterial;
            (await scene).getMaterialByName("imageMaterial").emissiveTexture = new BABYLON.Texture("products/tshirt1.png")

It should come like this:

But it is coming like this:

What is needed to be done in my code ?

You need to change opacity and not emissive

see Babylon.js docs

I guess you double checked the texture to have an alpha channel?

It is solved. Thanks

I have used this code:

    const plane = BABYLON.CreatePlane("shirt")
    const texture = new BABYLON.Texture("")
    const material = new BABYLON.StandardMaterial("mat")
    material.diffuseTexture = texture
    material.emissiveTexture = texture
    plane.material = material

    texture.hasAlpha = true // <----
1 Like