example program

solar_system.grapheme

/eight planets, Newtonian gravity

running live in your browser via WebAssembly + WebGPU. requires Chrome 113+ or Edge 113+.

what it does

A miniature solar system. The Sun sits at the center, and eight planets orbit at distances chosen so each obeys Kepler's third law: orbital period squared is proportional to semi-major axis cubed.

Each planet is shaded by view-aware Lambertian lighting, bright on the side facing the camera, dark on the far side. Per-fragment depth is correct: Mercury occludes behind the Sun. Saturn's rings are computed per-fragment by ray-casting onto the orbital plane.

code
// loading...