ANDREAS SUIKA: Welcome. My name is Andreas Suika. And in this video,
I will show you different usages for
Control Rig, which made a big leap in engine. Control Rig is a node-based
rigging system designed to provide riggers and animators
with tools to create flexible, dynamic, and procedural
characters with an artist friendly interface. I wanted to use Control
Rig for gameplay prototypes to enhance a look and feel
and feedback for the player. So I began to learn modeling,
rigging, and animating only a few months ago. I will show you how easy it
is to create your first week and animate in-engine, how to
change existing animations, and how to use Control Rig
for real-time animation adjustments. We will take a look at
procedural animation using the Control Rig component
and Blueprint, including second dynamics like the
wiggling tail that is done mathematically in Control Rig. So let's get started. I will show you how to
enable Control Rig, walk you through the editor, and
we will create our first rig. And we'll go a bit further
and look at a reverse foot setup, which we will then use to
create an animation sequencer. We will also check out
the backwards solve used to bake a rig onto
an existing animation. I will show you a set up
that does feet and hip adjustments in real time. This will include how
Control Rig works in conjunction with other parts of the engine. We will dive deeper
and checking out how to do procedural
animations using the Control Rig component for the flower
and for the scorpion. At the end, we look at some
debug options and tips. All the content you
will see in this video is done in Unreal Engine. Blender was used for modeling,
creating a bone hierarchy and the weight paint. Big thanks goes to
the Control Rig team, but especially Helge,
Jeremiah, and Greg who were a great help
for this project. Also high five to Tony, who
helped me with this animation and rigging experience. Last but not least, to
my colleague Arran who helped me with environment. So let's start with
our very first rig. To use Control Rig, you
have to enable the plugin and restart the engine. Control Rig is still in beta
but it's not going away, but will be improved
even further. When we bring in a character,
it generates two assets. One is a skeleton and one
is a skeletal mesh here. So for this video, and
my own learning purposes, I did a very simple
character like that. So he has only two legs, a body,
and some bones for an antenna. But you can do really
complex characters here. Actually, it's used in
Fortnite quite a lot and it was used in the
Unreal Engine 5 demo. And then it generates also
a skeletal mesh for us, which contains the vertices
and material data, LODs, morph targets, et cetera. And that's what we use to
generate as a Control Rig. Now, Right Click, and then
here, Generate Control Rig, which makes a new asset. Let's open that up. So here we are now in
the Control Rig editor. So on the left side,
you can see here viewport with our mesh, which
is the preview mesh, which was automatically set for us. But we can change
that later if we want. And then here is the
hierarchy that got imported. That's important to notice, it's
important not to referenced. So if you change it, you have
actually to update it here. And then in the middle here,
we do the graph with all the logic, which I'll show later. And then on the right
side, we have details for the selected objects. And then you have on the
bottom side, all your variables and the My Blueprint tab. If this is not
showing up for you go to Windows, and
then My Blueprint and enable that and
dock it somewhere. So let's start with
something simple. So first, we will use
a Forward Solve event. Here are different events, like
a Setup event, Forward Solve, and the Backwards event,
which we will use later for animation purposes. But for now, we go
with the Forward Solve. So let's drag that out and do
something like Draw Hierarchy, which is a really handy node-- let's make this a bit bigger-- in showing us our
bone orientation. So here, I can see the
x-axis, for example, is our main axis for the bones
of this character I made. So really handy. So let's get rid of that. And now let's take a look. So we want to make
a simple thing like IK for left, right leg
and to control for the body. So let's get started. Let's search for some IK. Here are some
different IK solvers, but we would go for basic IK. And then we will
use the left leg. And we will start
with the upper leg and we will go to the
lower, leg and then to the foot, which is the
names I gave to the bones. And then you see an
immediate problem. He is plopping to 0, 0, 0. That's the effector position
which is currently zeroed out. So we have to make that. And then he's losing his feet,
but just Propagate to Children will fix that. Now, let's unplug that
and make our first control for the effector. So Right Click, and
then you go to New. And then you have different
ones like Bones, Controls, and Space. For now, we will work
with Controls mainly. And that generates a
control at 0, 0, 0. Let's name that IK left foot. Here it is. Currently, it's adjustable. So let's outfit this. We can change the color
here in the details panel, like a nice green. And then we also
can give it a gizmo. That actually, in a class,
you have a gizmo library, which comes with the engine,
but you can make your own. For now, we will
start with a box. I personally like boxes,
because they show you all three angles of rotation. So it's really nice to
debug and to start with. Let's bring that to a size that
fits our character, like this. And now, we have to move it
into the right space, which is actually where the foot is. So we could copy the data from
the foot to this controller. Or we can use the
viewport and move it just in the vicinity of the bone. Do a Right Click, and then
there is a Set Transform from Closest Bone. So now it snaps there and
has the same transform, which is nice. So let's plug this back in. And here's our foot
again, wrongly aligned. But now if we bring
in our control and say, Get Transform
and plug this in, its snapping in place. And now, you see,
we can already-- we have our first IK
moving, but the knee here is doing strange stuff. And that's because we don't
have a pole vector yet. And what we want
to do is we want to have Location instead
of a Direction here. So we could make a
control for that, but I want to show you
something pretty handy. So we can use this
and add a vector and plug this in
as a pole vector. And when we open this up,
we can set up some events. Let's display where
this position is. And that's where the visual
debug comes in handy. Let's make that bigger. So that now shows the position
of this node in space. So let's move this a little
bit out a little bit up. So this is where our
knee should now look at. And if we now use
a control, you can see that looks much,
much better and it's doing actually what the
normal knee of this character should do. So that's nice. But as an animator, I don't
have any control of that. So instead of using
this node, let's create a small control for that. So again, I had to Right
Click here, New Control. Rename it to
something like PV_L. And then we have the
little ball here, so let's move it to
the position where we want our need to point to. Let's find a nice
spot, like here. And then Right
Click, and now we can use as current, which is nice. So now it is set up properly. Let's change the color as well. And then let's find
a gizmo that fits. So maybe a pyramid will do fine. It's way too big, so let's
get it to a proper size. So you can adjust as you like. And then we can rotate
it so it's maybe pointing to the knee. And now, with this set up,
we can use Get Transform. We only need the location in
this case, and we plug this in. And now, we have the ability
to do the IK for the foot, including manipulating where
the knee is pointing at. Really nice and really
easy and fast setup. So now, as we have that, we also
need this for the other side. So we could do the same
process, but there's a mirror we can use. So we can mirror
over the x-axis, or say what we
renames from _L to _R. And now, we have it on the other
side, which is already good. So we need the same
now for the graph. So let's just take this and
copy it over, connect it. And then we can select
it, Right Click, and then we can
rename the nodes. And as we have our
naming convention used, this should go
pretty fast and easy. So now, it is aligned to that. So the only thing I have to
change because of my bone orientation is
the secondary axis so my leg is rotated in the
right direction for this. So now, I have it ready. So I can have both legs
with IK and the pole vector done in just a few minutes. And that would be already
nearly ready to animate. And now, we are
missing the body. So let's do a forward. And let's create a
new Control here. So again, we call
this one BodyControl, and then we do the
same steps as before. So we move it in the vicinity
of the bone, do Right Click. Set init from closest
bone, change the gizmo. So maybe a hexa goes nice here. So let's rotate that, and
then bring it a little bit down in size. And here we are. So now, we can make a Set
Transform for this bone. And using the control Get
Transform both in Global Space, and then lock this in. And now we can move his
body around, like this. So he's losing his legs,
Propagate to Children will fix that. So if we move him
around, you can also see now that as we do
the control for the body after the IK, the IK feels off. So we can change that. And here is why the
order really matters. So let's unplug that. And let's do the body
control before we do IK. So first, we do that,
and then after that, we solve the IK for the foot. And now, you can see it fits
and is what we were looking for. And we can move his
body and his legs now. It's the first time this
character comes to life. I really love this part. And with this basic set up,
we can go now a bit further and add some features. And I show a reverse foot setup. So I have here
something prepared. And it's basically the same. So we have the
body control and we have a basic IK for the feet. But in addition, he has
some small enhancements. For example, his antenna is
has some second dynamics. So I will show how
this is calculated, and then I made a
control for changing his facial impressions. It was just a material. I will show how Control
Rig communicates with that. And then we have the
reverse foot setup, which I have here
with a controller that is either distributing rotation
to the heel or the toe. And I would show that. Actually, let's start with that. And here's the setup. So before we go deeper,
I unplug the graph and show the hierarchy,
which is extremely simple. So it starts at the heel,
and then it goes to the toe. And then at the end of
the chain is the control we are using for the basic IK. Let's plug that in. And let's go to the
other side where I hid all the controls that are
not needed for the animator. So here, I have this control. When we take a look
at the node here-- here it is-- then you can
see I'm using Local Space. And in this way,
I can figure out on which axis it's going, in a
positive or a negative rotation depending on its initial setup. And so with this,
I can just say, if it's negative
or positive, I'm either distributing it to
the toe or to the heel. And after that,
we do the basic IK we have seen before, and
then the ball correction. Let's unpack that. So here, you can see without it. And then let's plug it back in. To do this, I use a
Project to Parent node. It returns to
transform of an object relative to another like
a parent constrained with maintain offset. In this case, from the total
to the ball and just rotation. And that helps to fix that. And the last thing
I'm doing here is just for convenience,
having the control moving with the bone. If I don't do that,
it looks like that, that doesn't feel very nice. So if I use a foot
position after the solve, I can have the
control going with it. Oh, that's pretty
nice and handy. So let's go to the antenna. For the antenna, up
here, the antenna is a chain of bones
from antenna1 to 4, and I'm using a collection. A collection is a list of items. And you can easily create
one by just drag it in and say, Create Collection,
like I did here. And then for those, I'm taking
those and iterating out of them for each. And for each item, I'm
setting the rotation, which I calculate-- I'll show you in a
second-- with a weight. And the weight is
depending on the ratio, which is a number between 0
and 1 on the item chain here. So and for the
rotation, what I'm doing is I'm calculated from two
vectors based on the body bone. And you can see here, when
I move it left and right, I have the debug nodes-- the visual debugging
on for both of them. So let's show that. So it's for that and for that. So you see it also up
here with the colors. So you can see how
this is calculated. And then to have
the blue one doing the springy kind
of thing, I'm using a simulation node-- a Verlet
Node with some settings. I figured out works nice. So there are some nodes I want
to bring you to your attention. One is the Math section with
a lot of different things. Like, there's noise,
there's a lot stuff like curves, [INAUDIBLE] curves,
clumping, et cetera, et cetera. And then there's the simulation. So accumulates over time data
from previous and the verlet I'm using here. It's worth investigating,
they are really handy. So, yeah, that's that. And then let's talk
about the eyes. So I'm using a curve. So you can set a curve value. If I switch this off-- I'm going hit the
curve container here, you can see the Mood curve. If you don't have that, you
can go to Windows, and then here, Curve Container. And here's the Mood. So the Mood is value
stored in the skeleton. So I can add a curve
here like that, and set it either to
Material or Morph Target. In my case, it is
influencing material. And it's influencing
all the materials. And here is the eye material. And there's a
parameter called Mood. It's the same name. So this is how it's connected. And I'm using a Flipbook
here with 16 different faces. So if I change now
the value here, it's going through the
skeleton to the material. And now, I can animate
material with this. So I made a control for it. And this control is an integer. You can see that here. I can have different
control types. And I even limit it
between 0 and 15. And then I do
transform it to float. And now, I can switch his facial
impressions with this control. Yeah, and with this
set up, we can now talk about how to
animate him in-engine. You can animate in
any level, but I have a very simple one here. Let's grab our control and
just drag it into the viewport. This opens up
automatically Sequencer and creates a Level
Sequence for us. It also switches to
the Animation Mode in which we can find
all our controls and some options like
display the hierarchy or hide the manipulators. Very handy is Only
Select Rig Controls, which prevents
you from selecting anything else in the
level, like the background. Also worth noting
is you should switch of snapping for
rotation and translation, otherwise animation is sometimes
pretty hard or not even possible. So for this very
small jump animation, I do, like, 24 frames only. And we do something, like, 80
frames or something like that. So I'm speeding up
this process now. And here, you can see how our
controls are really handy. I figured out in this
project, the more time I spend with
our controls and make really nice and
convenient controls, the easier this process is. As you might see here,
I'm not an animator and this is not a
tutorial about Sequencer, so bear with me while I
make this really fast jump animation very quick. So this is how it looks like. I'm happy with it, but
we could go now to the curve editor and tweak our curves. I don't want to go
there now, but I want to show you the process. So now, Right Click
on the Control Rig, I can bake an animation
sequence from that. But really handy is Create
Linked Animation Sequence. So let's do that. Let's name it A_OnlyLeg_Jump. So this creates a
linked sequence. The sequence and animation
is now linked together. Let's export that. And so here it is. And when we open this up,
we have now an animation like if we have brought it in
from any other external source. So that's nice, but let's take
a look at the antenna here. The antenna is going
a little bit crazy because it wasn't really done
for this kind of fast movement. And as it is all
now linked together, we can go to the Control
Rig and, for example, unplug the simulation
of the antenna. Let's save that. And then from the animation
itself, as it is linked, we find Open Level
Sequence here, which brings us
back to our scene. And here, if I play it now, you
can see the antenna is already not moving anymore. I can save that, and then if
we go back to the animation itself, you can see now
this is also adjusted. But be aware, it is not working
when you change dramatically things in the hierarchy,
adding new controllers or something like that. But for this kind of fix,
this is really convenient. And before we talk
about bringing that back in a real-time
set up, let's talk about how to change existing
animations using Control Rig. So to change an
existing animation, we first have to
prepare our rig. Let me first bring
back our antenna here. And now, we're using
the backwards solve to move our controls
with the animation. So here has a very
simple example of that. So we're settings
body control by taking the transform of
the body itself, and then setting
the body control. And Forward Solve,
this is executed again, so if we move it again. So this is a very
straightforward part. When we take a look
at the feet, we have to see which bone
do we want to use. In my case, I'm using
the position of the ball to move the foot main,
which is my control where all the other controls
are living in. So again, the Project to New
Parent is a really handy node. And then I'm setting
the foot main here. So we do that for the
left and right leg, and then we also do
it for the curve. So we can read the curve
value from the animation, and then feed that
into our control so he will change his
face and we can then-- we'll be able to change it. So in a level, we can
open a new level sequence. Let's do, for example, a crouch. So I do a new sequence. I call it SEQ_OnlyLeg_Crouch. So we use our walk animation,
and then we change that a bit. So here we are. And now, I'm looking for my
skeletal mesh, which is here. And drop it into the Sequencer
opening up the animation panel, and then add this
animation here. So now, let's move him up
a bit and moves this here so we have the loop here. And now, if I play that,
I have the animation. And now we can bake a rig on it. We can use Edit
with FK Control Rig or create controls
for each bone. That's not what we want. Right now, we want to bake our
own rig which we have prepared, which we would find here. So let's use that. And then we would use keys,
define some tolerance, and bake it on. So now, I have the
animation with a Control Rig on top of that. And you can see
already something, I made by purpose, something
wrong in this animation so we can fix that. So the feet is completely
wrong in the first frame. And to fix this, we just
use our control we made, positioning it. And that's it and it's fixed. So this would have
been a process where we would have
import and exported and using external tools,
which is now really convenient. Let's go one step further
and use this walk animation to do a crouch. And for that, I use my
control of the body. And here is a curve of his
Z movement up and down. So let's first makes this-- let's move this a little bit up
so he's not stomping so much. And again, this is not
about animation itself. I'm still learning
so bear with me. And we bring him
a little bit down so it looks like he's crouching. This should maybe work. Let's play. Yeah, I'm fine with that. And now, we do the
same as we did before. We do Right Click here and do
a bake to a linked animation. Name it
A_OnlyLeg_Crouch, export. And now, we have a
new animation which we can use an Animation
Blueprint, for example, and have a new state. So that's how animation
changes works with Control Rig. Let's now talk about adjusting
things in real-time using Control Rig. Here's our character now
with all the animations we made in-engine. He's using a third
person character template and has a Control Rig in
real-time running on top of it, which makes the fit placement
and some hip adjustments. He can also look at a flower if
it's getting close and changing his face. So let's take a
look how it's done. The Blueprint of him is
really straightforward. Outside, it's just
using the template. So I just changed the character,
nothing fancy in the graph, and edit an Animation Blueprint. And the Animation Blueprint is
also extremely straightforward. It has a state machine with
just a Blend Space right now between idle and walk. And then there is
a Control Rig node, which gets some
information like speed, or look at location. And here is a graph
for real-time. So let's take a look at that. So here, you can find now the
values that are coming in. And he has a left foot trace,
a right foot trace. And he has a hip correction and
the logic for the look at. And at the end, we do
the IK for the feet. Let's take a look
how we do the trace. So for the trace,
I'm using a bone. You can add bones the same
way you add controls by just go New, and then Bone. And you can make your
own hierarchy's. And this bone here is using
the transform of the foot, so it is exactly
the same position. And I'm using this position
to do Sphere Trace. And if it hits something,
I'm using the hit normal was an Aim Math to figure
out how to rotate the feet. So if something is hit, he's
taking the location and the hit number with the
transformer, accumulated Lerp on the transformer. And then I'm setting the
control I'm later using for IK. And actually, exactly the
same for the right side. Let's take a look at
the hip correction. So for the hip
correction, I have the bones of foot and the feet. And I can compare
the newly computed IK with the initial
lengths of that chain. And depending if the left
side or the right side has an adjustment, here
I'm adding a little bit of an offset, because
I modeled the character with straight legs, which
was not really helpful. But here, I can
do some correction and finding a magic
number that works. At the end, I do Accumulate
Lerp again so it doesn't plop. And then I'm setting the control
transform, which I'm then using to adjust the body bone. Let's take a look at logic. So from the Animation
Blueprint, I'm getting the position,
which I have to transform from world so
it works in this Control Rig space. And again, I'm
using an Aim Math, do a little bit of
clamping so his head is not rotating 360 degree here. And then if he's
looking at something, I'm doing accumulate
Lerp for quaternion, and then setting the rotation
of the bone directly. And if he is looking
at something, I'm changing the curve so
I can have different faces and he can look surprised
or concentrated or focused on the flower. And as a result,
we have him here with his feet properly
placed and his hip adjusted. Still playing his
idol animation, so this is a very good example
about a mixture of existing linear animation and Control
Rig running in real-time really smoothly together. After this mixed
version, let's now take a look how to do 100%
procedurally animated one with Control Rig. Here, I have a flower. And the character is not
only looking at the flower, but the flower is
also looking back. And this is done without
any linear animation at all. So let's take a look
how this is done. In Blueprint, this a
Blueprint I'm having here contains a Control
Rig component, which you add in the same way
you add any other component. And then in the
viewport here, I'm having my skeletal mesh
and a construction script. What I'm doing is mapping the
skeletal mesh and the Control Rig together. And the Control Rig,
also I set the class of my Control Rig asset here. That's all. What you maybe have to check
out if your skeletal mesh and Control Rig are aligned. And you can do this by setting
the relative orientation. But I don't need to
do that in my case. But this is important. And then Control Rig
comes with new events, like On Pre Forward Solve. Now that feeds data
and to Control Rig week before the rig is
evaluated per tick. And then I'm using this, if a
player character is set here, I'm taking his location because
he's moving all the time. And then I feed that
into the rig itself. And on the overlap, the flower
is telling the character where it is, but I'm also
setting the Look At and settings to play
a character, which I then use on this event to
update the location. So let's take a look
at the rig itself. And Control Rig is
also pretty simple. So let's look at the hierarchy,
which is just a chain of bones here. And the animation of the
leaves are done in material with world offset. And then we have the control-- only one control
which we will use. So to get the position where
the control should move, we take a Look At position
we get from the Blueprint, we convert it to world
and use an Aim Math again to do the rotation. And what I'm also doing
here is I'm using the scale, so I'm scaling him up a
little bit while he's looking. And after you Accumulate Lerp,
I set Look At control here. And now I'm doing an item chain. I start with stem2
because it looked better than starting was 1. And then I using
CCDIK with effector here with adjusting
some numbers. And that gave me
this nice result of the flower bending in
the direction of the player. So as an end result, within
a really, really short time, I have now a flower creepily
looking back to the player. I didn't want to
stop there, so I made this six legs
scorpion robot who's completely procedurally
animated with using a Control Rig component and the
Control Rig asset to create this feet placement
and the wiggling tail and all that. So let's take a look at that
and start with the Blueprint. So the Blueprint is
generated from a character. And I added a Control Rig
component like for the flower and the asset here. And then I met them as
I have shown before. But here, I had to be
aware they are in sync. So the Control Rig and component
have the same rotation. Right now, Control Rig is not
working with the inherited skeletal mesh. So I created another one,
ignoring the one that is there. And when we take a
look at the graph, I'm using the same
event as before. I might set this up differently
with my knowledge now, but here, I have
a list of controls I'm using for line trace. So I get to control transform
here doing the line trace, and then doing a
little bit of math comparing the current position
of the feet with the new trace. And then depending
if it's far away, I'm setting the
controls for the feet here with location and rotation,
like I did in the as an example in Control Rig actually. So that's for here. And then let's go to
the Control Rig itself. So here we are. So as said, mainly the feet
are driving all the rest. So the feet placement, as you
can see here, if I move them, his body is also
moving accordingly. And his hands are
wiggling and stuff. So here we have the body
rotation we are doing. Then we have the CCDIK
I'm using for six legs. Then we will talk about the
tail set up in a second. And then we have something
for the hands and something for the left hand, right hand. And my antenna set up, which
is pretty similar to what you have seen already. But let's take a look
at the important pieces here, which is the body first. So if I move these feet
around, as you can see, there's also the body moving. And how is this done? I have six legs, on the
left side on the right side. And I'm taking the
transforms of them and interpolating the
location on both sides. And then I'm using an
Aim Math to figure out how to move over
time the body space. So the control of the body-- so control of the body is living
in a space I'm manipulating. There are six legs and
they have two knees, so I didn't want to
have a big graph. So here's the setup
I came up with. It is using CCDIK and again,
a collection of items. In this case, I'm
starting with the bones that are attached
directly to the body here and iterate over them. And then I get the children. And this is what I use as
an item chain in CCDIK. And then here, I have the
list of controls, which are in the same order as my bones. And so I can use the index
and use this as an effector to transform that as an effect. So that's basically the whole
set up for all six legs. Let's take a look
now on the tail, because that's interesting. The tail has two solvers. The first one is a
distribution on an item chain. So if I do this, he's
beautifully using that. And then I have in between
this space and this space is using a verlet node. So do the wiggling here. So if you take a look
at the hierarchy, I have the space I'm moving
around, and then in that space, I have another control. And this control is
effector of a Basic FABRIK. So what I can do now is
I can move from here, and then I can go back to
this interpretation one and do something like that. So here, you can see how
powerful Control Rig can be, especially with the
order of execution. And as a result,
I have a character that's extremely responsive
to players input. So this is still not perfect
and there's a lot to do. And I would do some things now
different after learning that. But this shows the
potential of Control Rig in a real-time environment. And it was really fun
and fast to iterate on. To wrap this up,
I want to show you some debug tips I figured
out during working on that. So first of all,
what's really handy is you can use
Control Rig to watch at instances in the level. So I changed the filter
to the instance I'm in there. And then, ta-dah, I can
see him in his current pose in the gameplay situation,
which is super handy. So if I take a look at the hip,
and we remove this execution node, you can see
no hip adjustment. And that's the reason
why I implemented it. So it tries to reach
this point, but can't. Let's plug that back in. And here, you can-- it's
not only for debugging, but I can also find
my magic numbers here. As I said, I modeled
him in the wrong way, so I had to do some
adjustments here. That was really handy. Next one is the visual debug
nodes I used before already. So let's go to the leg. I can edit them, I can keep
them there as I made them. And then I can toggle them on
and off depending on my needs. So here is the distance
between the bones. Next one is some
of the draw nodes. Here, Draw Line, I
can enable them here, and then I can draw some
lines, which help me greatly to see what's going on
in my rig and if it's behaving like I was expecting. You can also use
those for enhancing the visuals of your rig. So I use this, for example,
to visualize a little bit better which pole vector
is attached to which knee. Like that. And then there's
one tip Tony gave me to have some debug
controls lying around, which you attach to a situation. And depending on
the execution order, it helps you to
visualize what's going on in a certain moment
in your rig like this. Thought that was really
handy and I used it a lot. As with many parts
of the engine, you can enhance Control
Rig using Editor Blueprint Widgets or even Python. Here's a link to the
API documentation so you can optimize
your workflows or work with even more
complex Control Rigs. This project was a blast,
and I learned a lot. So thanks for watching. And we are looking forward for
all your beautiful creations and animations made with
Control Rig in Unreal Engine.