2D Lightning, Electric Arc, plasma

Simple configurable lightning, electric arc, plasma shader. 

  • Add a gradient to define the color of the arc.
  • Add a noise texture.
  • Adjust the remaining parameters to get the effect you’re looking for.
Shader code
shader_type canvas_item;

uniform sampler2D color_gradient;
uniform sampler2D noiseTexture;
uniform float speed: hint_range (0.0,5.0);
uniform float variation: hint_range (0.0,1.0);
uniform float width: hint_range (0.0,1.0);

void fragment(){
	vec2 noise_uv = vec2(UV.x+TIME*speed, UV.y-TIME*speed);
	float noise_sample = texture(noiseTexture, noise_uv).r;
	float x_offset = noise_sample*variation - variation/2.0;
	COLOR = texture(color_gradient, vec2((UV.x-0.5)/width + 0.5 + x_offset/width, UV.y));
2d, beam, Electric, electricity, lightning, plasma, voltage, zap
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.

Related shaders

Electric arc effect

2D lightning

Radial plasma shield segment


Inline Feedbacks
View all comments