Transparency Dither

This effect is identical to the distance fade used in StandardMaterial3D under Distance Fade. Unlike distance-based fading, this dithering effect is controlled by the alpha component of the source color.

Source:
https://github.com/godotengine/godot/blob/master/scene/resources/material.cpp

Shader code
shader_type spatial;

const vec3 ign = 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(ign.z * fract(dot(FRAGCOORD.xy, ign.xy)))) {
		discard;
	}
}
Live Preview
Tags
Alpha Dither, alpha hash, dither, Dithered Transparency, dithering, interleaved gradient noise, screen door
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from jacob

Related shaders

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Riley
Riley
5 months ago

Bro, this is just like in Baldi’s Basics Plus! This is amazing!!