Squigglevision

Per-object Squigglevision, also known as shimmer or boiling lines. Helps emulate a hand drawn, frame-by-frame look.

Noise should be a seamless black and white texture. The shader uses world space coordinates for consistency across objects.

Shader code
shader_type canvas_item;
render_mode world_vertex_coords;

group_uniforms Squiggle;
/**
 * Noise texture scale
 * By default, the noise texture's size in world coordinates is set by its resolution
*/
uniform vec2 scale = vec2(1.0);
uniform float strength = 1.0;
/**
 * Number of squiggle frames per second
*/
uniform float fps = 6.0;
uniform sampler2D noise : filter_linear, repeat_enable;
group_uniforms;

varying vec4 modulate;
varying vec2 noise_uv;

void vertex() {
	modulate = COLOR;
	
	// Use world coordinates for scale-independent squiggles, offset by position to keep pattern attached to object
	noise_uv = (VERTEX - MODEL_MATRIX[3].xy) / (vec2(textureSize(noise, 0)) * scale);
}

// Use irrational constants for unique squiggles every frame
#define offset_multiplier vec2(PI, E)

void fragment() {
	vec2 noise_offset = vec2(floor(TIME * fps)) * offset_multiplier;
	float noise_sample = texture(noise, noise_uv + noise_offset).r * 4.0 * PI;
	vec2 direction = vec2(cos(noise_sample), sin(noise_sample));
	vec2 squiggle_uv = UV + direction * strength * 0.005;
	
	COLOR = texture(TEXTURE, squiggle_uv) * modulate;
}
Tags
cartoon, distortion, doodle, drawing, hand drawn, shimmer, sketch, squiggle, toon, wiggle
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 tentabrobpy

Snell’s Window

Surface Embedded Sprites

N64 Style Skybox

guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Diogo Matheus
Diogo Matheus
10 days ago

Nice shader, can you share the original noise?

André
André
7 days ago

That’s so coooool!!!

Tsunscreen
Tsunscreen
1 day ago

I adore this shader, thank you!