Instancing and Procedural Motion · Chapter 4 of 9

Instancing: Motion Without Keyframes

Written for version 2.7.0

Elapsed Time turns a layout into an animation: bobbing, travelling waves, ripples, spins and orbits, with each copy offset by its index or its place, and labelled inputs to tune it.

The last chapters decided where copies stand: in rows, grids and rings, scattered, or on the vertices of a mesh. All of it held still. This chapter makes the copies move, and no keyframe is set anywhere. One node does it: Elapsed Time, a number that keeps growing, fed into the same graph that already places the copies.

The clock

Elapsed Time is in the Input folder of the Add Node card. It has no inputs and one output, Seconds. The Shaders path met it in Time and Motion, and it is the same clock here: every copy is handed the same number, and that number only ever climbs.

WhereWhat Elapsed Time reads
The Rig Editor viewportSeconds since the editor opened. It runs the whole time. There is no play button: copies that use the clock move while you work
A snapshot from the Rig EditorThe clock at the moment you take it
Rendered framesEach frame gets its own time, worked out from its frame number, so the same frame comes out the same every time
  • You rarely know what the clock reads at a given moment, and you should not need to. Build motion that repeats and it looks right whenever it is seen.
  • Delta Time sits beside Elapsed Time. It is the length of one frame. The graph keeps no memory from one frame to the next, so it cannot add those steps up into movement. Nearly everything wants Elapsed Time.
  • The Ray Traced preview builds its picture up over a few seconds, all at one moment of the clock, so copies that move by the clock hold still there.

A bob: Sin of the clock

Wire the clock straight into a position and the copies leave for good, because the number never comes back. Sin, under Math in the Trigonometry subfolder, folds the endless climb into a swing between -1 and 1 that repeats for ever. That swing, in Y of Position, is a bob.

  1. Start from a row: Index from Instance Index, through a Scale And Offset, into X of a Construct Vector3, into Position. The first chapter of this path built it.
  2. Add Elapsed Time from Input and a Multiply. Wire Seconds into A and set B to 3. This is the speed.
  3. Add Sin and wire the Multiply into it.
  4. Add a second Multiply. Wire Sin into A and set B to 0.6. This is the height.
  5. Wire that into Y of the Construct Vector3.
  • Every copy rises and falls together, because every copy is given the same clock.
  • Sin reads its input as an angle in radians. One full swing is about 6.28 of them, so with a speed of 3 a bob takes a little over two seconds.
  • The swing goes below 0 as well as above, so the copies dip under their resting height for half of each bob. To keep them above it, follow Sin with a Scale And Offset set to 0.5 and 0.5, which fits the swing into 0 to 1.

Phase: the one idea in this chapter

A row that bobs as one block looks mechanical. To turn it into a wave, give each copy a clock that is a little ahead of its neighbour's. That takes one Add: the clock, plus a number that differs from copy to copy. The number is called the phase, and almost everything else in this chapter is a choice of what to use for it.

With the clock alone every copy bobs in step. Add Index times a small number to the clock before the Sin and each copy starts a little ahead of the last: the bob becomes a wave that travels along the row.
  1. Put an Add between the speed Multiply and Sin: the Multiply into A, the Add into Sin.
  2. Add a third Multiply. Wire Index from Instance Index into A and set B to 0.7.
  3. Wire it into B of the Add.
  • B of that Multiply is how far apart neighbours are in the swing. Small numbers give a long, lazy wave. Near 3.14 each copy is opposite its neighbour and the row flickers.
  • Adding the phase sends the wave towards the first copy. Use a Subtract in place of the Add and it runs the other way.
  • The phase changes when a copy moves, never how. Height and speed stay the same for all of them.
  • Index is one choice. Column or Row from Grid sends the wave across a grid, a distance makes rings, and a random number makes a twinkle. The recipes below build each.

Height, speed and spread

The wave now has three Multiply nodes, and each sets one thing you can feel.

MultiplyWhere it sitsWhat it feels like
HeightAfter SinHow far the copies travel, also called amplitude. In Position it is a distance, in Rotation (deg) it is degrees, in Scale a factor
SpeedBetween Elapsed Time and the AddHow fast the motion runs. Doubling it halves the time one swing takes. A negative speed runs the motion backwards
SpreadBetween the phase and the AddHow many swings fit along the row. Low is one long swell, high is a tight ripple
Height, Speed and Spread are Float nodes with Labels, wired into the three Multiply nodes. They are listed under Instancer FX Inputs in the detail panel, where each is dragged up or down: taller, faster, tighter.
  1. Add a Float from Parameters. Select it and type Height in its Label field.
  2. Wire it into B of the height Multiply. The wire takes over from the number typed there.
  3. Do the same for Speed and for Spread.
  4. Select the node that carries the Instancer. The three are listed under Instancer FX Inputs, below the Instancer section.
  • Instancer FX Inputs lists every Float in the graph, in the order they sit on the canvas from top to bottom. A Float with no Label is listed as Float, so label the ones you mean to use.
  • Drag up on a number for more and down for less, as everywhere in the editor.
  • Change Speed gently. The clock is already a large number and Speed multiplies all of it, so the wave jumps to another point of its swing while you drag and settles when you let go.
  • Count changes how many copies there are, not how any of them moves.

Loops and easing

Sin is one way to fold the clock into something that repeats. Two more are in Math, and they move differently.

Four rows, each copy a step behind the last in time, so each row draws the shape of its node. Sin swings smoothly. Fract climbs and snaps back. Ping-Pong climbs and falls at one steady rate. Ping-Pong followed by Smoothstep eases both ends.
NodeWhat it givesOne round takes
SinA smooth swing from -1 to 1, slowest at its two endsAbout 6.28 divided by the speed, in seconds
FractA steady climb from 0 to 1, then a snap back to 01 divided by the speed
Ping-PongA steady climb from 0 to Scale and a steady fall backTwice Scale, divided by the speed
  • All three repeat exactly, so the motion loops cleanly however long the clock has been running.
  • Fract suits things that should start again: a conveyor, falling rain, a chase of lights. Use it where the snap is hidden, or where the snap is the point.
  • Ping-Pong turns round with a sharp corner. Follow it with a Smoothstep, Edge 0 at 0 and Edge 1 at 1, and the motion slows into each end and out again.
  • Smoothstep also sharpens. Feed it a Sin and raise Edge 0 towards Edge 1: the result stays at 0 for most of the swing and rises only near the top. The stadium wave below uses this.
  • Remap moves a range without changing its shape. Sin runs from -1 to 1, and a Remap with In Min -1, In Max 1, Out Min 0.8 and Out Max 1.2 turns it into a gentle change of size.

Spinning and orbiting

Rotation (deg) on Instance Transform takes degrees, so the clock times a number of degrees per second is a steady spin. Wire Elapsed Time through a Multiply into Y of a Construct Vector3, and that into Rotation (deg). With B at 90 each copy makes a quarter turn every second, on its own spot.

An orbit carries the copies round a circle. A ring is made by giving each copy an angle and taking the Sin and Cos of it. Add the clock to that angle before the Sin and Cos, and every copy travels round the ring. The lanterns recipe below builds both.

  • A spin never needs folding. A turn of 360 degrees is the same as no turn, so the angle can grow for ever.
  • Give the spin a phase too, such as Value from Instance Random times 360 added to it, and the copies no longer all face the same way at the same moment.
  • The three rotations are combined in the order Y, X, Z. A spin in Y turns a copy about its upright axis, and any tilt in X or Z is carried round with it.

Linking an input to another value

Instancer FX Inputs puts the labelled numbers in the detail panel. A Value Driver goes one step further. It is a constraint that reads one number in the model and writes it into another on every frame. Point its Write at a labelled Float and that input follows whatever the driver reads.

A Value Driver reads the Handle's Position Y. Its Write is chosen in the sheet: Instancers, the Row, then Height under Instancer FX Inputs. From then on, lifting the Handle lifts the wave.
  1. In the Selection Panel, tap + beside Constraints and choose Value Driver.
  2. In the detail panel, tap Read and choose the number to follow. Here it is the Handle node, then Position Y.
  3. Tap Write. Scroll to Instancers, tap the node that carries the Instancer, and choose the input under Instancer FX Inputs.
  4. Leave Mode on Copy. Scale and Offset change the number on its way through: the result is the number read, times Scale, plus Offset.
  • The Instancers section of the sheet lists only nodes whose graph holds at least one Float, so add the Float first.
  • Copy replaces the input with the driven number. Add adds the driven number to the one you set, and Multiply multiplies the one you set by the number read.
  • Clamp holds the result between a Min and a Max, so a handle dragged too far cannot break the look.
  • The number shown under Instancer FX Inputs stays as you set it. The driven value is used when the copies are worked out, and nothing is written back into the graph.
  • A Value Driver has no clock of its own. It links an input to something else that changes, such as a node you move or a bone you pose. It does not animate anything by itself.
  • Value Mix, beside it in the + menu, reads two numbers and writes a blend of them.

Recipes

Four small builds, each resting on one idea from above. Every number is a starting point.

A stadium wave

Seats in tiers. Sin of the clock minus Column gives a slow swell across the stand. Raising Edge 0 on Smoothstep keeps only the top of each swing, so each column stands for a moment and sits again.
  1. Make a small box with its base on the host's origin. Add an Instancer and type 70 for Count.
  2. Add a Grid with Columns at 14. Wire Column through a Scale And Offset into X of a Construct Vector3. Wire Row through two more, one into Y with Scale 0.34 and one into Z with Scale -0.85, so each row sits higher and further back. Wire the vector into Position.
  3. The clock: Elapsed Time into a Multiply with B at 3.2.
  4. The phase: Column into a Multiply with B at 0.4. Add a Subtract with the clock in A and the phase in B, and wire it into Sin.
  5. Wire Sin into Value of a Smoothstep. Set Edge 0 to 0.55 and leave Edge 1 at 1.
  6. Wire the Smoothstep through a Scale And Offset with Scale 1.5 and Offset 1 into Y of a second Construct Vector3 whose X and Z are 1, and that into Scale.
  • The base of the box is on the origin, so a Scale in Y makes it stand up from the ground.
  • A lower Edge 0 makes more of the crowd stand at once. The phase Multiply sets how wide the wave is, the clock Multiply how fast it runs.

A ripple pond

A grid of flat tiles. With the clock alone the whole sheet rises and falls as one. Length measures each tile's distance from the centre; wire that into the Subtract ahead of the clock and rings travel outwards.
  1. Make a flat tile. Add an Instancer with Count at 225, and a Grid with Columns at 15.
  2. Wire Column and Row through a Scale And Offset each, with an Offset of minus half the grid's width so the grid is centred on the host.
  3. Add a Construct Vector2 and wire the two into X and Y. Add a Length, from Math under Geometric, and wire the vector into it. Its output is the tile's distance from the centre.
  4. Multiply the distance by 1.7 and Elapsed Time by 3.4. Add a Subtract with the distance in A and the clock in B, and wire it into Sin.
  5. Multiply Sin by 0.3 and wire it into Y of a Construct Vector3, with the two Scale And Offset nodes in X and Z. Wire the vector into Position.
  • Distance minus the clock sends the rings outwards, and so does the clock minus distance. Add the two and the rings run inwards.
  • For rings that fade towards the edge, multiply the height by a number that falls with distance, such as One Minus of the distance divided by the pond's radius.

A ring of orbiting lanterns

Each copy's angle is its share of a full turn. Add the clock to the angle before Sin and Cos and the ring orbits. The clock in Y of Rotation (deg) spins each lantern where it stands.
  1. The angle: add an Instance Index and a Divide. Wire Index into A and Count into B. Multiply the result by 2π from a PI node. Every copy now holds an angle in radians, a full turn shared between them.
  2. Add a Sin and a Cos, both fed by the angle. Wire Sin into X and Cos into Z of a Construct Vector3.
  3. Add a Float labelled Radius, set to 2.7, and a Multiply. Wire the vector into A and Radius into B, and the result into Position. A Float wire multiplies every axis at once.
  4. The orbit: put an Add between the angle and the Sin and Cos. Multiply Elapsed Time by 0.7 and wire it into B of the Add.
  5. The spin: multiply Elapsed Time by 140 and wire it into Y of a second Construct Vector3, and that into Rotation (deg).
  • Index divided by Count spaces the copies evenly round the whole circle. Normalized would put the last copy on top of the first, because it reaches exactly 1.
  • The orbit's speed is in radians a second and the spin's in degrees a second. 0.7 is one lap in about nine seconds.
  • To make each lantern face outwards as it travels, in place of spinning, wire the angle after the Add through a Degrees node into Y of the rotation.

A breathing pulse

The same pulse twice. On the left Sin of the clock alone goes into Scale and every copy breathes together. On the right Value from Instance Random, times 6.28, is added to the clock first, and each copy breathes in its own time.
  1. Wire Elapsed Time into a Multiply with B at 2.6, and that into Sin.
  2. Wire Sin into a Scale And Offset with Scale 0.32 and Offset 1. The result runs from 0.68 to 1.32.
  3. Wire that straight into Scale on Instance Transform. One number into Scale sizes all three axes alike.
  4. For the twinkle, add an Instance Random and multiply its Value by 6.28. Put an Add between the speed Multiply and Sin, and wire the random number into B.
  • 6.28 is one full swing of Sin, so random numbers between 0 and 1 spread the copies across the whole breath. A smaller number keeps them loosely together.
  • The Seed field in the Instancer section deals every copy a new place in the breath.
  • For a copy to swell from its middle, the prototype's centre should sit on the host's origin. With its base there it grows upwards.

Pattern by pattern

PatternWhat joins the clockResult
A bobNothingEvery copy moves together
A wave along a rowIndex, times a spreadEach copy a step ahead of the last
A wave across a gridColumn or Row from Grid, times a spreadA front that crosses the grid one way
A rippleThe copy's distance from the centre, from LengthRings that travel out from the middle, or in
A twinkleValue from Instance Random, times 6.28Every copy at its own point of the swing
An orbitThe copy's angle on a ring, before Sin and CosThe whole ring turns
A spinNothing: the clock goes into Rotation (deg)Each copy turns on its own spot

What Sin cannot give

Everything here is regular. A Sin repeats exactly, a wave has evenly spaced crests, and even the twinkle is one breath at shuffled moments. That suits machines, crowds and water in a bowl. It does not suit wind, which comes in uneven gusts that drift and never quite repeat. Wind needs smooth noise, and the Instancer FX graph has no noise node. The next chapter fetches it from somewhere else: a picture the editor repaints on every frame, which the Instancer can read.

Something unclear?

Tell us which recipe or step you were on, what the copies did, and what you expected them to do. A screenshot of the Instancer FX graph helps.

Send Feedback