Radiosity
Global illumination for a Cornell box, written from scratch in Java.
Fig. 1 — Final render8 passes
pass 0.0 / 8only the light emits; every other dot is dark
ROLECo-author, with Kon Aoki
YEAR2019
STACKJava · AWT · Swing
GATHERING, PER DOT
Li = Σj visible Φj / rij² · cj
ci = mi · Li
Φflux of a source dot, from its last pass
rlength of the ray between the two dots
ccolor the dot renders and re-emits
mmaterial color of the face: white, red or green
- 01DotsEvery face of the box is split into dots, the smallest unit of light. At the start only the area light on the ceiling holds any energy.
- 02RaysFor each dot, a ray is traced from every dot on the other faces. If the ray hits another face before it arrives, that source is dropped.
- 03GatherEach visible source adds its flux divided by the distance squared, tinted by its color. The sum is multiplied by the dot’s own material color.
- 04Re-emitThe dot becomes a light carrying that color and flux, so walls start lighting each other. The scene is gathered again for 8 passes, then a camera ray-casts the dots to the screen.