Medium NatureAnimated
Lightning storm
A dark sky where a jagged bolt flashes 4 times per second.
How this challenge works
You write a fragment shader that draws the picture above, live in your browser. A match bar shows how close you are, and the score combines accuracy, code size (the par is 803 characters in Unity (Built-in)) and GPU speed. Work in HLSL, GLSL, WGSL, Metal or Godot and export the result when you are done.
The numbers you need
- Seed
floor(time * 4.0)- Flash
step(0.4, hash(float2(seed, 3.0)))- Bolt path
bend = (vnoise(float2(uv.y * 8.0, seed)) - 0.5) * 0.5; d = abs(x - bend) (x = (uv.x - 0.5) * aspect)- Sky
lerp(float3(0.02,0.02,0.06), float3(0.12,0.12,0.25), uv.y)- Result
sky + flash * float3(0.05,0.05,0.1) + flash * float3(0.7,0.8,1.0) * 0.006 / (d + 0.004)
Helper functions provided
The toolbox has: hash(), vnoise(). Add them above your frag function with one click.
Solve it in your language
Unity (Built-in), Unity (URP), Unreal, Shadertoy / WebGL, OpenGL (LWJGL, raylib), three.js, GameMaker, LÖVE (Lua), Godot, Apple (iOS, macOS), WebGPU / Bevy.
Start coding