Three kinds of light
This session started with a question: does RACTR have ray-traced lighting? The answer turned out to be the best kind of surprising — this engine has been a ray tracer since the day it was born, because every pixel is already a ray marched through the density field. What it was missing wasn't ray tracing. It was three specific kinds of rays. By the end of the night the moon cast shadows, dawn light broke into beams between the trees, and campfires burned in the wilderness — the first light sources in this world that aren't in the sky.
The question, answered honestly
Hardware ray tracing — the RTX kind — is a machine for firing rays at triangles. It builds a tree of bounding boxes around a mesh and lets silicon walk it fast. RACTR has no triangles. The whole world is one continuous field, and the renderer finds surfaces by walking rays through that field directly — which is ray tracing, done in software, against real physics instead of a bag of polygons. Bolting a triangle accelerator onto an engine with no triangles would accelerate nothing. And it wouldn't run anyway: the graphics layer RACTR ships on exposes hardware ray queries on exactly none of our targets — not on the Mac's Metal backend, not in any browser. So the answer to "should we add ray tracing" was: we already did, the day the engine was born. The real question was which rays are missing. Three were.
First light: the moon learns to cast shadows
An audit of the lighting pipeline turned up something embarrassing for a game whose nights matter this much: moonlight ignored the world. Sunlight has always paid for a real shadow ray — a march from every surface point toward the sun, through the same field the geometry renders from. Moonlight was just a dot product. A moonlit forest at midnight had zero shadows: every clearing, every tree, lit by the moon as if the trees weren't there.
The fix is almost free by construction. At night the sun is below the horizon, so the sun's shadow march never runs — the frame's shadow budget was sitting idle exactly when the moon needed it. The same march now simply aims at whichever light owns the sky: sun by day, moon by night. One shadow ray per pixel, never two. The bench actually came back faster than before, because the same pass upgraded the penumbra estimator — the math that makes shadows sharpen at contact and soften with distance — and the better estimate lets shadow rays quit earlier. The first cut of that estimator painted the entire noon foreground black (the triangulation is only valid while the ray is approaching an occluder; let it run while escaping one and it hallucinates total darkness) — caught the same hour by the standing rule that every shader change gets before-and-after screenshots at three times of day.
Second light: the beams
Sunbeams through trees — god rays, the film-school word is crepuscular rays — were never going to come from the fog system. The atmosphere in this engine already scatters sunlight along every camera ray; that's why distant hills go blue and dawn goes gold. But it scatters as if the sun reaches every parcel of air unobstructed. Under a forest canopy that's exactly wrong: the air in a crown's shadow should lose its golden glow, and the bright shafts you see in a real forest are just the gaps.
So the new pass doesn't add light at all. It walks the first hundred metres of air in front of the camera, asks "does the sun actually reach this air?", and removes the glow the atmosphere overcounted where the answer is no. Beams emerge as the untouched bright gaps between dimmed wedges. Open ground is mathematically unchanged — no double halo, nothing to wash out. Two failures made it shippable. The first cut answered the "does the sun reach this air" question by marching the full tree field 48 times per pixel: gorgeous, and 16 milliseconds — most of a frame budget — gone. The rescue was remembering the forest is procedural: every tree is generated from its grid cell's hash, so instead of marching at crowns you can ask the hash directly — find where the sun ray crosses crown height, reconstruct that cell's tree from three hash calls, test a disc. Same beams, one-thirtieth of a millisecond shy of free. The second failure: the first magnitude subtracted more light than the air ever carried and carved razor-edged black wedges across the sky. Shadowed air still glows — the whole sky lights it, only the sun's direct share is removable. Cap the removal at that share and the wedges soften into weather.
Third light: fire
Here is a fact about RACTR that was true yesterday and is false today: the sun and the moon were the only lights in the entire world. Every camp, every city window, every night encounter — lit exclusively from the sky. No torch, no lantern, no campfire has ever cast light on anything.
The camps got their fires tonight. Each of the world's camps now carries a fire pit at its centre stone; walk within streaming range at night and there's a warm pool of light over the grass, flickering (the flicker is computed on the CPU, two sine waves per fire — the GPU just reads a colour), with the camp's inhabitants silhouetted around it. The engine's light rig carries up to eight nearby fires at once, and an empty slate costs the renderer a single comparison per pixel — the bench read the change as noise.
The honest failure, because there's always one: the first build's firelight was invisible, and every plausible suspect — the new GPU plumbing, the coordinate space, the streaming — was innocent. Two debug lines settled it in one screenshot: tint everything green if the shader can see any light, paint a red disc at the fire's position. Green everywhere, red disc exactly at the pit. The data was perfect; the photometry was wrong. A light sitting at ground level grazes flat ground — the surface barely faces it, so the physics correctly delivered almost nothing. Real campfires light the ground because flames stand half a metre tall. Lift the light to flame height, let it wrap the way scattered firelight does, push its intensity to the same order as sunlight, and the pool appears.
Engine v0.22.79 → v0.22.81, live now in the browser at ractr.com/play — the moon shadows, penumbras, and god rays run identically there; the fires arrive in the browser when camps do. Suite green throughout: 76 tests, 4 physics gates, and the frame budget ends the night roughly where it started — three lighting features for a net couple tenths of a millisecond. The lesson of the stretch: in a field engine, "add ray tracing" means "decide which rays you owe the world" — and the cheapest ray is the one whose budget the frame was already paying.