Drive a face rig from a spreadsheet

This is the walkthrough for the thing the expression language was built for: sketch a movement in the spreadsheet, watch the numbers, then hand the same formulas to a face rig and watch the face do it.

Nothing is translated between the two. The sheet and the rig compile the same expressions with the same compiler, so a formula that produces the number you want in a cell produces the same number on a vertex.


Before you start

You need:

1. Sketch the movement in the sheet

The question a rig formula answers is "given this slider, how far does this vertex move?" — which is arithmetic, and arithmetic is what a sheet is for.

Put the slider value in a cell so you can drag it, and the formula in the cell below:

A1 = 0.5                       stands in for the AU slider
A2 = =A1 * -0.02               the jaw-open displacement

Change A1 and watch A2. That is the whole feedback loop, and it is faster than reloading a rig for every change of mind.

2. Shape it

Real movement is rarely linear. Because the sheet compiles the same language the rig does, you can reach for the same functions:

A1 = 0.5                                slider
A3 = =smoothstep(0.0, 1.0, A1)          ease in and out
A4 = =A3 * -0.02                        eased displacement
A5 = =A3 * -0.012                       the corner vertices, trailing

Lay the variants out side by side in columns and compare them numerically before you commit to one.

3. Add follow-through

A movement that overshoots and settles reads as physical. That needs a value that remembers the last frame, which is prev():

A6 = =prev(A6) * 0.8 + A4 * 0.2         a lagged copy of A4
A7 = =A4 + (A4 - A6) * 0.6              overshoot: lead the lag

Advance frames and watch A7 overshoot A4 and settle back. This is worth doing in the sheet precisely because it is hard to judge from a still frame in a viewport.

4. Produce a position rather than a number

A vertex offset is three numbers. Build it in one cell and the cell holds all three — see cell types:

A8 = =vec3(0.0, A7, 0.0)                a downward offset with follow-through

5. Move it to the rig

Open the rig, pick the vertex, and paste the formula into its y field. Two things change and nothing else:

  • A1 becomes the AU's declared name, au_jaw_open
  • prev(A6) becomes whatever the rig calls its own previous-frame value

The arithmetic is transcribed verbatim. If the sheet said smoothstep(0.0, 1.0, au) * -0.02, so does the rig.

Pro Tip

Keep the sheet. It is the readable version of what the rig is doing, and it is where you go when a movement looks wrong and you want to see the numbers rather than the face.

Why this works

The sheet is not "like" the rig's language — it is the rig's language. Both are compiled by the same front end into the same intermediate program, and then either executed on the CPU or dispatched to the graphics card.

That is also why the numbers match to the last digit rather than approximately: there is one implementation of smoothstep, not one per place you can type it.

See also