# circular pattern

Circular Pattern meant to be used in a plane as a placeholder for a 3D character but you can easily convert it to canvas item

You can manipulate the speed easily from gdscript by adding delta to the uniform “revolutions”, so you have 1 revolution per second.

(I show the script in the video)

``````shader_type spatial;

uniform vec3 color:source_color;
uniform float density:hint_range(0.0, 1.0, 0.01);
uniform float angular_res:hint_range(1, 40, 1);
uniform float line_space:hint_range(0.0, 1.0, 0.01);
uniform float revolutions;
uniform float emission:hint_range(0.0, 20.0, 0.01);

float circle(vec2 uv, float diameter, float feather)
{
}
vec2 polar_coordinates(vec2 uv, vec2 center)
{
vec2 dir = uv - center;
float radius = length(dir) * 2.0;
float angle = atan(dir.y, dir.x) / TAU;
}
float random (vec2 st) {
return fract(sin(dot(st.xy,
vec2(12.9898,78.233))) * 43758.5453123);
}
float randomf(float x){
return fract(sin(x) * 100000.0);
}
void fragment() {
vec2 uv = polar_coordinates(UV,vec2(0.5));
vec2 igrid = floor(fract(uv)*res);
vec2 uv2 = polar_coordinates(UV,vec2(0.5));
uv2.y -= revolutions * (randomf(igrid.x)+0.1);
vec2 igrid2 = floor(fract(uv2)*res)/res;
vec2 fgrid = fract(uv2*res);
float rnd = random(igrid2);
float val = float(rnd > (1.0 - density));
float cmask = 1.0 - circle(UV,1.0,0.0);
ALBEDO = color;
EMISSION = color * emission;
}``````
###### Tags
circular, pattern, random
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.

### Variable Dot Pattern

Subscribe
Notify of

Inline Feedbacks
7 months ago

Outstanding usefulness, and a must-have for any sci-fi game. Though having revolutions use in-game time would make this shader even more efficient (I thought the shader was bugged until I saw the video xD)

4 months ago

uv2.y -= revolutions * (randomf(igrid.x)+0.1) * TIME;

jeykyl
5 months ago

How do you animate this ? Mine is just static

Arte
5 months ago