How a single fragment shader turns a slab of black velvet into a slowly-rotating, dispersion-throwing gem — and the art direction that frames it.
The brief was "Light, set in stone." — a haute-jewelry house on the coast of Virginia. Jewelry photography lives or dies on one thing: how a stone eats light and gives it back as fire. So instead of photographing a diamond, we simulated one: a refractive gem rendered per-pixel, turning forever against near-black velvet.
Everything else defers to that. The palette is 60% near-black (#060607), 30% warm ivory ink, and a 10% split of champagne (#CFC7B4) and Chesapeake blue (#8FB6C9) — the two accent colours the shader also refracts. Cormorant Garamond carries the display voice (thin, optical, editorial); Archivo handles the quiet labels and body.
The hero is one full-screen triangle and one fragment shader — no gem geometry, no model file. The gem is defined mathematically as a signed distance field (SDF) and drawn by raymarching: for each pixel we shoot a ray and step it forward until it lands on the surface.
A brilliant-cut diamond is close to an octahedron with a flattened top (the table) and a deep point (the pavilion). We start from an octahedron SDF and squash the vertical axis asymmetrically — sharp crown, deep pavilion — then slice a flat table with a plane and bevel the girdle:
float gemSDF(vec3 p){
vec3 q = p;
q.y *= (q.y > 0.0) ? 1.35 : 0.72; // sharp crown, deep pavilion
float o = sdOcta(q, 1.0);
float table = p.y - 0.34; // flatten the top
return max(o, table);
}
At the hit point we compute the surface normal from the SDF gradient, then refract() the ray into the gem. A second short march finds where it exits, we refract again on the way out, and sample a tiny procedural environment (black velvet plus a handful of razor-sharp studio glints). When a ray can't escape the dense medium, refract() returns zero-length and we fall back to reflect() — that's real total internal reflection, the thing that makes a diamond sparkle rather than glow.
White light splits because a gem's refractive index depends on wavelength. We fake it cheaply and convincingly by tracing three rays — one each for the R, G, and B channels — at slightly different IOR values, then recombining them. The tiny separation smears the spectrum across every facet edge, so the gem throws prismatic colour exactly where a real one does.
Why three rays, not thirty? A full spectral render would sample dozens of wavelengths. At 60fps on a laptop that's not free. Three well-placed channel offsets buy 90% of the perceived fire for a fraction of the cost — a classic real-time-graphics trade.
The whole world (not the gem) rotates on u_time, with a soft mouse tilt layered in via u_mouse. A faint caustic wash drifts on the velvet beneath the stone. Finally a filmic tone-map, a warm/cool grade, a vignette, and a pinch of grain keep it from ever looking clinical.
OrthographicCamera, and a ShaderMaterial. All the artistry lives in GLSL.IntersectionObserver that drives the staggered section reveals so nothing ever strands. Expressive easing — a custom cubic-bezier(.19,1,.22,1) throughout — over default linear.document.hidden, clamp DPR to 2, and render a single static frame for prefers-reduced-motion.