Stencil depending if is hidden or visible

Godot Version

4.6 Stable

Question

I’m following this tutorial for post_effect to display and hide meshes -

But one thing I’m trying to understand is if I want to display it red only if is hidden behind wall, object ( other mesh) how to apply it ?

current shader code

shader_type spatial;
render_mode unshaded, fog_disabled, ambient_light_disabled, cull_disabled, depth_test_disabled, depth_draw_never;
stencil_mode read, 1, compare_equal;

uniform sampler2D screen_texture : hint_screen_texture;

void vertex() {
	POSITION = vec4(VERTEX, 1.0);
}

void fragment() {
	vec3 screen_rgb = texture(screen_texture, SCREEN_UV).rgb;
	screen_rgb.r += 0.1;
	ALBEDO = screen_rgb;
	//ALBEDO = vec3(1.0, 0, 0);
}

applied to material