Medium NatureAnimated
Heavy rain
Thin streaks of rain falling at different speeds in 60 columns.
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 525 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
- Column
id = floor(uv.x * 60.0), x = frac(uv.x * 60.0)- Per-column randoms
h = hash(float2(id, 1.0)), h2 = hash(float2(id, 2.0))- Line
step(abs(x - 0.5), 0.08)- Fall
y = frac(uv.y * 2.0 + time * (1.0 + h) + h * 7.0)- Streak
smoothstep(0.6, 1.0, y) * step(0.4, h2)- Background
lerp(float3(0.05,0.07,0.12), float3(0.15,0.2,0.3), uv.y)- Rain
float3(0.6, 0.7, 0.9) added on top
Helper functions provided
The toolbox has: hash(). 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