Liquid Glass

A simple glass shader 

Shader code
shader_type spatial;


uniform float Refraction_Strength = 0.05;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture;
uniform float Fresnel_Power = 1.0;
uniform float Emission_Power = 1.0;
uniform float Specular_Power = 1.0;
uniform float Roughness_Power = 0.1;
uniform float Rim_Power = 0.1;
uniform float Blur = 0.0;
uniform vec3 Taint:source_color = vec3(1.0);
void fragment() {
	vec3 view_normal = normalize((VIEW * vec3(NORMAL)).xyz);
	float fresnel = pow(1.0 - dot(NORMAL, VIEW), Fresnel_Power);
	vec2 offset = view_normal.xy * Refraction_Strength * fresnel;
	ALBEDO = texture(SCREEN_TEXTURE, SCREEN_UV + offset,Blur).rgb * Taint;
	EMISSION = texture(SCREEN_TEXTURE, SCREEN_UV + offset).rgb * Taint * Emission_Power;


	SPECULAR = Specular_Power;
	ROUGHNESS = Roughness_Power;
	RIM = Rim_Power;

}
Live Preview
Tags
3d, glass, Liquid Glass
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 Loop_Box

Related shaders

guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Arkies
Arkies
3 months ago

Hey thanks for uploading this so fast! Great work!

Xlebncat
Xlebncat
1 month ago

A simple, but perhaps the best glass shader I’ve seen in Godot. Thank you for your work!

Last edited 1 month ago by Xlebncat
Vlad
Vlad
19 days ago

Hey Nice Shader, can you post the settings you used in your examples, thanks

Jack Conradsen
Jack Conradsen
1 day ago

you wrote taint instead of tint

Last edited 1 day ago by Jack Conradsen