I generated over 10000 blocks using intancedUniformMesh and made the blocks transparent by modifying the uniform opacity in the material shader, but it resulted in a lot of incorrect occlusion. If it is an independent multiple object, I can set the depth text or writing to modify whether it is displayed transparently. What should I do with the intanceduniformmesh object?Please
codesandbox
const geometry = new THREE.BoxGeometry();
const material = new THREE.MeshPhongMaterial({
transparent: true,
});
// material.onBeforeCompile = function (shader) {
// console.log(shader.fragmentShader);
// //find the uniform opacity
// };
this.instancedMesh = new InstancedUniformsMesh(
geometry,
material,
info.length
);
info.map((d, i) => {
this.instancedMesh.setMatrixAt(i, this._genMatrix(d));
this.instancedMesh.setColorAt(i, new THREE.Color(0xffffff));
this.instancedMesh.setUniformAt("opacity", i, i % 6 < 2 ? 0 : 1);
});