我想在其他一切之上渲染一个网格,这个解决方案工作正常: Three.js - Geometry on another
我想知道使用mesh.renderDepth 是否可以实现相同的目标,但到目前为止我还无法让它发挥作用。似乎 renderDepth 只有在 material.depthTest 或 depthWrite 设置为 false 时才有效,但是同一对象中的深度排序当然是错误的:http: //jsfiddle.net/SF9tX/22/
var cube = new THREE.Mesh(geometry, material);
cube.renderDepth = 1;
scene.add(cube);
var cube2 = new THREE.Mesh(geometry, material);
cube2.position.x = 1;
cube2.renderDepth = 2;
scene.add(cube2);
// with any one of these lines the renderDepth has an effect
// but then of course the depth test/write is wrong within the same object
// material.depthWrite = false;
// material.depthTest = false;