Play with Furcifer sprite deformation shader

deformation shader from play with Furcifer 

 

you guys are awsome 

 

Shader code
shader_type canvas_item;

uniform vec2 deformation = vec2(0, 0);
uniform float sideWaysDeformationFactor = 5.0;
uniform float knockbackFactor = 0.4;

void vertex() {
	vec2 deformationStrength = abs(deformation);
	float sideWaysDeformation = min(deformationStrength.x, deformationStrength.y);
	float spriteWidth = abs(VERTEX.x);
	if (sign(VERTEX.y) != sign(deformation.y)) {
		VERTEX.x += sideWaysDeformation * sideWaysDeformationFactor * spriteWidth * sign(deformation.x);
	}
	vec2 scale = 1.0 - deformationStrength;
	
	VERTEX.x *= scale.x / scale.y;
	VERTEX.y *= scale.y / scale.x;
	VERTEX.xy += deformation * spriteWidth * knockbackFactor;
}
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

rgb offset shader v2

cool blackhole shader

Samuel Wolffang based rgb shift shader

Related shaders

Frosty Rotative Deformation

2d sprite based vfx gradient shader

Sprite Cut-Out/Cut-In Mask

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mindaugs
Mindaugs
3 months ago

What parrameters should i set on shader preferences for it to work?

babyl
babyl
1 hour ago

it doesnt really do anything