解决方案:
transparent: true //MeshLambertMaterial、MeshBasicMaterial
场景:将矢量图片作为纹理材质贴图:
const circleGeometry = new THREE.CircleGeometry(0.6, 80)
const textureLoader = new THREE.TextureLoader()
textureLoader.load('static/img/光圈.png', function(texture)
{
let circleMaterial = new THREE.MeshLambertMaterial({
map: texture
})
const circle = new THREE.Mesh(circleGeometry, circleMaterial)
scene.add(circle)
})
尝试添加属性:
color: 'white', // 自身颜色
emissive: 'white', // 自发光的颜色
depthTest: false, // 深度测试
甚至修改材质为MeshBasicMaterial、MeshNormalMaterial、MeshPhongMaterial,都没有效果。
最终解决:
const circleGeometry = new THREE.CircleGeometry(0.6, 80)
const textureLoader = new THREE.TextureLoader()
textureLoader.load('static/img/光圈.png', function(texture)
{
let circleMaterial = new THREE.MeshLambertMaterial({
map: texture,
transparent: true
})
const circle = new THREE.Mesh(circleGeometry, circleMaterial)
scene.add(circle)
})
我测试的MeshLambertMaterial、MeshBasicMaterial并不是depthTest: false
起作用,而是transparent: true
起作用,可能PointsMaterial有用。