Frosted glass

A shader that creates an effect of a frosted glass surface. By default it works with a noise texture, but if a normalmap texture is used instead, it can create any glass surface type (e.g. lens).

Shader code
shader_type spatial;

uniform float distortion_size = 0.4;
uniform sampler2D glass;

void fragment() {
	vec2 d = texture(glass, UV).xy - vec2(0.5);
	ALBEDO = texture(SCREEN_TEXTURE, SCREEN_UV + d * distortion_size).rgb;
}
Tags
glass, noise, normalmap, screen texture
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 miskatonicstudio

UV light (2D and 3D)

Engine flame

Hexagon pattern

Related shaders

Simple 3D Glass

Procedural Stained-Glass Shader

guest
0 Comments
Inline Feedbacks
View all comments