精品学习网->精美文摘

上一篇    全部文章
three.js Material半透明材质遮挡后面的模型

three.js Material半透明材质遮挡后面的模型


绘制的一个半透明的平面,在某个角度观察时,发现后面的模型被遮挡了

解决办法:

1.设置material的depthWrite属性为false

2.设置material的depthTest属性为false

depthWrite:渲染此材质是否对深度缓冲区有任何影响。默认为true

depthTest:是否在渲染此材质时启用深度测试。默认为 true。

const material = new THREE.MeshBasicMaterial({
    color: 0xffffff,
    side: THREE.DoubleSide,
    transparent: true, // 设置为true,opacity才会生效
    opacity: 0.1,
    depthWrite: false, // 不遮挡后面的模型
    // depthWrite: false // 关闭深度测试
});
  
 


     返回顶部
threeJSMaterial半透明材质遮挡后面的模型