Hard RaymarchAnimated
Soft shadows
A sphere floating over a floor, casting a soft shadow that moves with the light.
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 1254 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
- Scene
sphere: length(p - float3(0.0, 0.0, 0.0)) - 0.7; floor: p.y + 1.0; map = min- Camera
ro = float3(0.0, 1.0, -4.0), rd = normalize(float3(p.x, p.y - 0.2, 1.6)) (p as before)- March
100 steps, miss at t > 40- Light
L = normalize(float3(sin(time) * 0.8, 0.9, -0.6))- Soft shadow
from the hit point + normal * 0.01, march toward L for 40 steps; track res = min(res, 8.0 * d / t); t += clamp(d, 0.02, 0.5); stop on d < 0.001 → 0 or t > 6- Colors
floor float3(0.8, 0.8, 0.85), sphere float3(0.9, 0.4, 0.3), sky float3(0.6, 0.75, 0.95)- Result
base * (0.2 + 0.8 * diffuse * shadow)
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