3D Low Distortion Refraction (Low Poly Glass)

I use it for visual distortions caused by shockwaves or glass while preserving the low poly asthetic.

Tested in 4.2

Shader code
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx,unshaded;
uniform vec4 albedo : source_color = vec4(1.0, 1.0, 1.0, 0.0);


uniform float specular;


varying flat vec3 norm;
varying flat float norm_val;

uniform float offset = 0.05;

uniform float opacity = 0.9;


uniform sampler2D SCREEN_TEXTURE: hint_screen_texture,filter_linear_mipmap;

void vertex() {
	norm = NORMAL;
}










void fragment() {
	
	
	vec3 normx = NORMAL;
	NORMAL = norm;
	
	
	vec2 displacement = vec2(offset);
	displacement.x *= -normx.x*2.0;
	displacement.y *= -normx.y*2.0;
	vec4 alpha = vec4(1.0);
	alpha = texture(SCREEN_TEXTURE ,SCREEN_UV + displacement );
	
	
	
	
	
	
	ALBEDO = mix(alpha.rgb,albedo.rgb,albedo.a);
	SPECULAR = specular;
	ALPHA = opacity;
	
	
	
}
Tags
glass, Low Poly, refraction, shockwave
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 KnightNine

The Pain Shader

Low Poly Fresnel

Related shaders

Low Poly Fresnel

Low poly water

Transparent Water Shader supporting SSR and Refraction

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments