Skip to content Skip to sidebar Skip to footer

Three.js Meshbasicmaterial Doesn't Work As Expected

I am trying to create a texture with Three.js. My source of texture_f1 is a .png file witch means you can see the background through it. The problem is that if i try to set backgr

Solution 1:

If you have a transparent texture, you must set material.transparent to true.

var material = new THREE.MeshBasicMaterial( {
    color: 0xffffff,
    map: texture,
    transparent: true
} )

Note that the material color does not "show through" the transparent texture -- it tints the texture.

If you want the material color to "show through" the transparent texture, then you need to use ShaderMaterial, instead, and create a custom shader.

There is an example of doing that in this stackoverflow answer.

three.js r.71

Post a Comment for "Three.js Meshbasicmaterial Doesn't Work As Expected"