Hi.
I have a problem in my scene with some lines that are coincident with some geometry surfaces.
The problem us that lines are only partialiy visible.
In order to improble z-fight I am alreay using a logarithmicDepthBuffer but no luck.
I hace read a lot about using polygonOffset, polygonOffsetUnits and polygonOffsetFactor in my materials but still no luck.
Basically I differ between lines and meshes using 2 different materials:
Here my materials:
Material for meshes:
meshMaterial = new THREE.ShaderMaterial( {
uniforms: uniforms,
vertexShader: “#version 300 es\n” + vertexShader,
fragmentShader: “#version 300 es\n” + fragmentShader,
transparent: true,
side: THREE.DoubleSide,
clipping: true,
clipShadows: true,
name: “Material”,
polygonOffset: true,
polygonOffsetUnits: 0.1,
polygonOffsetFactor: -4.0
//polygonOffset: true,
//polygonOffsetFactor: -0.1,
//polygonOffsetUnits: 4.0
} );
This is my material for lines
lineMaterial = new THREE.ShaderMaterial( {
uniforms: uniforms,
vertexShader: “#version 300 es\n” + vertexShader,
fragmentShader: “#version 300 es\n” + fragmentShader,
transparent: true,
side: THREE.DoubleSide,
clipping: true,
clipShadows: true,
name: “Material”,
polygonOffset: true,
polygonOffsetUnits: 0.1,
polygonOffsetFactor: 4.0
//polygonOffset: true,
//polygonOffsetFactor: -0.1,
//polygonOffsetUnits: -4.0
} );
I have tried to swtich between positive a negative values because I was not sure if positive values make the object more visible or hidden.
My feeling is that setting this attributes in a ShaderMaterial has no effect at all.
Anyway, none of the both options had any effect.
Here a screenshot: with polygonOffsetUnits with positive value in my line material:
Here a screenshot: with polygonOffsetUnits with negative value in my line material:
A remark, I am using webgl2 renderer and InstancedBufferGeometries.
Best regards