James V Snowden

# WTF is RBF?

If you're looking for an implementation of an RBF system in Blender, I have an addon available called RBF Drivers, which is exactly that.

Essentially, RBFs (radial basis functions) output a value based on the distance between two data points. They've been used in machine learning, statistics and other fields since at least the 1980s, but more recently have been applied to 3D animation, particularly rigging. To see why they're useful, and get an idea of how they work, we first need to take a quick look at more traditional rigging tools.

### Constraints

When rigging, we often want a bone to react to changes in the position, rotation or scale of another bone, and we certainly don't want to manually key all those changes every time we animate something. Constraints allow us to set up a relationship between the two bones, so that when a certain value changes in one, a change is produced in a value of the other.

The simplest example is something like a Copy Rotation constraint, so the bone just gets the same rotation as the "target" bone. We have some control over the relationship between the two bones (we might "dampen" the rotation by adjusting the constraint's influence) and for some situations this is enough.

### Drivers

Sometimes we need more precise control over the relationship between the two rotations, so we might choose to use drivers rather than a constraint. Using the drivers' f-curves we can adjust the rate and degree of change so that one bone doesn't need to follow in lock-step with the other (though this can be tricky, particularly if we're using quaternion rotations).

Whether we use constraints or drivers, what we are essentially doing is defining a mathematical relationship between one value or set of values and another. We are telling the software how the value of one or more properties should change the value of another. Using RBFs, we can take a different approach: instead of telling the rig how to do something, we can tell it what to do.

### RBF Networks

Radial basis functions can be used to form a kind of artificial neural network, which might sound kind of heavy, but we don't need to go down that rabbit-hole to understand and use them to improve our rigging.

With RBF networks, instead of defining a mathematical relationship between our input and output values, we define a collection of "snapshots" or "poses". We're basically saying that when the input properties are like this, the output properties should be like that.

At any given moment, the RBF network then looks at where the input properties actually are, and compares that to the poses we defined in order to figure out where the output property values should be.

The way it does this is by using a linear equation solver, but again, we don't need to worry too much about the math for our purposes. Essentially the system will give each pose a weight based on the current input values, and use them to produce a weighted interpolation of the output values.

As far as the RBF network is concerned, the relationships between the inputs and outputs are entirely arbitrary. It doesn't care if one is a position and the other a rotation or even the mix value of a material node, and it doesn't care if one increases while the other decreases and then one decreases while the other stays the same. This offers a number of advantages.

• In contrast to drivers, which offer one-to-one or many-to-one relations, RBF networks can handle one-to-one, one-to-many, many-to-one, or many-to-many relations.
• A 'pose-based' approach allows less experienced or more artistically oriented riggers to produce higher-quality results, and more advanced riggers to achieve them in less time.
• Complex, non-linear secondary deformation can be set up in minutes that would otherwise take much longer, be prohibitively complex or even impossible using other methods.
• When the rig requirements change, it's often easier to adjust a couple of poses to get things working correctly than it is to revisit a complex set of interdependent relations, constraints and drivers.

RBF networks represent a fundamentally different approach to solving issues in the character pipeline. They certainly aren't meant to replace the tools already at your disposal, but are an important addition to them. It's worth illustrating this with an example.

### A Quick Example

Let's imagine we're rigging an elbow joint. Predictably enough, as the forearm rotates in towards the bicep, the geometry is getting messy on the inside and the bend is too soft at the elbow. We opt to fix it with a shape key driven by the rotation of the forearm on whichever axis it bends around. Job done!

Now we come to fix the shoulder, but of course the range of motion is much more complicated. Not only can the arm move in several wide arcs, but the shoulder itself rotates more-or-less independently around the rotator cuff. Our super-fancy-shoulder-rig has got us most of the way, but refining things with shape keys and then somehow driving them is likely to send us to the asylum.

Using an RBF based system we simply need to select the position and rotation of the shoulder as inputs, pose the shoulder (for example raising the arm) and sculpt a shape key, then repeat the process a few more times with other select poses so we have enough data for the system to work with. We can now pose and animate the shoulder freely and the RBF system will smoothly interpolate between the shape keys based on both the position and rotation of the arm.

### Use-Cases

Hopefully the above has been enough to at least pique your interest, and perhaps consider adding an RBF-based system to your toolset. If so you might want to take a look at my implementation of RBF Drivers in Blender. Below are a few areas where I have found them useful, but it is by no means an exhaustive list.

#### Corrective shape keys

I find that RBF drivers really come into their own with shape-keys. As the example above illustrates: Pose, sculpt, save, rinse, repeat. Getting really nice deformations doesn't get any easier.

#### Secondary deformation bones

Secondary bones are often indispensable to maintain volume or improve deformation, and they transfer to most game engines painlessly, but in cases where they don't neatly follow the movements of other bones, or you need more than one to produce a desirable result, they can become a hassle. Using RBF drivers I can pose the character, make adjustments as I see fit and just record a snapshot.

#### Muscle systems

If you've ever tried emulating muscle activations based on the movement of limbs, you'll know that getting the underlying bone-chains or bendy bones to behave correctly is hard. With RBF drivers you can move, twist, bulge or squeeze them into shape and produce accurate deformations relatively quickly by using the location and/or rotation of the origin and insertion bones as inputs, and drive the transform properties of the 'muscle'.

#### Facial expression mixing

Because a single RBF driver can handle multiple transforms and shape keys simultaneously, they offer a really nice way to mix facial expressions. Create the set of expressions (surprise, anger, etc.) using the bones (including bendy ones if you're using them) and shape keys, then use the locations of a set of viewport "sliders" as a kind of 2D mixer. If you're feeling particularly adventurous you could even make 3D controls and work them from a VR headset!

#### Accessory/Attachment rigging

Let's say your character is wearing a suit of medieval armor. You certainly don't want to individually animate all those interlocking metal plates, but they shouldn't be bending or warping with the character's limbs. Some are going to be easy to deal with using constraints, but in other cases, such as the armor 'skirt' around the character's waist, you just want them to get out of the way of the leg when it moves. By posing the leg out to the side, front and back, and setting where you want the 'skirt' in each case, you can achieve exactly that.