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;

}
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

2D Fire

3D Hologram Shader

Mario Bridge Shader

Related shaders

Warped Rotating Liquid Stripes

[2D] Texture-based liquid effects

2D Liquid Fill Inside Sphere v2

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Arkies
Arkies
1 month ago

Hey thanks for uploading this so fast! Great work!