Transparency Dither
This is the same distance fade effect used in the StandardMaterial3D under “Distance Fade”
However, this dithering effect is not based on distance. Instead, it uses the alpha value of the source color.
Source:
https://github.com/godotengine/godot/blob/master/scene/resources/material.cpp
Shader code
shader_type spatial;
const vec3 magic = vec3(0.06711056f, 0.00583715f, 52.9829189f);
uniform vec4 color: source_color = vec4(1.0, 1.0, 1.0, 0.5);
void fragment() {
ALBEDO.rgb = color.rgb;
if (color.a < 0.001 || color.a < fract(magic.z * fract(dot(FRAGCOORD.xy, magic.xy)))) {
discard;
}
}