Slime/Slug wavy walk

This shader uses this https://godotshaders.com/shader/pixel-melt/ as a base to make an texture wobbly the closer they are to y=1 (the bottom).

Setting how_low to 5 will make the waves affect the bottom part way more than the top part. Having as 0 will have it affect every y pixel the same.

Think of Gary from Sponge Bob walking. 🙂

Shader code
shader_type canvas_item;

// Animate from 0 to 1, result in 0 should be the same as in 1, a loop
uniform float progress: hint_range(0.0, 1.0) = 0.0;

// How jagged each band of melting pixels are
// This is also the amplitude of the wave
uniform float meltness: hint_range(0.0, 3.0) = 1.0;

// If it should affect only lower parts of the shader, it also increases the meltness
uniform float how_low: hint_range(0.0, 5.0) = 1.0;

// How wavy. 
uniform float wave_frequency: hint_range(0.0, 30.0) = 20.0;

float wave(float x) {
	return x - 2.5 + cos(2.0 * PI * progress + wave_frequency * x);
}

void fragment() {
	vec2 uv = UV;
	
	uv.y -= pow( uv.y,how_low ) * 0.02 * meltness * wave( UV.x - mod( UV.x, TEXTURE_PIXEL_SIZE.x ));
	
	COLOR = texture(TEXTURE, uv);
	
	// "delete" pixels out of range
	if (uv.y <= 0.0 || uv.y >= 1.0) {
		COLOR.a = 0.0;
	}
}
Tags
4.3, slime, slug, walk, wave
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

2D Wavy Effect

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments