← Technical Notes F26

A reusable animated gobo light tool for moving shadows and water caustics

Technical notes · Hello World · VFX 380, Fall 2026

I built a reusable animated gobo tool for Unreal: a light function that plays any image sequence, like a film loop in front of a stage light. Swap the sequence and the same tool makes moving leaf shadows (the Luxe setup) or underwater caustics (my artist's choice), with no shader changes. A second small tool makes props float. This note is how both are built, and how to make them render the same way twice.

The setup

PieceJob
Texture 2D ArrayThe whole sequence as one asset, one frame per slice
M_Gobo (light function)Picks the slice for the current frame
MI_GoboFrame rate, frame count, size, offset, rotation and softness, all live
MPC_GoboA collection parameter so Sequencer can set the frame exactly

The light is a directional light with a small source angle (0.5–1°), so the props cast sharp shadows. Gobo softness is controlled separately, by the texture and the mip level in the material. Keeping the two apart means sharp contact shadows and a soft gobo can coexist.

Unreal editor with the gobo material instance parameters next to caustics projected onto the floor
Material instance and the projected caustics

Preparing the sequence

The 180 frames are named gobo_000 to gobo_179. Zero padding matters: without it gobo_10 sorts before gobo_2 and the array plays out of order. All frames are set together in the Property Matrix:

SettingValueWhy
CompressionAlpha, BC4, from source ROne channel; the smallest format
sRGBOffA gobo is a mask, not a colour
MipsFrom texture groupSoftness needs the full mip chain
TilingClampRepeats are done with Frac in the material; clamp stops edges bleeding

Frame number

frame = fmod( floor( (UseSequencer ? GoboFrame : Time * FPS) + 0.01 ), FrameCount )
M_Gobo material graph: UVs, offset and rotator on one side, the frame index from the parameter collection or time on the other, into a Texture 2D Array sample
M_Gobo: the UV chain (offset, rotator) and the frame index (switch, +0.01, floor, fmod) meet at the array sample

UVs, softness and a single gobo

uv = TexCoord + (OffsetX, OffsetY)
uv = CustomRotator(uv, Rotation / 360)
uv = (uv - 0.5) / GoboScale + 0.5          // scale about the centre
uv = SingleGobo ? uv : frac(uv)            // one gobo, or tiled

Offset first, rotate second and scale about the centre last, so the pattern rotates and grows around its own middle instead of sliding toward a corner.

Softness comes from an absolute MipLevel on the sampler: 0 is full resolution, each step halves it, and fractions blend, with 0–3 as the useful range. A light function has no reliable screen-space derivatives, so this replaces automatic mip selection, and the explicit level also avoids the seam that frac causes.

For a single gobo, a soft rectangle mask removes everything outside 0–1, where a plain clamp would stretch the edge pixels across the scene:

d    = max(abs(uv.x - 0.5), abs(uv.y - 0.5))
mask = 1 - smoothstep(0.5 - EdgeSoftness, 0.5, d)     // EdgeSoftness 0.001–0.2, never 0

Time or Sequencer

Both modes render correctly in Movie Render Queue. Time mode follows engine time, which suits one continuous render. Sequencer mode reads the keyed GoboFrame, so a re-rendered section lines up with the original frame for frame. A new look needs no shader change: import the frames, build a new array, duplicate the instance, swap the array and set the frame count.

Caustics from the gobo sequence; the props float with the component below.

Floating props

The props in the underwater shot use a reusable Actor Component. One sine wave looks mechanical, so each axis adds a second wave at 1.73× the frequency and half the amplitude. The ratio isn't a whole number, so the two never fall back into step:

wave(t) = ( sin(t·f + phaseA) + 0.5 · sin(1.73 · t·f + phaseB) ) / 1.5
Blueprint: game time times speed feeds four wave calls for bob, pitch, roll and yaw, scaled and combined into location and rotation
Each tick: game time × speed into four waves (bob, pitch, roll, yaw), scaled by their amplitudes and added to the initial transform

For re-renders the component can use a seeded random stream, with the seed made from the prop's starting position (x + 3y + 7z, plus a user seed), so the motion repeats as long as the prop stays where it was placed.

What I'd keep