Hard WaterAnimated
Raymarched ocean waves
A rolling sea seen from above the surface, with a sky-colored horizon.
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 1100 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
- Height
h(x, z) = 0.18 * sin(x * 1.3 + time) + 0.12 * sin(z * 1.7 - time * 1.2) + 0.08 * sin((x + z) * 2.9 + time * 1.7)- Camera
ro = float3(0.0, 1.0, -4.0), rd = normalize(float3(p.x, p.y - 0.25, 1.5)) (p as in the other 3D challenges)- March
fixed 0.2 steps would be slow: use map(p) = (p.y - h(p.x, p.z)) * 0.6, 100 steps, miss at t > 40- Normal
calcNormal(pos) with that map- Color
deep float3(0.0, 0.25, 0.4) → light float3(0.2, 0.7, 0.8) by 0.5 + 0.5 * n.y... see hint- Sky
lerp(float3(0.8,0.9,1.0), float3(0.3,0.55,0.9), uv.y)
Helper functions provided
The toolbox has: calcNormal(). 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