5,389
edits
mNo edit summary |
(whoops) |
||
Line 38: | Line 38: | ||
As a final touch, since we will be adapting the character to the UE4 rig, we should rotate the feet inwards a bit, and make sure that the LeftFoot and RightFoot bones point straight down. We also want to put the model into an "Empty" scaled by 0.01 (to accommodate UE4's units, i.e., centimeters). If we do that, we notice that Lara is 7.52m tall, so we scale her down 4 times, getting a more realistic 188 cm. | As a final touch, since we will be adapting the character to the UE4 rig, we should rotate the feet inwards a bit, and make sure that the LeftFoot and RightFoot bones point straight down. We also want to put the model into an "Empty" scaled by 0.01 (to accommodate UE4's units, i.e., centimeters). If we do that, we notice that Lara is 7.52m tall, so we scale her down 4 times, getting a more realistic 188 cm. | ||
After you do all the above, you should have something like this: http://geyser.oni2.net/UE4/LaraAfterStep2.blend (the dummy leaf bones added to the toes, fingertips and head top are optional - if you have those, then the actual leaf bones will roundtrip better through FBX; otherwise their length and roll value may change arbitrarily - possibly a bug of Blender) | After you do all the above, you should have something like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraAfterStep2.blend (the dummy leaf bones added to the toes, fingertips and head top are optional - if you have those, then the actual leaf bones will roundtrip better through FBX; otherwise their length and roll value may change arbitrarily - possibly a bug of Blender) | ||
==Constrain the rotation to the straight T-Pose== | ==Constrain the rotation to the straight T-Pose== | ||
The Konoko from Oni (and, to a lesser extent, Mixamo's own X-bot) come with a very straightened-up T-Pose, where all the bones are aligned with world axes (so, very much unlike Lara, whose T-Pose is a bit casual, with non-vertical legs, curled fingers etc). To adjust Lara's size and proportions to Konoko's (and then to conveniently match the bones to the UE4 rig), we will need to put Lara into a similar "straight" T-Pose first. In Blender, this is done by adding "copy rotation" constraints to a skeleton's bones. | The Konoko from Oni (and, to a lesser extent, Mixamo's own X-bot) come with a very straightened-up T-Pose, where all the bones are aligned with world axes (so, very much unlike Lara, whose T-Pose is a bit casual, with non-vertical legs, curled fingers etc). To adjust Lara's size and proportions to Konoko's (and then to conveniently match the bones to the UE4 rig), we will need to put Lara into a similar "straight" T-Pose first. In Blender, this is done by adding "copy rotation" constraints to a skeleton's bones. | ||
Set up some Empty objects that have the appropriate axis-aligned orientations for the appropriate subgroups of the skeleton: one for the spine (Y up, X left), one for the legs (Y down, X right), one for the left arm (Y left, X back), one for the right arm (Y right, X forward), one for the left thumb (Y left, X up) and one for the right thumb (Y right, X down). It should look like this: http://geyser.oni2.net/UE4/LaraStep3axes.blend | Set up some Empty objects that have the appropriate axis-aligned orientations for the appropriate subgroups of the skeleton: one for the spine (Y up, X left), one for the legs (Y down, X right), one for the left arm (Y left, X back), one for the right arm (Y right, X forward), one for the left thumb (Y left, X up) and one for the right thumb (Y right, X down). It should look like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep3axes.blend | ||
Then go into Pose mode for Lara's armature, select a bone, then in the "Properties" editor panel choose "Bone constraints". Click "Add Bone Constraint", select "Transform/Copy Rotation" from the dropdown, then in the "Target" field pick the Empty with the appropriate orientation. To speed up for the remaining bones of the same orientation group, you can select all the remaining bones of that group while keeping the first bone active (this can be done with the Ctrl+LMB lasso tool), then go to Pose/Constraints and click "Copy constraints to selected bones". After you're done straightening Lara, you should have something like this: http://geyser.oni2.net/UE4/LaraStep3straight.blend | Then go into Pose mode for Lara's armature, select a bone, then in the "Properties" editor panel choose "Bone constraints". Click "Add Bone Constraint", select "Transform/Copy Rotation" from the dropdown, then in the "Target" field pick the Empty with the appropriate orientation. To speed up for the remaining bones of the same orientation group, you can select all the remaining bones of that group while keeping the first bone active (this can be done with the Ctrl+LMB lasso tool), then go to Pose/Constraints and click "Copy constraints to selected bones". After you're done straightening Lara, you should have something like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep3straight.blend | ||
You may have noticed that the spine of Lara's casual pose was actually mostly straight to begin with: it just leans backwards a bit and then bends forwards again starting at the neck. So mostly we are just straightening the leg chains, the shoulder-arm chains, and the fingers. | You may have noticed that the spine of Lara's casual pose was actually mostly straight to begin with: it just leans backwards a bit and then bends forwards again starting at the neck. So mostly we are just straightening the leg chains, the shoulder-arm chains, and the fingers. | ||
==Match the size and proportions to Konoko== | ==Match the size and proportions to Konoko== | ||
Now we import HD Konoko, for example from [http://geyser.oni2.net/UE4/KonokoHD.zip HERE] and use her as a template for Lara's proportions. The first thing to do is "Apply rotation" for Konoko's pelvis (so that we can move her around intuitively) and then shift it upwards by about 0.89, so that the soles of Lara's feet (in the straightened T-Pose) coincide with the inside of Konoko's boots. Conveniently, the non-reflective parts of Konoko's outfit appear transparent in Material mode, so Lara's feet inside Konoko's boots are clearly visible. You can shift Konoko forward by 0.05 or so as well. | Now we import HD Konoko, for example from [http://geyser.oni2.net/UE4/LaraTutorial/KonokoHD.zip HERE] and use her as a template for Lara's proportions. The first thing to do is "Apply rotation" for Konoko's pelvis (so that we can move her around intuitively) and then shift it upwards by about 0.89, so that the soles of Lara's feet (in the straightened T-Pose) coincide with the inside of Konoko's boots. Conveniently, the non-reflective parts of Konoko's outfit appear transparent in Material mode, so Lara's feet inside Konoko's boots are clearly visible. You can shift Konoko forward by 0.05 or so as well. | ||
Now we rotate Konoko's arms by 90° (getting her into the same T-Pose as Lara), and set the scale of Lara's armature to about 0.86, so that her arms are vertically aligned with Konoko's. This is what you get after you do this basic superposition, adjust Lara's scale to 0.86 and apply it: http://geyser.oni2.net/UE4/LaraStep4match1.blend | Now we rotate Konoko's arms by 90° (getting her into the same T-Pose as Lara), and set the scale of Lara's armature to about 0.86, so that her arms are vertically aligned with Konoko's. This is what you get after you do this basic superposition, adjust Lara's scale to 0.86 and apply it: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep4match1.blend | ||
We notice that Lara's body cannot be fit under Konoko's armor just by moving the two characters around, but it can be managed with some extra rotations of the spine segments. The different layout of the skeleton is also clearly visible: Konoko's spine goes through the center of the neck cylinder, whereas Lara's is further towards the back, where the actual spinal column would be. These observation may become important later if we want to fine-tune the character's rest pose, and more specifically the neutral shape of the spine that works best for all of Oni's animations (movement, combat, etc). For now, though, we are mainly concerned with the length of the arms and the relative length of their segments. For Konoko's armor to work on the new character, we clearly need to move Lara's shoulders outwards, make the shoulder bones longer, and bring the elbow closer to the hand (i.e., make the upper arm longer and the forearm shorter). | We notice that Lara's body cannot be fit under Konoko's armor just by moving the two characters around, but it can be managed with some extra rotations of the spine segments. The different layout of the skeleton is also clearly visible: Konoko's spine goes through the center of the neck cylinder, whereas Lara's is further towards the back, where the actual spinal column would be. These observation may become important later if we want to fine-tune the character's rest pose, and more specifically the neutral shape of the spine that works best for all of Oni's animations (movement, combat, etc). For now, though, we are mainly concerned with the length of the arms and the relative length of their segments. For Konoko's armor to work on the new character, we clearly need to move Lara's shoulders outwards, make the shoulder bones longer, and bring the elbow closer to the hand (i.e., make the upper arm longer and the forearm shorter). | ||
Line 61: | Line 61: | ||
*on second thought, scale the shoulder bones by 1.25 along all axes, to add some muscle; | *on second thought, scale the shoulder bones by 1.25 along all axes, to add some muscle; | ||
*and scale the upper arm bones by 1.125 along X and Z, too, otherwise the arms look thin. | *and scale the upper arm bones by 1.125 along X and Z, too, otherwise the arms look thin. | ||
After all these arm adjustments are done, you should get something like this: http://geyser.oni2.net/UE4/LaraStep4match2.blend | After all these arm adjustments are done, you should get something like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep4match2.blend | ||
Apart from Lara's shoulders being a bit too far back and her fingers being a bit short compared to Konoko's, this looks satisfactory. | Apart from Lara's shoulders being a bit too far back and her fingers being a bit short compared to Konoko's, this looks satisfactory. | ||
==Matching the UE4 mannequin's A-pose== | ==Matching the UE4 mannequin's A-pose== | ||
We now want to put Lara in the exact same pose as the UE4 mannequin, i.e., with the exact same global orientations of all the bones (except maybe the clavicles and the spine). For that we will need a version of the UE4 mannequin where the bone axes have been redefined by analogy with the Mixamo rig, so that they look sensible when manipulated in Blender. Here is an FBX I made: http://geyser.oni2.net/UE4/MannequinToMixamo.fbx | We now want to put Lara in the exact same pose as the UE4 mannequin, i.e., with the exact same global orientations of all the bones (except maybe the clavicles and the spine). For that we will need a version of the UE4 mannequin where the bone axes have been redefined by analogy with the Mixamo rig, so that they look sensible when manipulated in Blender. Here is an FBX I made: http://geyser.oni2.net/UE4/LaraTutorial/MannequinToMixamo.fbx | ||
The first thing to do is remove the rotation constraints of the "straight T-Pose" that we used in the previous step. You do that by selecting Lara's armature, then selecting all bones, and doing "Pose/Constraints/Clear pose constraints". After you do that, hide the HD Konoko, and import the mannequin's FBX, you should have this: http://geyser.oni2.net/UE4/LaraStep5initial.blend | The first thing to do is remove the rotation constraints of the "straight T-Pose" that we used in the previous step. You do that by selecting Lara's armature, then selecting all bones, and doing "Pose/Constraints/Clear pose constraints". After you do that, hide the HD Konoko, and import the mannequin's FBX, you should have this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep5initial.blend | ||
(I renamed the mannequin's armature to "_root" for convenience in the next step) | (I renamed the mannequin's armature to "_root" for convenience in the next step) | ||
Now, select Lara's armature, pick any bone, and create a "Copy rotation" constraint for it, with the corresponding bone of the mannequin's armature as the Target. The procedure is the same as for the straightened T-Pose we did earlier, except that the rotation is taken from the bone of an armature rather than from a top-level "Axes*" object. So first we pick "_root" as the target, and then look up the correct bone under the "Bone:" field that appears when you select "_root" as "Target:". Autocompletion works, so start typing the name of the bone and it will narrow down the list. Do not constrain the spine and the shoulder/clavicle bones, because they look fine as they are, and their default relationship is too different between the two characters. Once you are done constraining Lara's pose, you should have something like this: http://geyser.oni2.net/UE4/LaraStep5match1.blend | Now, select Lara's armature, pick any bone, and create a "Copy rotation" constraint for it, with the corresponding bone of the mannequin's armature as the Target. The procedure is the same as for the straightened T-Pose we did earlier, except that the rotation is taken from the bone of an armature rather than from a top-level "Axes*" object. So first we pick "_root" as the target, and then look up the correct bone under the "Bone:" field that appears when you select "_root" as "Target:". Autocompletion works, so start typing the name of the bone and it will narrow down the list. Do not constrain the spine and the shoulder/clavicle bones, because they look fine as they are, and their default relationship is too different between the two characters. Once you are done constraining Lara's pose, you should have something like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep5match1.blend | ||
Double-check the constraints (since this is manual work, it is easy to accidentally assign the wrong target bone), and examine Lara's pose with the armatures hidden - is it really the same as the mannequin's A-Pose? Upon close examination, you will see that the final segments of the fingers look weird: the mannequin's mesh has straight fingers, but in our matched pose they are not. That's because the mannequin's rig is imperfect and, specifically, the final segments of the fingers are not aligned with the actual fingertips of the mesh. Our concern, though, is that the ''mesh'' of the A-Posed Lara should look the same as the A-posed mannequin, so we should straighten up her fingers for the reference pose. We do that by constraining the fingertip bones not to their exact counterparts, but to the previous segments. This is what it looks like when corrected (with the armatures and mannequin mesh hidden): http://geyser.oni2.net/UE4/LaraStep5match2.blend | Double-check the constraints (since this is manual work, it is easy to accidentally assign the wrong target bone), and examine Lara's pose with the armatures hidden - is it really the same as the mannequin's A-Pose? Upon close examination, you will see that the final segments of the fingers look weird: the mannequin's mesh has straight fingers, but in our matched pose they are not. That's because the mannequin's rig is imperfect and, specifically, the final segments of the fingers are not aligned with the actual fingertips of the mesh. Our concern, though, is that the ''mesh'' of the A-Posed Lara should look the same as the A-posed mannequin, so we should straighten up her fingers for the reference pose. We do that by constraining the fingertip bones not to their exact counterparts, but to the previous segments. This is what it looks like when corrected (with the armatures and mannequin mesh hidden): http://geyser.oni2.net/UE4/LaraTutorial/LaraStep5match2.blend | ||
Finally, we need to apply the constrained A-Pose as a new rest pose. Although intuitively it is a single operation, it is done in several steps. First, select Lara's mesh, and in the toolbox pick the Modifiers panel (with a wrench icon), then click Apply (this will deform Lara's mesh according to the rotations, scales and translations we set up for the armature, and the armature will no longer affect the mesh). Next, select the armature, go to Pose mode, select all of the bones, and do "Pose/Apply/Apply pose as rest pose". This will set the default transforms of the bones to the current posed ones, so that constraints will no longer be needed, and the information about the original shape of the armature will be lost. Last of all, you select Lara's mesh again, pick the Modifiers panel, and click "Add Modifier", pick Armature, and select Lara's armature (which was disconnected when we applied the modifier to the mesh). As for the constraints, we can now select Lara's armature, go to Pose mode, and do "Pose/Constraints/Clear pose constraints". Here is how it looks after all the above is done: http://geyser.oni2.net/UE4/LaraStep5newrest.blend | Finally, we need to apply the constrained A-Pose as a new rest pose. Although intuitively it is a single operation, it is done in several steps. First, select Lara's mesh, and in the toolbox pick the Modifiers panel (with a wrench icon), then click Apply (this will deform Lara's mesh according to the rotations, scales and translations we set up for the armature, and the armature will no longer affect the mesh). Next, select the armature, go to Pose mode, select all of the bones, and do "Pose/Apply/Apply pose as rest pose". This will set the default transforms of the bones to the current posed ones, so that constraints will no longer be needed, and the information about the original shape of the armature will be lost. Last of all, you select Lara's mesh again, pick the Modifiers panel, and click "Add Modifier", pick Armature, and select Lara's armature (which was disconnected when we applied the modifier to the mesh). As for the constraints, we can now select Lara's armature, go to Pose mode, and do "Pose/Constraints/Clear pose constraints". Here is how it looks after all the above is done: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep5newrest.blend | ||
==Replacing the head== | ==Replacing the head== | ||
Lara is now nearly ready for UE4, and it is finally time to remove Lara's head and attach Konoko's. The easiest way to do this is to disconnect Lara's head along an edge loop at the top of the neck, and then delete everything that's not connected to the body. After you do that, and unhide Konoko's head, you get this: http://geyser.oni2.net/UE4/LaraStep6severed1.blend (pun half intended) | Lara is now nearly ready for UE4, and it is finally time to remove Lara's head and attach Konoko's. The easiest way to do this is to disconnect Lara's head along an edge loop at the top of the neck, and then delete everything that's not connected to the body. After you do that, and unhide Konoko's head, you get this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep6severed1.blend (pun half intended) | ||
We see that Lara's neck is uncannily thin and short - that's because Lara's character was originally much taller and less muscular. The best way to fix this is by scaling the neck bone, without letting the scale affect the head bone. As a reference, the cylinder/cone that makes up the original Konoko's neck is about 8.5574cm across and 8.8701cm front-to-back at the thickest point (base of the neck), whereas for the current A-posed Lara we have roughly 6.962cm across. A scale of 1.6 lengthwise (Y) and sidewise (X) for Lara's neck seems to work well (never mind if the bra strap starts looking weird, we are planning to fix it later anyway): http://geyser.oni2.net/UE4/LaraStep6severed2.blend | We see that Lara's neck is uncannily thin and short - that's because Lara's character was originally much taller and less muscular. The best way to fix this is by scaling the neck bone, without letting the scale affect the head bone. As a reference, the cylinder/cone that makes up the original Konoko's neck is about 8.5574cm across and 8.8701cm front-to-back at the thickest point (base of the neck), whereas for the current A-posed Lara we have roughly 6.962cm across. A scale of 1.6 lengthwise (Y) and sidewise (X) for Lara's neck seems to work well (never mind if the bra strap starts looking weird, we are planning to fix it later anyway): http://geyser.oni2.net/UE4/LaraTutorial/LaraStep6severed2.blend | ||
Before we work on the mesh further, we need to apply that extra 1.6 scale to the neck, with another round of "apply modifier to mesh"/"apply transforms to armature's bones"/"add the armature modifier back to the mesh" like we did above when setting the new rest pose. After you've applied the neck scale, you should have this: http://geyser.oni2.net/UE4/LaraStep6severed3.blend | Before we work on the mesh further, we need to apply that extra 1.6 scale to the neck, with another round of "apply modifier to mesh"/"apply transforms to armature's bones"/"add the armature modifier back to the mesh" like we did above when setting the new rest pose. After you've applied the neck scale, you should have this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep6severed3.blend | ||
The vertices at the top of the neck tube now need to be brought closer to Konoko's head. We don't need to connect the two geometries exactly, instead we just want to make the tube nice and smooth, and not too wide, so that it enters the head mesh from below, without too much clipping. We also want to manipulate the vertices in pairs, so as not to break the symmetry. After you're done with that, it should look like this: http://geyser.oni2.net/UE4/LaraStep6stitched.blend | The vertices at the top of the neck tube now need to be brought closer to Konoko's head. We don't need to connect the two geometries exactly, instead we just want to make the tube nice and smooth, and not too wide, so that it enters the head mesh from below, without too much clipping. We also want to manipulate the vertices in pairs, so as not to break the symmetry. After you're done with that, it should look like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep6stitched.blend | ||
Finally we merge the two meshes (Lara's body and Konoko's head). There is a preliminary task that needs to be taken care of first: namely, the UV map for Konoko's head (originally "head_texcoord" )needs to be renamed to the same (default) name as used by Lara ("UVMap"). Only then will the materials of the two meshes be merged properly. Once the UV map of the head mesh is renamed, select the head mesh, then Shift-click the body, and do Ctrl+J to "join". Delete the rest of Konoko's hierarchy since we don't need it any more, and you should get this: http://geyser.oni2.net/UE4/LaraStep6united.blend | Finally we merge the two meshes (Lara's body and Konoko's head). There is a preliminary task that needs to be taken care of first: namely, the UV map for Konoko's head (originally "head_texcoord" )needs to be renamed to the same (default) name as used by Lara ("UVMap"). Only then will the materials of the two meshes be merged properly. Once the UV map of the head mesh is renamed, select the head mesh, then Shift-click the body, and do Ctrl+J to "join". Delete the rest of Konoko's hierarchy since we don't need it any more, and you should get this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep6united.blend | ||
At this point the head is not yet weighted to the skeleton. So we complete the process by selecting the head mesh (select any part of it, then grow the selection) and assigning it to the vertex group mixamorig:Head. The resulting model, with the rest of Konoko deleted, is here: http://geyser.oni2.net/UE4/LaraStep6weighted.blend | At this point the head is not yet weighted to the skeleton. So we complete the process by selecting the head mesh (select any part of it, then grow the selection) and assigning it to the vertex group mixamorig:Head. The resulting model, with the rest of Konoko deleted, is here: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep6weighted.blend | ||
==Reorienting the bone axes according to UE4's conventions== | ==Reorienting the bone axes according to UE4's conventions== | ||
The model so far can have some imperfections that we may want to fix (leftover symmetry issues, mesh layout that was messed up a bit when we scaled the bones, too much detail for the underwear, chest size, weight mapping of the breasts) but for now we just want to export this model so that it can be used in UE4. It is already in the exact same A-pose as the UE4 mannequin, but the bones ''orientations'' do not agree with UE4's conventions. (That's perhaps the least intuitive part: the bones of UE4 skeleton do not have Y as their main axis, whereas Blender's bones are always along Y.) | The model so far can have some imperfections that we may want to fix (leftover symmetry issues, mesh layout that was messed up a bit when we scaled the bones, too much detail for the underwear, chest size, weight mapping of the breasts) but for now we just want to export this model so that it can be used in UE4. It is already in the exact same A-pose as the UE4 mannequin, but the bones ''orientations'' do not agree with UE4's conventions. (That's perhaps the least intuitive part: the bones of UE4 skeleton do not have Y as their main axis, whereas Blender's bones are always along Y.) | ||
For the record, here is an FBX with the mannequin's bones as they are supposed to be: http://geyser.oni2.net/UE4/SK_Mannequin.FBX | For the record, here is an FBX with the mannequin's bones as they are supposed to be: http://geyser.oni2.net/UE4/LaraTutorial/SK_Mannequin.FBX | ||
Unless you have an automated way for rotating bones exactly by 90° in exactly the right direction depending on the bone, this needs to be done manually. There are at least two ways to do this in Blender. | Unless you have an automated way for rotating bones exactly by 90° in exactly the right direction depending on the bone, this needs to be done manually. There are at least two ways to do this in Blender. | ||
Line 116: | Line 116: | ||
===Finalization=== | ===Finalization=== | ||
Whichever way you chose to rotate the bones around, you should have now something like this: http://geyser.oni2.net/UE4/LaraStep7ortho.blend | Whichever way you chose to rotate the bones around, you should have now something like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep7ortho.blend | ||
After renaming all the bones in consistence with UE4's rig it looks like this: http://geyser.oni2.net/UE4/LaraStep7renamed.blend | After renaming all the bones in consistence with UE4's rig it looks like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep7renamed.blend | ||
After adding the extra IK bones (copies of the hand and foot bones), parenting them properly, and removing the leaf bones, it looks like this: http://geyser.oni2.net/UE4/LaraStep7tree.blend | After adding the extra IK bones (copies of the hand and foot bones), parenting them properly, and removing the leaf bones, it looks like this: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep7tree.blend | ||
Finally we just need to check the transformations of all the object (zero translations/rotations and unit scales for everything, except the top-level empty which must have scale 0.01 for the unit change). | Finally we just need to check the transformations of all the object (zero translations/rotations and unit scales for everything, except the top-level empty which must have scale 0.01 for the unit change). | ||
It looks like everything is consistent with the SK_Mannequin from UE4's FBX, so we can try and use her in UE4. | It looks like everything is consistent with the SK_Mannequin from UE4's FBX, so we can try and use her in UE4. | ||
The exported FBX is here: http://geyser.oni2.net/UE4/LaraStep7export.fbx | The exported FBX is here: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep7export.fbx | ||
The same FBX with the textures extracted rather than enmbedded is here: http://geyser.oni2.net/UE4/LaraStep7export.zip | The same FBX with the textures extracted rather than enmbedded is here: http://geyser.oni2.net/UE4/LaraTutorial/LaraStep7export.zip |