首页 > 解决方案 > Transparency texture display incorrectly

问题描述

I create a mesh with transparency texture over the ground. but when I move the mesh, the transparent part of the texture changed to the background color of the scene somewhere. how to solve this problem? am I missing some configuration here?

mainCode:

this.renderer = new THREE.WebGLRenderer({antialias: true,alpha: true,logarithmicDepthBuffer:true});
let material = new THREE.MeshBasicMaterial({side: THREE.DoubleSide,color: 0xFFFFFF,map: new THREE.TextureLoader().load(_background),transparent: true,opacity: 1,});

screenshot of the bug

标签: three.js

解决方案


设置depthTest:false材料中

方法 :

this.renderer = new THREE.WebGLRenderer({antialias: true,alpha: true,logarithmicDepthBuffer:true});
let material = new THREE.MeshBasicMaterial({side: THREE.DoubleSide,color: 0xFFFFFF,map: new THREE.TextureLoader().load(_background),transparent: true,opacity: 1,depthTest:false});

推荐阅读