00:00:01
[Music]
00:00:15
okay so it's about time we started to
00:00:17
tackle some of the systems which the
00:00:18
controls will drive
00:00:21
as this is a game rig we want the base
00:00:23
skeleton to be left as clean as possible
00:00:26
so what we're going to do is create a
00:00:28
series of control joints
00:00:30
what these are are copies of parts of
00:00:32
the skeleton which the main controls
00:00:34
will be connected to
00:00:36
these will then drive the main skinned
00:00:38
skeleton
00:00:40
this makes for a cleaner rig
00:00:42
especially when it comes to exporting
00:00:45
it can also give you the option to
00:00:46
quickly detach the rig if needed
00:00:50
so first we need a copy of each section
00:00:52
of the skeleton
00:00:53
let's hide the controls for now
00:00:59
and then select and duplicate the root
00:01:01
joint
00:01:02
you can press ctrl and d to do this
00:01:05
move it out of the hierarchy so we can
00:01:07
work on it
00:01:08
now unparent the legs
00:01:12
and the arms
00:01:16
and the pelvis
00:01:18
we don't need the root or cog joints so
00:01:20
delete those
00:01:24
you can also delete the head and eye
00:01:26
joints
00:01:28
and the clavicle joints
00:01:30
now let's hide the main skeleton
00:01:38
let's quickly remove these from the bind
00:01:41
joint selection set
00:01:43
they are in here because these are
00:01:44
duplicates of the main skeleton
00:01:47
we can just right click on the selection
00:01:48
set
00:01:49
and go to sets
00:01:52
remove from selection set
00:01:54
and then select buying joints
00:01:59
that's better
00:02:01
we don't want those accidentally being
00:02:02
selected and skinned
00:02:05
okay now we need to simplify the limbs
00:02:12
we don't need the finger joints so
00:02:14
delete those
00:02:16
and also remove the twist joints
00:02:23
let's update the other arm
00:02:33
with the legs we are going to keep the
00:02:35
toe joints for now
00:02:37
this is so we can blend between ik and
00:02:39
fk with them something we don't need to
00:02:42
do with the fingers
00:02:43
not on this rig anyway
00:02:46
we do need to remove the twist joints
00:02:47
though
00:02:59
so there we have the main areas of the
00:03:01
skeleton
00:03:02
let's change the color of them because
00:03:04
they still have the color coding from
00:03:06
when they were originally skinned
00:03:08
we can do this with the wireframe color
00:03:10
tool
00:03:11
select the root joint of each hierarchy
00:03:15
and go to display wireframe colour
00:03:20
if we click default
00:03:23
you see the joint colours have now been
00:03:25
removed and they are back to the default
00:03:27
colour
00:03:29
we could however give them a new colour
00:03:32
purple maybe
00:03:35
okay that looks good
00:03:37
you can also change this drop down box
00:03:39
from index to rgb so you can specify a
00:03:42
custom colour instead
00:03:44
this is exactly the same as if you were
00:03:46
dictating a color for a control
00:03:49
now we need to rename these joints
00:03:52
firstly so there are no name clashes in
00:03:54
this rig but also so we know what these
00:03:57
joints are used for
00:03:59
let's update the right side first
00:04:01
so select the right arm and leg
00:04:04
and go to modify search and replace
00:04:06
names
00:04:08
we can use this tool to quickly search
00:04:10
through the hierarchy and replace part
00:04:12
of each name so we could search for
00:04:15
underscore r
00:04:17
and simply replace that with underscore
00:04:19
r underscore ik
00:04:22
essentially tagging these as the ik
00:04:24
joints
00:04:25
because we had it set to hierarchy all
00:04:28
the child joints are updated now too
00:04:31
let's update the left side now
00:04:34
so search for underscore l
00:04:37
and replace with underscore l underscore
00:04:40
ik
00:04:42
that's done
00:04:44
with the spine we will just go through
00:04:46
and rename manually because we have
00:04:48
nothing we can use to replace at the end
00:04:50
of each name
00:04:52
so those are the ik joints
00:04:55
select them and duplicate them so we can
00:04:57
create the fk joints
00:05:00
these now have ik one on the end so
00:05:03
let's rename that first
00:05:05
so replace underscore ik one
00:05:09
with underscore fk
00:05:15
and now we can update the child joints
00:05:25
okay let's group these temporarily so we
00:05:28
can clean up the outliner
00:05:35
so there we have our fk group and an ik
00:05:38
group
00:05:39
okay let's look at the arms first so
00:05:41
bring back the arm controls
00:05:45
and move these skeletons apart for now
00:05:56
let's change the color of the fk arms so
00:05:58
they look different
00:06:04
maybe yellow
00:06:12
uh actually blue
00:06:15
okay that will do for now
00:06:19
so we need the skinned skeleton back now
00:06:24
what we are going to do first is make
00:06:25
sure the arms control joints follow the
00:06:28
arm root joint
00:06:30
this means the animator can use the
00:06:32
control to reposition the arm if needed
00:06:35
and this will eventually also drive the
00:06:37
clavicle too
00:06:39
first we need to clean this control so
00:06:41
all the translate and rotate values are
00:06:43
set to zero
00:06:44
we can do this quickly as we did before
00:06:47
by simply moving these attributes down
00:06:49
to the transform offset parent matrix
00:06:51
attributes
00:06:53
now i'm going to cheat and use a small
00:06:55
script i created to do this for me and
00:06:58
these will be available as part of the
00:07:00
course
00:07:01
i will actually probably package them up
00:07:03
in a nice ui for you too so you don't
00:07:05
need to access them on the shelf
00:07:08
so i just click this
00:07:11
and there we go the attributes are moved
00:07:15
so we don't need to use an offset group
00:07:17
here which is good
00:07:22
so now we do need a group
00:07:24
press control and g to create an empty
00:07:26
group
00:07:27
and rename it to arm underscore group
00:07:31
it's good practice to give each element
00:07:33
a recognizable name
00:07:35
like here i've used underscore grp
00:07:39
this just means later in the rigging
00:07:41
process if i want to quickly select and
00:07:43
lock all the groups i can just search
00:07:45
for underscore grp
00:07:48
like previously when we were using
00:07:50
offset groups i could just then search
00:07:52
for underscore offset and quickly lock
00:07:54
them all at once
00:07:57
at the moment the arm group is down here
00:07:59
so we need to reposition it so it
00:08:01
matches the arm root control
00:08:03
add the control to the selection
00:08:06
and go to modify
00:08:07
match transformations match all
00:08:09
transforms
00:08:13
that's now jumped up here
00:08:16
again we're going to clean up those
00:08:17
transforms using the offset parent
00:08:19
matrix attributes
00:08:24
what we now need is for the new group to
00:08:26
follow the root control
00:08:29
we could simply parent the group to it
00:08:32
but i prefer to keep my systems separate
00:08:34
where possible
00:08:36
so we don't want joints nestled under
00:08:38
controls
00:08:40
open the node editor
00:08:45
and bring in the root control
00:08:48
and let's remove those shape nodes
00:08:51
ah we should add an l into the name so
00:08:54
we know that this is for the left arm
00:08:56
and bring that into the node editor too
00:09:00
open these
00:09:03
usually we would use a constraint to
00:09:05
make the group follow the control but we
00:09:08
can do something much simpler and more
00:09:10
effective
00:09:11
all you need to do is take the world
00:09:13
matrix 0 attribute from the arm root
00:09:15
control
00:09:17
and connect it to the arm groups offset
00:09:20
parent matrix attribute
00:09:25
we can now move the control and the
00:09:27
group followers
00:09:30
let's move the arm control joints under
00:09:33
the new group
00:09:40
so you see we can now position the whole
00:09:42
arm
00:09:47
what we need now is for the skinned arm
00:09:49
to follow the control arms
00:09:52
we also want to be able to blend between
00:09:54
the two so the animator can work in
00:09:56
either forward or inverse kinematics
00:10:00
now with this being a game rig we can't
00:10:02
use the matrix attributes or nodes
00:10:05
not currently anyway but i hear that
00:10:07
there may be a solution for this coming
00:10:09
up in a future release
00:10:12
let me explain why
00:10:14
so here we have two joints and each is
00:10:16
being controlled by a nurbs circle
00:10:20
the first is connected using a
00:10:22
constraint
00:10:26
the second is connected using the offset
00:10:28
parents matrix attributes just like we
00:10:31
did with our root control
00:10:34
let me show you
00:10:46
so here we have the connection just the
00:10:48
same as we did with the arm root control
00:11:07
here we have the constraint
00:11:12
just remove these
00:11:17
and open these
00:11:19
so you can see how much more complicated
00:11:21
constraints can be
00:11:23
but just because we have the matrix
00:11:25
nodes it doesn't make the constraints
00:11:27
redundant
00:11:28
we still need them in our lives
00:11:31
okay these have some simple animation on
00:11:34
them animation which needs to be baked
00:11:36
and sent to unreal engine
00:11:38
so the animator has animated the scene
00:11:45
all we need to do is select the joints
00:11:47
and go to edit
00:11:49
keys bake simulation to bake the
00:11:52
animation onto the joints all ready for
00:11:54
export
00:11:58
now that's baked the animation onto the
00:12:00
joints
00:12:01
if we scrub the time slider everything
00:12:03
seems fine
00:12:05
we have all the keys here
00:12:10
let's delete the controls
00:12:13
and let's try that again
00:12:19
so now you see that only the joint which
00:12:21
was connected with a constraint has
00:12:24
retained the animation
00:12:26
this is because the constraint passes
00:12:28
translation values to the main
00:12:30
attributes
00:12:31
which are then baked
00:12:34
with the offset parent matrix connection
00:12:37
no values actually appear here so
00:12:39
nothing is there to be baked
00:12:42
so with our rig you need the control
00:12:44
joints to drive the skin joints using
00:12:47
constraints so we can retain the
00:12:49
animation information
00:12:51
although you can use other nodes like
00:12:53
the blend colours nodes if you prefer
00:12:56
this will simply blend between two sets
00:12:58
of attributes and there are videos
00:13:00
available online which showcase this
00:13:02
option
00:13:04
okay back to our rig
00:13:06
select the upper arm control joints
00:13:09
and then the skinned joint
00:13:11
we don't want the twist joints at this
00:13:13
point so select the main joints for now
00:13:16
now go to constraint parent
00:13:21
disable maintain offset because we want
00:13:24
the skinned arm to move to the other
00:13:26
positions
00:13:27
and apply that
00:13:29
now do the same with the lower arm
00:13:34
and finally the hand
00:13:46
here we have those constraints
00:13:51
and you can see the weights in the
00:13:53
channel box
00:13:55
so the hand will blend between the ik
00:13:57
and fk hand joints
00:13:59
they currently both have a value of 1
00:14:02
which is why the hand is floating
00:14:03
between them
00:14:05
if i reduce the fk weight to 0
00:14:08
the hand joint now moves over the ik
00:14:10
joint
00:14:12
if i do the opposite
00:14:15
the hand now moves over the fk arm
00:14:18
so we can use these values to let the
00:14:19
animator blend between ik and fk
00:14:24
let's open the node editor
00:14:28
and select the left arm control
00:14:32
so this is where the ik fk switch
00:14:34
attribute comes into play
00:14:37
let's bring that into the node editor
00:14:40
and open it you can press three to
00:14:42
quickly open a node
00:14:44
there we have the attribute
00:14:46
we now need the three constraints so
00:14:48
select those
00:14:50
and bring them into the node editor
00:14:52
we don't need to open these
00:14:58
now connect the ik fk switch attribute
00:15:01
to each constraints fk weight attribute
00:15:05
hand fk
00:15:11
lower arm fk
00:15:18
and upper arm fk
00:15:20
the arm has now snapped to the ik arm
00:15:23
because the ik fk switch attribute is
00:15:25
set to zero
00:15:27
if we set it to one
00:15:30
the arm goes back to floating between
00:15:32
the two control arms
00:15:34
this is because the ik weights are still
00:15:36
set to one
00:15:38
no matter what we set the fk weights to
00:15:40
so we need to update those two
00:15:43
what we need is for the ik weights to be
00:15:46
the opposite of the fk ones
00:15:49
so when fk is set to 1 ik is 0 and vice
00:15:53
versa
00:15:54
we can achieve this with another node
00:15:57
press tab and start to type reverse
00:16:01
create a reverse node
00:16:03
this will take a value and reverse it so
00:16:05
we can use it to invert the ik fk switch
00:16:08
value
00:16:09
rename this to arm ik fk reverse
00:16:14
now the node editor and its many nodes
00:16:16
can be quite intimidating so i would
00:16:18
recommend checking out my video on the
00:16:20
node editor over on my channel where i
00:16:22
offer an explanation on how it works
00:16:26
essentially we have three input
00:16:27
attributes here
00:16:29
and also three output attributes
00:16:32
we just need one for now
00:16:34
so connect ik fk switch to input x
00:16:42
and then output x to each ik weight
00:16:45
attribute on the constraint nodes
00:16:51
the arm has now snapped to the ik
00:16:53
control arm
00:16:57
we can now use the ik fk switch
00:16:59
attribute to blend between the two
00:17:06
what's more we can also use the proxy
00:17:08
attributes we added to also control the
00:17:10
blending
00:17:12
while we have these nodes here let's
00:17:14
make them work a little harder
00:17:16
remove the constraints from the editor
00:17:19
and now bring in the ik and fk text
00:17:23
what we can do is use the same
00:17:24
attributes to also show and hide these
00:17:31
connect the ik fk switch attribute to
00:17:34
the fk text's visibility attributes
00:17:38
do this for both the f and the k
00:17:41
and now the output x attribute from the
00:17:43
reverse node
00:17:45
to the ik icon's visibility attributes
00:17:48
so the i and the k
00:17:54
now as we switch the text changes so the
00:17:56
animator gets a visual representation of
00:17:59
what state that limb is currently in
00:18:02
it's a small thing but it can help when
00:18:04
it comes to animation and in particular
00:18:07
navigating the rig and the scene
00:18:11
so we now have the control joints set up
00:18:13
for the left arm
00:18:15
we compose the fk arm and the skinned
00:18:17
model will happily blend to it from the
00:18:20
ik arm
00:18:24
all we need to do now is move the
00:18:25
control arms back into position
00:18:28
so select the root of each
00:18:33
and then the root control
00:18:35
and use the match transformations tool
00:18:37
to move them back into position
00:18:45
the whole arm now moves with the root
00:18:47
control
00:18:50
and we can blend between the two
00:18:55
now we aren't going to go further with
00:18:57
this arm rig at this stage
00:18:59
for now we are just setting up all the
00:19:01
control joints so the main skeleton will
00:19:04
move with them
00:19:09
now we are done with the arm let's move
00:19:11
it into the rig systems group
00:19:15
so for the right arm it's exactly the
00:19:17
same process so i'm not going to go over
00:19:20
all that again
00:19:21
instead let's have a quick look at the
00:19:23
legs
00:19:24
and again this is pretty much the same
00:19:26
too
00:19:28
so first clean up the transforms on the
00:19:30
root control
00:19:32
just moving the values down to the
00:19:33
transform offset parent matrix tab
00:19:36
or use the script if you have it
00:19:39
that's done
00:19:42
now create an empty group and call it
00:19:44
leg left group
00:19:49
and reposition that so it matches the
00:19:51
root control
00:19:55
also clean up the attributes too
00:20:01
those values are down here now
00:20:06
now open the node editor
00:20:10
actually before i clear this
00:20:13
because it has three inputs you can use
00:20:15
the same reverse node for the right arm
00:20:18
simply use the input y and output y
00:20:20
attributes instead
00:20:22
there's no point adding another node
00:20:24
when you can share them
00:20:26
okay
00:20:27
now that's out of the way let's clear
00:20:29
this
00:20:30
and bring the leg root control and the
00:20:32
leg group in
00:20:37
and open these
00:20:41
just as we did with the arm connect
00:20:42
world space 0 to offset parent matrix
00:20:49
so the group now moves with the control
00:20:53
we now need to parent constrain the skin
00:20:55
skeleton to the control joints
00:21:00
remember to disable maintain offset
00:21:04
now the knee
00:21:09
and the calf
00:21:12
and now the foot
00:21:21
we also need to connect the toe joints
00:21:23
too so go through and constrain those
00:21:26
a quick way to work through these is to
00:21:28
press g to repeat the parent constraint
00:21:32
and then simply pick walk down the
00:21:34
hierarchy
00:21:35
and press g again
00:21:38
so we have lots of constraints now let's
00:21:41
organize this a little better
00:21:47
and bring in the main leg control
00:21:54
now connect the ik fk switch attribute
00:21:56
to each constraint fk weight attribute
00:22:09
okay that's done
00:22:11
now we need another reverse node so
00:22:13
press tab and create one
00:22:19
oops just bring those back in
00:22:23
okay
00:22:24
call this leg ik fk reverse
00:22:27
again we can use this for both the left
00:22:29
and right legs
00:22:33
bring the control back
00:22:40
so ik fk switch goes into input x
00:22:47
and output x goes into each constraint
00:22:50
node's ik weight attribute
00:23:11
we can now blend between the two control
00:23:13
legs
00:23:17
okay let's update the text now so it
00:23:18
represents which leg is being used
00:23:22
remove the constraint nodes
00:23:26
and bring in the text curves
00:23:33
now connect ikfk switch to the
00:23:36
visibility attributes on the fk text
00:23:39
curves
00:23:42
and the output x attribute from the
00:23:43
reverse node to the ik text's visibility
00:23:46
attributes
00:23:58
okay great that works
00:24:04
all we need to do now is move the leg
00:24:06
control groups into the leg left group
00:24:10
and snap them back into position so they
00:24:12
all lie in the same space
00:24:16
okay done
00:24:18
let's move the main group now into the
00:24:20
rig systems group
00:24:23
okay that's the control joint set up for
00:24:26
the left arm and leg
00:24:27
and we can blend between ik and fk
00:24:31
as mentioned earlier the process is
00:24:33
exactly the same for the opposite leg
00:24:35
and arm
00:24:36
you can also apply the same technique to
00:24:39
the spine too
00:24:41
with this instead of using the root
00:24:42
control you can use the cog control as
00:24:45
the main position control for the spine
00:24:48
okay i'm going to update all those now
00:24:51
and i will back in a few seconds
00:24:54
right that was quick
00:24:57
so here we have all the control limbs
00:24:59
and the spine set up
00:25:01
if i just move the ik joints back
00:25:10
you see he follows
00:25:18
we can use the ik fk switch attributes
00:25:20
to blend back to fk2 when needed
00:25:30
you can see the spine follows the cog
00:25:32
control
00:25:33
just like the limbs follow their root
00:25:35
controls
00:25:36
i also updated the cog control so it has
00:25:39
the same attributes as the main ik
00:25:41
controls too because we will need these
00:25:43
options for the spine
00:25:46
we can also blend between ik and fk with
00:25:48
the spine
00:25:50
okay so that's the control joint set up
00:25:53
and ready for the main controls
00:25:56
so in the next video let's start
00:25:57
building the main systems
00:26:22
you