Squash and Stretch

An extremely simple implementation of a squash and stretch shader in Godot. Tested in Godot 4.0 Alpha 11.

Note: You may need a high-poly model.

 

Follow me on YouTube for Godot tutorials: https://www.youtube.com/c/ArcaneEnergy

Shader code
shader_type spatial;

uniform vec2 direction = vec2(1.0);
uniform float squash: hint_range(0.0, 2.0) = 1.0;
uniform float offset: hint_range(-0.5, 0.5) = 0.0;

void vertex() {
	float v = abs(VERTEX.y + offset) * squash + direction.x;
	VERTEX *= vec3(v, direction.y, v);
}
Tags
3d, Blob, squash, stretch, vertex
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.

Related shaders

Stylized grass with wind and deformation

UV light (2D and 3D)

UV and Normals Unwrap (Mesh Projection as UV) World Aligned

guest

0 Comments
Inline Feedbacks
View all comments