impact shader

tutorial followed from here:

Shader code
shader_type canvas_item;

uniform vec2 center;
uniform float force;
uniform float size;
uniform float thickness;

void fragment(){
	float ratio = SCREEN_PIXEL_SIZE.x / SCREEN_PIXEL_SIZE.y;
	vec2 scaledUV = (SCREEN_UV - vec2(0.5,0.0)) / vec2(ratio, 1) + vec2(0.5,0.0);
	float mask = (1.0 - smoothstep(size-0.1,size, length(scaledUV - center))) * 
	smoothstep(size-thickness-0.1,size-thickness, length(scaledUV - center));
	vec2 disp = normalize(scaledUV - center) * force * mask;
	COLOR = texture(SCREEN_TEXTURE,SCREEN_UV - disp);
//	COLOR.rgb = vec3(mask);
	
}
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 snesmocha

Reupload of outline shader

Samuel Wolffang based rgb shift shader

Shader Toy Conversion by scarm

Related shaders

Toon Shader inspired by Genshin Impact

2D Hologram Shader

Half-Tone Comic Shader

guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
doorstein
doorstein
1 month ago

How can I use the shader in a particular area and screen coordinates?