I want to select a mesh and then draw a highlight on top of it. Everything works but when i turn on LogarithmicDepthBuffer, there is z-fighting.
I have added the LogDepthBuf_pars_vertex / fragment etc to the highlight material shader.
I can see the highlight material but there is Z-fighting. It’s weird it only happens on some meshes, not others.
const highlightMaterial= new THREE.ShaderMaterial({
uniforms: {
},
vertexShader,
fragmentShader,
transparent: true,
depthWrite: false,
polygonOffsetFactor:-4,
polygonOffsetUnits: 1,
});
Using the polygonOffsetFactor doesn’t work, I’ve tried all manner of combinations but looks the same with z-fighting. When I turn off logarithmicDepthBuffer i can see the mesh highlight and it does not z-fight, but I need logarithmicDepthBuffer for other stuff.