Technical notes for Disco Ball. The project page shows the finished piece; this one is about how it works.
The light spots a disco ball throws on a wall are caustics: light reflected by thousands of small flat mirrors. Lumen can't compute them, and neither can the path tracer in a usable time. So each mirror's reflection is computed offline in Houdini, baked into textures, and projected in Unreal by a point light's light function. This note covers the spot model, three ways to bake it and how they compare, the coordinate conventions, and the toy plane that flies through the same attic.
What decides each spot
Every spot comes from one mirror tile, and all four of its properties are computed from the geometry and the light. None is placed by hand.
| Property | Comes from |
|---|---|
| Position | The light's direction reflected by the tile normal. The light sits on the spin axis, so when the ball turns, the whole pattern turns rigidly with it. |
| Size | A flat mirror reflecting a point light makes a diverging beam. Near the wall the spot is about the size of the tile; further away it grows with distance. |
| Edge | The bulb's radius blurs the edge over an angle θ = bulb radius / distance to the tile: a sharp square near the wall, a soft round blob far away. |
| Brightness | Light flux over solid angle, so tiles hit at a grazing angle are dimmer. One normalisation is shared by all bakes. |
The tiles are found automatically. Each sequin on the model is actually a thin box with six faces; only faces with the reflective material whose normal points outward (dot with the radial direction above 0.9) count. That gives 5,467 mirrors.
A light function only knows direction, but spot size and brightness depend on how far away the wall is. So the bake is made at three reference distances, 40, 120 and 360 cm, and the material blends between them by the distance to the light on a log scale. The three colour groups of tiles go into the R, G and B channels, one coloured point light each.

Three edge models
A real spot is the tile's square convolved with the bulb's disc. Three ways to draw that edge, each checked against a photon-splatting reference:
| Edge model | How | Correlation with reference |
|---|---|---|
| 0: SDF smoothstep | Rounded-rectangle distance, smoothstep over the blur angle | ~0.97 |
| 1: disc-cut edge | Same distance, edge replaced by the area of a disc cut by a line | ~0.975 |
| 2: exact convolution | Overlap area of disc and square per pixel: 12-point Gauss–Legendre one way, analytic chord overlap the other | 0.992–0.994 |
The exact convolution matches best at almost no extra cost, so it is the production edge: 0.982 even with size jitter on, against 0.953–0.960 for the simpler model.
Three ways to bake
The same spot model was written three ways:
- Python + numpy (hython): loops over mirrors and only touches the pixels inside each spot's window. It writes RGBE
.hdrfiles with its own writer. This is the production bake. - Copernicus Wrangle + pcfind: loops over pixels; each pixel looks up nearby spots stored as points on a unit sphere. Updates live in the viewer while tuning.
- Projected rasterisation (Copernicus): each spot becomes a quad on a cube-map atlas, rasterised as a hard square and blurred once to stand in for the bulb, then resampled to lat-long.
| Method (edge 2) | Correlation | Energy | IoU | Time per layer |
|---|---|---|---|---|
| Python + numpy | reference | 1.00 | 1.00 | ~2.5–3 s (CPU) |
| Wrangle + pcfind | 1.000 | 1.000 | 1.00 | ~2.6 s |
| Projected raster | 0.985 / 0.968 / 0.955 | 1.00 | 0.89 / 0.83 / 0.81 | ~6 s |
Raster values are at 40 / 120 / 360 cm; timings are at 120 cm on an RTX 5090. The Wrangle matches Python to within one RGBE quantisation step (maximum difference 0.0039).
The raster method is the slowest despite running on the GPU: overlapping spots have to be split into up to six layers and summed, and each extra pass on the 6144 × 3072 atlas costs about 0.6 s. The Wrangle runs in VEX on the CPU and updates live while tuning.



Conventions that must be exact
Four conventions keep every spot on the right axis:
| Step | Convention |
|---|---|
| Houdini → Unreal mesh | (x, y, z) → (x, z, y), 1 unit = 1 cm |
| Lat-long → cube map | u = 0.5 + atan2(V.x, −V.y) / 2π, v = acos(V.z) / π |
| Light vector in a light function | Arrives as the light's local .zyx, so the material starts with return LV.zyx; |
| FBX UVs on import | V is flipped to 1 − V, so Houdini stores 1 − v |
A test bake with markers of three sizes at +X, +Y and +Z confirms the orientation and the handedness in one look.

M_DiscoCaustics_LF: LV.zyx into the three bakes, blended by distance, then one colour channel per lightUnreal settings
- Spots stay sharp with
r.Deferred.UsesLightFunctionAtlas=0and an atlas slot of 512; Unreal 5.8's default 128 × 128 slot draws them as blocky squares. - The material is marked Compatible With Light Function Atlas, so volumetric fog and Lumen use it too and the light shafts carry the spots.
- The glints on the ball itself use the same reflection data. Each tile's reflected direction is packed into UV channels (the FBX importer used here drops vertex colour), and a tile lights up only when the camera stands inside its spot, so glints and wall spots always agree.

The toy plane
The same attic has a paper plane you can fly. It runs on one integer state; clicks only advance it:
| State | Camera | Propeller | Plane |
|---|---|---|---|
| 0 Idle | Room | Stopped | Parked |
| 1 Ready | Behind the plane | Stopped | Parked |
| 2 Warm-up | Behind the plane | Slow, lights on | Parked |
| 3 Flying | Behind the plane | Full speed | WASD + mouse |
| 4 Return | Room | Back to slow | Teleported home |
- Clicks set a target speed; Tick eases the real speed toward it with FInterp To Constant, so the propeller spins up and down instead of jumping.
- The propeller spins around an empty scene component at its hub, with the mesh offset by the opposite amount on all three axes, so the blades turn true.
- Up and down follow the mouse height, so the WASD hand doesn't need extra keys: offset = (half height − mouse y) / half height × sensitivity, clamped to ±1, with a 0.12 dead zone.
- Forward motion uses the plane's direction with Z removed, so a slightly nose-up rest pose doesn't make it climb forever. Banking and pitching rotate a separate pivot, and the camera follows the pitch at 0.3×.
- Space returns everything: camera, transform, bank, pitch and speeds are all reset, so every flight starts level.

What I'd keep
- When the engine can't compute an effect, compute it offline and project it, but derive everything from geometry so it stays correct when the model changes.
- Write the same algorithm twice and compare pixel by pixel. It catches bugs and tells you which version to trust.
- Time things and watch the GPU. The approach that sounds fastest may not be.