Baltor Get started

Gallery / Godot shaders

Procedural lightning bolt with branches

In your harnessGodot shaderMIT

Draw a lightning strike: a jagged main bolt from top to bottom built from layered noise displacement, a branch splitting off, a wide glow, and a new random shape at every strike with flicker between strikes.

Render of Procedural lightning bolt with branches
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
canvas_item
Parameters
core_color (vec4 = 1, 1, 1, 1), glow_color (vec4 = 0.55, 0.6, 1, 1), jaggedness (float = 0.18), core_width (float = 0.006), glow_width (float = 0.08), strike_rate (float = 1.5), visible_share (float = 0.6), branch_amount (float = 0.6) and 2 more
Use it on
A ColorRect (or any CanvasItem) sized to the area to fill; UVs span 0 to 1 across it.
Result
A white jagged bolt with a blue glow running down the dark rectangle, with one side branch.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/lightning_bolt_2d/

Limits. Distance is measured horizontally, so near-horizontal bolts thin out; keep bolts mostly vertical or rotate the rectangle. One branch per strike.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 59.8 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
Checks
contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
Techniques
Fractal (octave) noise displacement of a line, Distance-based core and glow, Re-seeding per strike, Value noise with quintic interpolation and fractional Brownian motion
Tags
godot shader, canvas item, lightning, bolt, electricity, vfx, procedural
Identity
library.supply.creative_originals.ac2d8a506863970e8d1c9e29.befdb78ca2f4417d
Version
befdb78ca2f4417d990835d3f69a85a607e22584c77b2e58287c274f8bc69c1c

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.