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

more shaders converted (enviroment)

masking shader

screen tile shader

Related shaders

Frosty Rotative Deformation

2d sprite based vfx gradient shader

Shining Sprite Effect

Notify of

Inline Feedbacks
View all comments