Design.dev design.dev
Text Effects · Component Template

Volumetric Light

The headline is cut out of a dark wall and sunlight pours through every letter, fanning into dusty air and landing on the floor. Move the pointer to carry the sun.

Live demo

Output of this prompt · Claude Fable 5.2 · WebGL

Move the pointer to swing the sun, then change the time of day or the louvers.

The Prompt 1,020 words

Build a hero where the headline is cut out of a dark wall and sunlight pours through it. The letters are openings crossed by fine louvers; the sun sits somewhere behind the wall; shafts of light fan out from every letter into dusty air, and the same light lands on a polished floor as stretched, upside-down letters. Moving the pointer carries the sun, so every shaft swings with it. On load the louvers swing open and the room fills with light. The studio is fictional: Oriel, an architecture practice that plans rooms around daylight, and the headline is "Daylight is a material." It should look like a photograph of a real room at a real hour, rendered live, with real selectable text underneath.

Match my project's existing stack, conventions, and design tokens. If there are none, output a single HTML file with inline CSS and JavaScript and zero dependencies.

LOOK
One full-viewport scene on #040509. The h1 is real text set very large (clamp(54px, min(13.2vw, 24vh), 232px), weight 800, line-height 0.86, letter-spacing -0.055em, at most 12ch wide; 17.5vw on phones) with a transparent fill: what you see is drawn by the shader in exactly the same place. A slim header (wordmark, three links, an outlined pill button), one sentence of copy with two pill buttons under the headline, and a glass control bar at the bottom: a three-way segmented control (Morning, Noon, Evening), a "Louvers" range slider from 8 to 100, and a small readout such as "Sun 31° above the horizon". Body text is white at 85% with a soft dark text-shadow so it survives the glare.

TYPE INTO THE SHADER
Ask the browser where each glyph landed: walk the h1's text nodes, make a Range around every character and take getBoundingClientRect. Redraw each character at that position on an offscreen 2D canvas (white on black, same font, device-pixel scale up to 2) and upload it as a texture. Redo this on resize. The shader samples it flipped vertically.

THE SCENE (raw WebGL, two passes)
Shared functions, in 0..1 screen coordinates with y up:
- glyph(p): the text texture, or 0 below the floor line.
- slat(p): louvers as horizontal bars, about nine to the height of a letter. Bar half-width T = 0.5 x (1 - open x 0.92); transmission = mix(0.14 x open, 1, smoothstep(T - 0.09, T + 0.09, |fract(p.y x count) - 0.5|)), so tilted louvers are never fully opaque.
- sky(p): with r the aspect-corrected distance to the sun, a disc (smoothstep(0.06, 0.048, r) x 2.6) + a tight halo (exp(-6r) x 0.9) + a wide one (exp(-1.8r) x 0.34) + 0.2 of plain sky.
Pass 1, into a texture a third of the canvas size: sky x glyph x slat x brightness x 0.25. Only light that gets through; everything solid is black.
Pass 2, the picture:
- Wall (above the floor line at 24% of the height, 20% on phones): where there is no letter, nearly black shade tinted by the air color with 2x2-pixel noise; inside a letter, (sun color x sky + air color x 0.2) x slat.
- Floor: with t running 0 at the wall to 1 at the bottom edge, depth Z = t / (1 - 0.55t) x 0.6. Follow the sunlight back from that spot to the wall: w = (0.5 + (x - 0.5)(1 - 0.28t) + (sun.x - 0.5) x Z x 1.1, floorLine + (sun.y - 0.1) x Z x 2.7). If glyph(w) x slat(w) is lit, the floor is lit (sun color x (0.85 - 0.35t)). Add 11% of the wall mirrored about the floor line, fading with t, for the polish.
- Shafts: from each pixel take 90 steps toward the sun's screen position, summing pass 1 with a weight that decays by 0.978 per step, starting at a per-pixel random offset of up to one step to hide banding. Add sun color x sum x 0.12.
- Dust: two layers of sparse drifting specks (one per grid cell, half the cells empty, each twinkling) that multiply the shaft light by up to 4, so they only show inside a beam.
- Finish: vignette, then color = 1 - exp(-1.6 x color), then 2.8% film grain.

MOODS AND MOTION
Three times of day, blended over about half a second: Morning, sun at (0.27, 0.6), light (1, 0.74, 0.52), shade (0.5, 0.58, 0.95); Noon, (0.44, 0.9), (1, 0.96, 0.88), (0.7, 0.82, 1); Evening, (0.7, 0.52), (1, 0.5, 0.24), (0.62, 0.4, 0.72). Load: brightness runs 0 to 1 over 2.2s while the louvers ease from shut to 80% open and the sun climbs 0.2 into place; header, copy and controls rise in afterwards. Idle: the sun drifts a few percent around its home on two slow sines. Pointer: the sun follows it at about 6 per second; 2.6s after the pointer stops it eases home at 1.4 per second. The slider sets the louvers live.

PERFORMANCE
Cap device pixel ratio at 1.5. If frames take longer than 26ms for 24 frames in a row, drop the canvas scale by an eighth, down to half. Pause when the tab is hidden.

ACCESSIBILITY
The canvas is aria-hidden; the h1 stays real, selectable text. The controls are a real radio group and a labeled range input with aria-valuetext ("80 percent open"). With prefers-reduced-motion draw one still frame, fully lit, and redraw only when a control changes. Without WebGL, give the h1 a dark fill over a warm radial gradient.

NEVER
- Never fake the shafts with CSS gradients or a blurred copy of the text; they must come from marching through the occlusion pass, or they will not move correctly with the sun.
- Never put the sun in front of the wall; it is only ever seen through a letter.
- Never use fewer than about 60 steps without the random start offset; the banding is obvious.
- Never let the light patches on the floor ignore the louvers or the sun's position.
- Never replace the h1 with an image or canvas text.
- No libraries, no images, no fonts from a network.
  1. CopyThe full prompt, one click.
  2. PasteInto Cursor, Claude Code, or any agent.
  3. CompareAgainst the live demo above.
Volumetric Light
Copied to clipboard