Cast One Ray, Light One Room: The Game Trick Hiding Inside Daylight Analysis
Cast one ray and you get both sightlines and daylighting. Build a playable p5.js isovist toy, break it, then validate in Ladybug and Radiance.
Here is the toy: a single dot in a dark room. Drag it. From the dot, fan out a few hundred rays in every direction; each ray walks forward until it hits a wall, then stops and drops a bright point where it landed. The lit polygon that blooms around your cursor is the room as the dot sees it. Move into a doorway and the polygon stretches down the corridor. Tuck behind a column and it collapses. You are not reading about visibility — you are dragging it around.
That bloom has a name architects have used since 1979: the isovist, Michael Benedikt’s polygon of everything visible from a point. The engine drawing it is the oldest trick in real-time graphics — grid raycasting, the same primitive id Software used to make Wolfenstein 3D run on a 1992 PC. Lode Vandevenne’s canonical raycasting tutorial still teaches the exact DDA wall-march our sketch uses. One ray, two crafts: the demoscene casts it for speed, the architect casts it for light.
←TODAY: A few dozen lines of p5.js reproduce the core intuition of a thousand-franc daylight plugin. →3012: Every Zurich-3012 room model carries its own live isovist, requeried the moment a wall moves. Fulcrum: The ray is the unit that makes “what can I see” and “where does light land” the same question.
The rules are deliberately tiny. Play them, then break them:
- One source point. Rays leave it at fixed angular steps.
- Each ray marches cell by cell across a 2D grid until it meets a filled “brick”.
- The first hit ends the ray. Everything past the wall is dark.
- The lit area is the isovist; its size is a crude sightline (or daylight) score.
Now break it: drop the ray count to 12 and watch the room shatter into ragged spokes — that gap between rays is the aliasing every real daylight grid fights. Then delete one brick and notice the lit area jump: you just felt how a single window placement swings a metric. The misuse is the lesson; a sim you cannot cheat is just a slideshow with a score.
Atelier: Swap “sightline” for “sun” and the same dot becomes a daylighting probe. Cast rays from a south window inward and the lit polygon is your daylit zone; cast them from a seat outward and it is the view-out that EN 17037 — adopted in Switzerland as SN EN 17037 — actually grades. In a PAZ Atelier massing review we keep this toy open beside Grasshopper: drag it to decide where a window wants to be, then hand the real geometry to Ladybug Tools’ Honeybee, which calls Greg Ward’s Radiance for the annual, bounce-accurate ray trace that SIA 387/4 sign-off needs. The toy builds the intuition; it is not the compliance tool — it is 2D, with no sun altitude, no inter-reflection, no annual sky.
Hack: This Hack teaches you to cast one ray and find its first wall hit — the atom under every isovist. The medium is geometry: step a point along a direction until a grid cell is solid.
function castRay(px, py, angle, grid, cell) {
const dx = Math.cos(angle), dy = Math.sin(angle);
for (let t = 0; t < 2000; t += 2) {
const gx = (px + dx*t)/cell | 0, gy = (py + dy*t)/cell | 0;
if (grid[gy]?.[gx]) return [px+dx*t, py+dy*t]; // first brick = stop
}
return [px+dx*2000, py+dy*2000];
}Wrap that in a loop over 360 angles, draw a polygon through the returned points, and you have rebuilt Benedikt’s isovist from scratch.
Run the sketch, raise the ray count until the spokes smooth out, then read Vandevenne’s tutorial and rebuild it in your own grid. Tomorrow, open Honeybee on a real plan and watch the same ray come back — slower, three-dimensional, and finally allowed to bounce.
PAZ Kaffi · multidisciplinary editorial, led by PAZ Academy