World Vertex Coords shader flag causes clipping

Godot Version

4.2.1

Question

When enabling this flag:

The shader begins to clip with something else:

I’m not even sure of what it is, I’ve trying to research how godot shaders work but there’s so little info about this. Maybe it’s the light part of the shader clipping over?

How can I fix this so that only the shader shows up, as normal, without the white part clipping over it?

So I’m guessing you are two passes on the same mesh? with one of them being world vertex coords to do triplanar?

Well afaik when you use world vertex coords you loose floating point precission so that’s causing the z-fighting. There are a couple of things you can do to solve it. Try to adjust the rendering priorities on the materials so one is higher prio than the other. and/or slightly offset the vertices in one of the materials in the vertex shader.

void vertex() {
	VERTEX += NORMAL * 0.01;
}
1 Like

I fixed it by setting the material override as a ShaderMaterial directly, instead of a StandardMaterial3D with a ShaderMaterial as its next pass. Do make sure your shader’s blend mode is on Mix if you do that. If you need the StandardMaterial3D, then you can check Arnklit’s solution.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.