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

Voronoi Guard Effect Shader

Magical effect Yurayura Shader

Fire Shader

Related shaders

Electric Hatch Background Shader

Procedural Electric Current Shader

electric gird

Subscribe
Notify of
guest

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

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

Coinspinner
2 years ago

I like it, I like it a lot ^^

lyghtkruz
lyghtkruz
2 years ago

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

maulinux
maulinux
2 years ago

love it