How can I set surface material override through a shader?

I have this viewmodel that has a shader as the material override/overlay but the other materials have shader materials, so I’m kind of stuck in one place. If you can help me, thank you very much!

Is there more you can explain about your situation? It’s hard to understand exactly what is happening, can you share your scene tree and what you are trying to change?

A little diagram for easy visualization:

The viewmodel shader:

shader_type spatial;
render_mode depth_draw_opaque, cull_disabled;

uniform float fov : hint_range(34, 75) = 54;

void vertex() {
	PROJECTION_MATRIX[0][0] = (1.0 / tan(fov * 0.5 * PI / 180.0)) / (VIEWPORT_SIZE.x / VIEWPORT_SIZE.y);
}

void fragment() {
	DEPTH = FRAGCOORD.z * 0.7;
}

Hope it clarifies enough!

You would have to re-create the material parameters in your shader.

If you’d prefer maybe you could use a StandardMaterial3D with the “Use Z-Clip Scale” property?

I will try this on a test project, I’ll get back as soon as I get desirable results!

Thank you very much! It worked very well with the FOV override! Makes me feel right at home.