Godot Version
4.5.1
Question
I have an animated Sprite3D that I want to be visible underneath occluding geometry. I want to use an xray shader to achieve this.
Currently I’m duplicating the original Sprite3D and applying a shader to the duplicate.
shader_type spatial;
render_mode unshaded, depth_draw_never;
uniform sampler2D albedo_texture : source_color;
uniform vec4 xray_color : source_color = vec4(0.0, 1.0, 1.0, 0.5);
void fragment() {
vec4 tex = texture(albedo_texture, UV);
if (tex.a < 0.1) {
discard;
}
ALBEDO = xray_color.rgb;
ALPHA = tex.a * xray_color.a;
}
But the effect isn’t working. Furthermore, this approach won’t automatically animate the xray sprite3d.
Is there a better way to do what I’m trying to do?