Technical notes for Hello World. The project page shows the finished piece; this one is about how it works.
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
| Piece | Job |
|---|---|
| Texture 2D Array | The whole sequence as one asset, one frame per slice |
M_Gobo (light function) | Picks the slice for the current frame |
MI_Gobo | Frame rate, frame count, size, offset, rotation and softness, all live |
MPC_Gobo | A 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.

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:
| Setting | Value | Why |
|---|---|---|
| Compression | Alpha, BC4, from source R | One channel; the smallest format |
| sRGB | Off | A gobo is a mask, not a colour |
| Mips | From texture group | Softness needs the full mip chain |
| Tiling | Clamp | Repeats are done with Frac in the material; clamp stops edges bleeding |
Frame number
frame = fmod( floor( (UseSequencer ? GoboFrame : Time * FPS) + 0.01 ), FrameCount )
UseSequenceris a static switch. Off, the gobo runs on engine time, which is handy in the viewport. On, it readsGoboFramefrom the parameter collection, keyed in Sequencer.- The
+ 0.01is there because an interpolated 56.99999 would floor to 56 and skip a frame. - For a loop, key 0 at frame 0 and 180 at frame 180 with linear interpolation; the default auto tangents slow the start and end. Moving the second key to frame 360 plays at half speed.

M_Gobo: the UV chain (offset, rotator) and the frame index (switch, +0.01, floor, fmod) meet at the array sampleUVs, 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.
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
- Dividing by 1.5 keeps the result in −1…1, so the amplitude parameter means what it says.
- Each prop gets a random phase (0–2π) and a speed multiplier (0.7–1.3) at Begin Play, so no two move together.
- Each axis has its own base frequency: 1.0 for bob, 0.8 pitch, 0.9 roll and 0.3 yaw. The slow yaw is what makes it feel like water.
- Every frame the offset is added to the initial transform, not the previous frame, so nothing drifts away over time. Rotation uses Combine Rotators, so a prop placed at an angle tilts around its own axes.

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
- Build the tool once and make new looks by swapping data, not editing the shader.
- Anything that must match between renders should take its time from Sequencer.
- Irrational frequency ratios and per-object phases are a cheap way to hide repetition.