Procedural Electric Background Shader

A procedural electric background shader.

Shader code
/*
	動的電子背景シェーダー by あるる(きのもと 結衣) @arlez80
	Procedural Electric Background Shader by Yui Kinomoto @arlez80

	MIT License
*/
shader_type canvas_item;

uniform vec4 background_color : hint_color = vec4( 0.0, 0.0, 0.0, 1.0 );
uniform vec4 line_color : hint_color = vec4( 0.0, 1.0, 1.0, 1.0 );
uniform float line_freq = 9.56;
uniform float height = 0.6;
uniform float speed = 0.8;
uniform vec2 scale = vec2( 2.0, 16.0 );

void fragment( )
{
	vec2 uv = UV * scale;
	float shift = cos( floor( uv.y ) );
	uv.x += shift;

	float freq = clamp( cos( uv.x * line_freq ) * 3.0, 0.0, 1.0 ) * height;
	float line = 1.0 - clamp( abs( freq - mod( uv.y, 1.0 ) ) * 11.0, 0.0, 1.0 );

	COLOR = mix( background_color, line_color, line * mod( uv.x - TIME * speed * abs( shift ), 1.0 ) /*  * mod( TIME + shift, 1.0 ) */ );
}
Tags
background, Electric, Procedural
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 arlez80

Procedural Brick Shader

CRT shader

Pixelized (by distance) Shader

Related shaders

Electric Hatch Background Shader

Procedural Electric Current Shader

Voronoi Synapse-ish Background Shader

guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Loneliiii
Loneliiii
4 months ago

Wow your Background shader are awesome 😀
I really like this one and the electric Hatch ^^

Coinspinner
Coinspinner
2 months ago

I like it, I like it a lot ^^

lyghtkruz
lyghtkruz
1 month ago

For Godot 4, change hint_color to source_color and it works.

maulinux
maulinux
1 month ago

love it