试了VKSession:v1和v2效果都如下图,设置renderer.depth和child.material.depthTest,child.material.depthWrite但是加载模型还是穿透
loader.load('https://ar-1306178125.cos.ap-shanghai.myqcloud.com/uploads/file/2024/05/13/bc4a3366bd564afaa0c88a180963a4671715592719273.glb', gltf => {
gltf.scene.traverse((child) => {
if (child.isMesh) {
// 设置模型的深度测试属性
child.material.depthTest = true;
child.material.depthWrite = true; // 是否写入深度缓冲
child.material.needsUpdate = true;
console.log('child', child);
}
});
this.model = {
scene: gltf.scene,
animations: gltf.animations,
}
console.log('模型加载成功');
})
你好,请问用官方的示例是否有这个问题呢?
渲染器添加了const renderer = new THREE.WebGLRenderer({antialias: true,alpha: true,depth: true, autoClearDepth: true}) ;
模型添加了child.material.depthTest = true;child.material.depthWrite = true;child.material.needsUpdate = true;child.material.transparent = false;穿透效果依然很明显