Simple Spiral

I made this very simple spiral shader on accident, so I decided to save and share in case I need it in the future.

Shader code
shader_type canvas_item;

uniform float ring_amount = 3.;
uniform int line_amount = 1;
uniform vec2 offset;
uniform vec2 scale = vec2(1,1);

void fragment() {
	vec2 curr_uv = UV;
	curr_uv += offset;
	curr_uv *= scale;
	
	vec2 uv_offset = vec2(0.5 * scale);
	float angle = atan(curr_uv.y - uv_offset.x, curr_uv.x - uv_offset.y);
	
	float curr_dist = distance(curr_uv, uv_offset);
	float curr_value = round(sin(curr_dist * (ring_amount * 10.) + angle * float(line_amount)));
	
	COLOR.rgb = vec3(curr_value);
}
Live Preview
Tags
shape, simple, simple shape, simple spiral, spiral
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from cerberus1746

Related shaders

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments