Motion Lines

Simple Godot 3 motion lines.

Put it on a ColorRect.

Parameters:
– speedScale: The speed which the lines move.
– clipPosition: The distance from the center that the lines appear.

It has colour support by changing the rect’s colour!

Shader code
shader_type canvas_item;

uniform float speedScale = 16.0;
uniform float clipPosition = 0.2;

float random (vec2 uv) {
    return fract(sin(dot(uv.xy,
        vec2(12.9898,78.233))) * 43758.5453123);
}

void fragment() {
	COLOR.a = 0.0;
	
	vec2 pos = UV - vec2(0.5);
	float theta = round(64.0 * atan(pos.y, pos.x));
	float dist = sqrt(pow(pos.x, 2) + pow(pos.y, 2));
	
	float distValue = round(dist * 4.0 + TIME * -speedScale + 8.0 * random(vec2(theta)));
	if (dist > clipPosition + random(vec2(theta)) * 0.3 && random(vec2(theta, distValue)) < 0.02) {
		COLOR.a = 1.0;
	}
}
Tags
godot 3
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 Haizlbliek

2D Fire Effect with colour banding

Tilemap Blur

Related shaders

Retro Screen Lines

Regular measurement lines

Speed Lines Shader for Godot 4

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Steampunkdemon
9 months ago

It works fine with Godot 4 as well without needing to change any of the code.

Mauppi1
Mauppi1
7 months ago

Rise and Shine, Mr Freeman, rise and shine.