In the previous chapter, we completed a more complex skeleton for the robot. Now we'll move on to the next stage of creating an animation-friendly rig in Unreal Engine (UE). Creating a skeleton and skinning it are the first steps toward making our 3D model or character animatable. We will learn how to add controllers that make it easier for animators to animate it.
With good controllers on top of a skeleton, it makes it possible for animators to edit, organize, and refine animations in a much more effective way. The general process of setting up a more complex 3D model to be animatable is called rigging it.
Rigging has three general steps:
Until recently, there weren't any effective tools in UE to create and manage animation rigs and animation, but with the development of Control Rig and the tools around it, it has become possible to create and animate these rigs effectively natively inside UE5 itself.
There's no longer a need to do this in third-party software, such as Blender or Maya. In the following chapters, we will learn how this pipeline works in UE5 so you can create new animations or edit existing ones freely.
In this chapter, we will cover the following:
The following are the technical skills and software you need to complete this chapter:
Finally, you should have completed Chapter 12, Alien Plant Skinning in Blender.
The files related to this chapter are placed at https://github.com/PacktPublishing/Unreal-Engine-5-Character-Creation-Animation-and-Cinematics/tree/main/Chapter14
The Control Rig Editor is where you make the animation rig and its controls inside UE. At the time of writing this book, it's still very much in development, but I'm sure the capabilities will expand over time, as well as its simplicity and optimizations.
First, we need to activate and load the Control Rig plugin in UE since it's not currently loaded by default. The Control Rig Editor can be a very powerful tool, with many features that are outside the scope of this book to cover. However, the basic parts that we will learn about will enable you to rig and animate most things in UE5.
Control Rig in UE5 is a plugin. Plugins are just extra functionality in the software. Sometimes, they don't load by default to make the program run lighter and load faster. With plugins, you have the ability to just load what you need. To load the Control Rig tools plugin, execute the following simple steps:
Once UE has restarted, we will have loaded the Control Rig tools and they will be ready to use. Next, let's get our Alien Plant model into UE too.
The following is the basic process to get a skinned model FBX file into UE. We need to do this before we can work with it in UE. Once you know this process, you can import any skinned mesh into UE and then use it in your scenes or games inside UE. But first, we need to export the FBX file from Blender.
Important Note
Control Rig is much more sensitive to correct scale and orientation than just normally importing a model into UE. As a general rule, we want the root bone of our skeleton to be positioned at 0, 0, 0 if we can and the scale to be 1, 1, 1. This will make it much easier to work with and create a Control Rig for our skeleton.
Different software packages can differ in the way they handle scale and units. In the previous chapters, you should have set up Blender to have a Unit Scale setting of 0.01 while set to Meters. With these settings in Blender, exporting FBX files from Blender and importing them into UE should give better results in older versions of Blender. In newer versions of Blender, this issue might be resolved, and you can have the default Unit Scale setting of 1.0 while set to Meters.
In order to import a skinned FBX file of our Alien Plant into UE, we first need to create an FBX file of this model. Here's how you create or export a skinned FBX model from Blender to be used in UE:
Here's an explanation of the settings in Figure 14.4:
Additional Note
At the time of writing, the unit scaling issue between Blender and UE seems to mainly be a problem in older versions of Blender and how it exports scale units to UE. Some export tests I've done seem to suggest that from Blender version 3.1.2, the scale unit issue also works if Unit Scale is set to 1.0 and Meters. Regardless, the Unit Scale setting of 0.01 and Meters will work in any current version, so it is still the safest to use.
If your Blender scene's Unit Scale is not set to 0.01 and Meters on older versions of Blender, you may need to convert it. This can be fixed in the following way. A detailed description of this fix is beyond the scope of this book, but here's a brief description of the process:
Now we have a ready-to-use FBX file of our Alien Plant. Let's import it into UE.
Back in UE, do the following to import the Alien Plant FBX file:
If all of this is correct, you have successfully imported your Alien Plant. We're ready to move on to the next stage, creating the Control Rig.
To create the Control Rig node on top of or linked to the Alien Plant, execute the following easy steps:
We have now learned how to create a Control Rig node on top of our Alien Plant skeleton. Now, let's explore the main Control Rig Editor interface.
Let's have a look at the Control Rig Editor interface so you can navigate your way around it while working your way through this section.
This is just a basic layout of the Control Rig Editor interface as a general reference for what we will need in this book, as shown in Figure 14.11:
When you first open the Control Rig interface, your Alien Plant might not display in the viewport. To fix this, in Preview Scene Settings, under Preview Mesh, select your Alien Plant Skeletal Mesh under the dropdown, as shown in Figure 14.12:
We enabled the Control Rig plugin, imported our Alien Plant, and created a Control Rig node. We are now all set up to start creating controllers for our skeleton.
The Alien Plant only needs a very simple forward kinematics (FK) rig setup. This sounds very complicated but FK is just basically the same parent/child setup we did with the skeleton itself. The child bone follows the parent all the way down the chain. Our FK animation rig controllers will behave in the same way.
Note
In animation, there are two main ways to control a joint: FK and inverse kinematics (IK). We will cover FK in this chapter and IK in Chapter 15, Creating a Control Rig with Basic IK Controls for the Robot in UE5.
Let's create our controllers. First, we'll create a few simple control shapes.
We'll start in a very simple way and create two control shapes that will control our skeleton bones. Control shapes are the things we select in the 3D Viewport to move our character in the scene:
This is where you can set and edit how your controller looks purely visually. There are many options here, but for our Alien Plant, the circle-shaped controllers are one of the best options. As a rule of thumb, choose controller shapes that will make it visually easier to see what you're doing while animating.
We have now created the two main controller shapes we need.
The bigger Root controller will be used to move our entire rigged object around. The smaller controller will be further duplicated and used as child controllers around the stem and branches of our Alien Plant.
Next, let's work out what controllers we need in this animation rig setup.
In order to decide what controllers we need, we need to work out what skeleton bone positions we want to be able to bend and deform on our plant.
Our Alien Plant has four main elements – the Main stem, Branch 1, Branch 2, and Branch 3. We want both the Main stem and the branches to be able to deform where we have our main joints.
Let's start by eliminating joints we do not need controllers for. The first bones we can eliminate, in this case, are the _end joints. They simply mark the end of the last joints in the branches and the Main stem.
In this case, on our Alien Plant skeleton, we don't need controllers for the first joint of each branch. They share the position with their Main stem parent joints. Two controllers in the same position, in this case, won't be needed. There are, however, some cases where you would want that. This needs to be considered on a case-by-case basis, based on your specific skeleton and how it needs to animate.
After eliminating unnecessary joints that we do not need controllers for, that leaves us with the joints where we do need controllers to move the joints.
In Figure 14.18, I selected these joints in the Rig Hierarchy panel to make them display in the viewport and marked their positions. In the Rig Hierarchy panel, I also marked the joints we don't need controllers for.
In conclusion, for this Alien Plant animation rig, we need the following:
We have now worked out the number of controllers we need for this Alien Plant. Next, let's create them.
In order to create our Main stem and branch controllers quickly, we're going to use the smaller controller, called Stem01:
To the left in Figure 14.19 are the duplicated controllers, while to the right are the bone names. In the center are the final controller names after the rename:
We have now created all the controllers we need. Next, we want to organize them in a hierarchy that makes the Alien Plant easy to animate.
As mentioned earlier in the chapter, we want to create a simple FK setup for our Alien Plant. This is remarkably similar to our current skeleton hierarchy.
Note
You might ask: Why don't we just animate the bones directly, instead of going through all this trouble of creating a Control Rig animation setup? The answer is you could, but it is not the best way to work. Having an animation rig makes everything a bit easier. When we get to IK in Chapter 15, Creating a Control Rig with Basic IK Control for the Robot in UE5, you absolutely need a Control Rig to make it work. Most character animation rigs have a combination of FK and IK in the same rig.
In our Alien Plant skeleton, we have four parts: the Main stem and the three branches. Each of these is just a simple parent/child chain, so let's create these simple hierarchies.
It is very simple to create a hierarchy in the Control Rig interface:
Finally, we need to complete the hierarchy. We need to make the branch hierarchy parent the children of the appropriate bones on the Main stem.
The final result should look like Figure 14.22:
We have now created a hierarchy very similar to our skeleton, but since we need fewer controllers than joints, it is slightly different. Now, we need to position the controllers on the joints.
At the moment, this setup doesn't look like much since all the controllers are on top of each other at the origin of the scene. The reason we do the hierarchy first is that if we did the positions first, the relative offset of the controllers as children would have to be constantly readjusted as we changed the hierarchy. With our hierarchy already correct, we only need to position them once.
Our bigger Root controller will stay at the origin of the scene.
There is a simple method to position the other controllers exactly on the joints. Right-click to select the bone/joint. In the dialog that appears, select Copy. Then, right-click to select the corresponding controller, and in the dialog that appears, select Paste Global Transform, as shown in Figure 14.23:
To make this new position on the controller permanent as far as the rig is concerned, right-click to select the controller again and then select Set Offset Transform from Current, as shown in Figure 14.24:
Now, let's do this for StemBone01 first:
We've now created all controllers and positioned them so they line up exactly to the bones they will control. Next, we'll get the controllers to control the bones in our skeleton.
The final step in creating the Control Rig for our Alien Plant is to get the controllers to drive/control the skeleton. The Control Rig system can be used to create very complicated rigs that are beyond the scope of this book. The Control Rig system uses a series of nodes that can be linked together in a visual way to drive the behavior of our Animation rig.
For a simple FK, we just need a few basic nodes in our Rig Graph panel, as follows:
If this sounds complicated, don't worry. It is simpler in practice than it sounds.
Let's create a setup to drive RootBone with the Root controller:
A Set Transform - Bone node box will be created. Note that under Type, it's Bone, and under Name, RootBone has been automatically set, as shown in Figure 14.27.
You can select the node boxes and move them around. You can use the mouse wheel to zoom in and out, and the right mouse button to pan around the Rig Graph panel.
This will create a Get Transform - Control node box, as shown in Figure 14.29.
The Root controller now feeds its transform values into RootBone and drives/controls it.
Note
If you make a mistake, you can use Alt + left-click on the connection line or socket to delete the connection.
Important Note
Be careful not to use undo (Ctrl + Z) after you move or rotate controllers in the viewport in the Control Rig interface. It will undo the last things you did on the rig setup and not undo the translation on the rig itself in the viewport. Instead of undo, click Compile at the top left to return your rig to its original pose and translations, as shown in Figure 14.31.
We have now set up one controller driving one bone. Now it's time to hook up the rest.
To set up the rest of the animation Control Rig, we follow exactly the same process as the Root controller setup. Here's a recap:
After we complete three of the controllers, it should look as in Figure 14.32. This flow continues until all controllers are connected:
After we have completed all of the controllers, it should look as in Figure 14.33:
It looks complicated, but it is just the same two basic nodes repeating to cover all our controllers, linked together by Forward Solve/Execute. In Figure 14.33, the connected nodes are organized in two horizontal tiers to fit easier on the screen, but it doesn't affect the rig behavior.
You can now test your Control Rig setup by rotating your controllers and making sure the Alien Plant and its skeleton are following and deforming with the controllers, as shown in Figure 14.34. Remember to use Compile instead of Undo during the testing. If everything is fine, you can save your UE5 project in a safe place for later use:
We provide the completed Control Rig in the final project file, which can be downloaded here with installation instructions: https://github.com/PacktPublishing/Unreal-Engine-5-Character-Creation-Animation-and-Cinematics/tree/main/FullFinalUE5Project.
The example Control Rig is under Content/AlienPlantControlRig.
We now have a completed Control Rig for our Alien Plant.
In this chapter, we learned how to correctly export our Alien Plant from Blender and import it into UE. We learned how to activate the Control Rig plugin and navigate its basic interface. Finally, we built a basic FK rig with the Control Rig system. With this knowledge, you can now build FK animation rigs in a UE5 Control Rig. This means you can build FK animation rigs for all kinds of different animated objects and characters for your scenes.
In the next chapter, we will build a Control Rig for our robot that will include IK.