Yo @Deltakosh , @sebavan … I have a really weird issue with Shader Mix Color.
I have created a shader that mixes the finalColor with a Highlight Color. Kinda like the way mesh.renderOverlay works but with instances. The main fragment simply mixes the color:
return {
CUSTOM_FRAGMENT_DEFINITIONS: `
#ifdef INSTANCES
varying vec2 instanceUV6; // Receive from vertex shader
#endif
`,
CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `
#ifdef INSTANCES
if (instanceUV6 == vec2(1.0, 1.0)) {
vec3 highlightColor = vec3(0.306, 0.745, 0.969);
finalColor.rgb = mix(finalColor.rgb, highlightColor.rgb, 0.3);
}
#endif
`,
};
And works great EXCEPT on some Windows machines with NVIDIA cards using CHROME or EDGE… Is looks like some sort of Z-fighting:
But it should look like this:
NOTE: This does not happen in the playground.
NOTE: I try to force depth pre pass and a seperate culling pass as well
constructor(material) {
super(material, "HighlightInstanceMesh", 100, { HIGHLIGHTINSTANCEMESH: false });
// ..
// Note: Ensures the highlight is rendered on top
// ..
if (material.needDepthPrePass !== true) {
material.needDepthPrePass = true;
}
if (material.separateCullingPass !== true) {
material.separateCullingPass = true;
}
this._enable(true);
}
@Deltakosh … You got any theories as to why SOME windows machine with NVIDIA cards render like this…