The Last Clockwinder - GPU Spline system


The team at pontoco reached out for some help with a GPU based spline solution for the arms of their character. For context, they are making The Last Clockwinder, a VR title in which the player can record their actions and produce a robotic clone, that then repeats those actions on a loop. This can be repeated multiple times, forming a virtual rube goldberg machine of robotic clones, and is the primary puzzle solving mechanic in the game.
This is the system we came up with:

Main Spline mesh shader graph

We feed in the two end points and two control points needed for a cubic bezier function, implemented on the GPU., along with any other relevant info, such as the up vector. I first prototyped the implementation with nodes, and then moved it into a custom node for legibility. Here is the core bezier function:

Cubic Bezier math represented as nodes (Unity Shader graph)

And the same math represented in a custom node

We then feed the data on every frame via a C# script that listens to the the Clone character’s relevant bones. It’s a little more complicated, since the character has both a recorded bone position, and a computed pose based on IK and other constraint solvers. In our case we pass in the shoulder and wrist transforms. We compute the locations of the control points by projecting a vector out from the torso, and the back of the wrist. All of these values are exposed via the inspector for tweaking and testing.

The inspector for the Spline mesh script.