Speed Effect

This is a really appealing game *speed* shader. To use this, You have to set the noise texture: Create a new NoiseTexture2D and use FastNoiseLite.

I recommend a high noise frequency in the fastnoiselite settings, But setting it too high may cause the Moire effect.

To animate the speed lines, Adjust the sample radius using a tween.

You can adjust hole smoothness and hole radius to make the lines not appear in the middle. You can also adjust transparency to make the entire effect less noticable.

Shader code
shader_type canvas_item;

uniform vec2 center = vec2(0.5, 0.5);
uniform sampler2D noise;
uniform float sample_radius: hint_range(0.0, 1.0) = 0.5;
uniform vec4 line_color: source_color = vec4(1.0);
uniform float center_radius: hint_range(0.0, 1.0) = 0.5;
uniform float hole_smoothness: hint_range(0.0, 1.0) = 0.4;
uniform float hole_radius: hint_range(0.0, 1.0) = 0.34;
uniform float transparency: hint_range(0.0, 1.0) = 1.0;

void fragment() {
	vec2 distance_vector = UV - center;
	float distance_float = length(distance_vector);

	float angle = atan(distance_vector.y / distance_vector.x);
	vec2 sample = vec2(sample_radius * cos(angle), sample_radius * sin(angle));
	float noise_value = texture(noise, sample).r;
	vec4 color = mix(line_color, vec4(0.0), noise_value);

	// Apply the hole
    float alpha = smoothstep(hole_radius, hole_radius + hole_smoothness, distance_float);
    color.a *= alpha;
	color.a *= transparency;

	color = mix(color, vec4(0.0), 1.0 - distance_float - center_radius);
	COLOR = color;
}
Tags
speed lines effect
The shader code and all code snippets in this post are under GNU GPL v.3 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.

Related shaders

Hyper space speed effect

Speed Lines Shader for Godot 4

2D Wavy Effect

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments