Jump to content

Importing character models: Difference between revisions

→‎New models: gally tutorial
m (→‎Blender: note on lightmapping)
(→‎New models: gally tutorial)
Line 115: Line 115:
#First, make sure that the model that you want to import into Oni is split into 19 separate body parts, and that they overlap nicely even under extreme rotations (see below). The "extremes" are something that you can fix later, but you really need the character to be split into 19 body parts. If some of those parts are missing (e.g., [[Barabas]] has no visible shoulder parts), you will still need placeholder meshes (see Barabas as an example). So, get all those meshes ready, alongside each other, at the root of the scene (no hierarchy needed right now).
#First, make sure that the model that you want to import into Oni is split into 19 separate body parts, and that they overlap nicely even under extreme rotations (see below). The "extremes" are something that you can fix later, but you really need the character to be split into 19 body parts. If some of those parts are missing (e.g., [[Barabas]] has no visible shoulder parts), you will still need placeholder meshes (see Barabas as an example). So, get all those meshes ready, alongside each other, at the root of the scene (no hierarchy needed right now).
#Now, load an Oni character exported with OniSplit into the same scene. This character will be your posing figure, so make sure it is similar (in height and "width") to the one that you want to import (i.e., don't use Konoko to match Master Chief, and don't use Barabas to match Gally). Tweak the rotations of the Oni character until it overlaps with the "random" pose of the new character.
#Now, load an Oni character exported with OniSplit into the same scene. This character will be your posing figure, so make sure it is similar (in height and "width") to the one that you want to import (i.e., don't use Konoko to match Master Chief, and don't use Barabas to match Gally). Tweak the rotations of the Oni character until it overlaps with the "random" pose of the new character.
#Sometimes you can't make everything overlap just with rotations, and in that case you have to actually translate bones with respect to their parents. By doing this you are actually modifying the skeleton of the Oni character, bringing it closer to the proportions of the new character. If this is the case, and if you want the new character to use Oni's animations, you will have to make sure that the length of the legs stays roughly the same. If the legs of the new character have about the same length as those of an Oni character (measured between the hip joint and the sole of the feet, or between the pelvis center and the sole of the feet), then the animations may look different, but at least the feet will be in contact with the ground, not above or below.
#Sometimes you can't make everything overlap just with rotations, and in that case you have to actually translate bones with respect to their parents. By doing this you are actually modifying the skeleton of the Oni character, bringing it closer to the proportions of the new character. If this is the case, and if you want the new character to use Oni's animations, you will have to make sure that the length of the legs stays roughly the same. If the legs of the new character have about the same length as those of an Oni character (measured between the hip joint and the sole of the feet, or between the pelvis center and the sole of the feet), then the animations may look a bit different, but at least during basic stances and movements the feet will stay roughly in contact with the ground, not above or below.
#Now, you can inspect the Oni character, which you have posed in a way that is consistent with the random arrangement of the new body parts. The next (and last) step is to ensure that every new part is parented correctly (the thighs to the pelvis, the calves to the thighs, etc), ''and'' that the center of every new body part is placed in the same way as the center of the corresponding body part of the "posed" Oni character. To see the centers of the Oni character, just select all its meshes, and click "Center" in the top right corner, where the selection filters are.
#Now, you can inspect the Oni character, which you have posed in a way that is consistent with the "random" arrangement of the new body parts. Try selecting the body parts of the "posing" Oni character, one at a time, and inspect the values of the translation and rotation of the mesh with respect to its parent (i.e., "Local"), in the "Transform" panel (far right). Try switching to "Center" in the "Select" panel (top right corner), and inspect not only the values in the "Transform" panel, but also the color-coded local axes, which can be seen sticking out of the center of every selected mesh, in the viewport. Try to interpret all this, in terms of the "translation array" ([[TRTA]]) and Oni's conventional neutral pose (see above).
#Basically, the only thing that you will be doing is: reparenting the bodyparts of the new character (by drag-and-dropping them in the Scene Explorer) and matching the translations and rotations of their respective centers to the centers of their counterparts in the posing mesh, which we know to be correct. Therefore, make sure that "Center" is selected the whole time: we are ''not'' moving the meshes themselves, only redefining their relation to each other and their local frames of reference.
#The next (and last) step is to ensure that every part of the new character is parented correctly (the thighs to the pelvis, the calves to the thighs, etc), ''and'' that the center of every new body part is placed in the same way as the center of the corresponding body part of the "posed" Oni character. To see the centers of ''all'' body parts of the Oni character, all at once, just select all of its meshes, and either select "Center" in the "Select" panel, top right, or check "Centers" in the drop-down "eye" menu, in the viewport.
#Basically, the only thing that you will be doing is: reparenting the bodyparts of the new character to each other (by drag-and-dropping them in the "Explorer/Scene_Root" viewport), and matching the translations and rotations of their respective centers to the centers of their counterparts in the posing mesh, which we know to be correct. Therefore, make sure that "Center" is selected the whole time: we are ''not'' moving the meshes themselves, only redefining their relation to each other and their local frames of reference. Some of the matching can be done automatically, but it won't always work, so be ready to copy some values by hand, from one mesh to the other.
#The basic order in which you proceed is this.
#The basic order in which you proceed is this.
#*Select the new pelvis. It already overlaps with the "posing" pelvis, and it needs no parent. The only thing that's wrong with it is the position and rotation of its center. So, what you do is, you select the new pelvis (or rather its "Center"), and then in the drop-down Transform menu, click "Match all transforms", and immediately pick the pelvis of the posing Oni character (in Scene Explorer). This should make the center of the new pelvis collapse onto the center of the posing pelvis, which is where we want it to be.
#*Select the new pelvis. It already overlaps with the "posing" pelvis, and it needs no parent. The only thing that's wrong with it is the position and rotation of its center. So, what you do is, you select the new pelvis (or rather its "Center"), and then in the drop-down Transform menu, click "Match all transforms", and immediately pick the pelvis of the posing Oni character (in "Explorer"). This should make the center of the new pelvis collapse onto the center of the posing pelvis, which is where we want it to be.
#*Now, select the left thigh (which is not parented to the new pelvis yet). Drag and drop it into the new pelvis in the Scene Explorer (i.e., reparent it). Normally, no meshes should move when you do this (but if you move or rotate the center of the new pelvis now, the new left thigh will also move and rotate, because it is already relative to the pelvis). There is still one thing wrong with the left thigh, and that is the placement and rotation of its center - it is still, e.g., at the world's origin (in this pose), and we want it to be where the center of the posing left thigh is. So, we select the new left thigh's center, then choose "Match all transforms" in the Transform drop-down, and pick the "posing" left thigh in Scene Explorer. Now our new left thigh should also be OK.
#*Actually it seems that, in the latest version of ModTool, the automating matching of transformations is done in global coordinates, not in the local frame of reference. ([[User:geyser|IIRC]], in previous versions of XSI, it was possible to match transforms in the "Local" sense.) This means that the rotation will probably match correctly, but the translations will typically be off, so you may have to copy them manually.
#*All the other body parts are done the same way. Be sure to proceed from the root of the hierarchy to the extremities, and check your results from time to time. Make sure you don't match the posing body parts to the new body parts instead of the other way round. In other words, look at the first steps above, and make sure that you know what you're doing.
#*Basically, after you "Match all transforms", check the orientation of the new pelvis's center (the triplet of Euler angles in the "Transform" panel, and the color-coded axes sticking out of the center, in the viewport). Make sure that the axes look the same as for the posing pelvis. If the Euler angles look different but the axes look OK, then you are probably looking at equivalent Euler angles.
This is all done in ModTool I have no idea about how you'd do this in Blender, never tried. [[User:Geyser|geyser]]
#*Now, select the left thigh (which is not parented to the new pelvis yet). Drag and drop it into the new pelvis in the "Explorer" viewport (i.e., reparent it). Normally, no meshes should move when you do this. But if you move or rotate the center of the new pelvis now, the new left thigh will also move and rotate, because it is already relative to the pelvis. This is why you need to do the pelvis first.
#*There is still one thing wrong with the left thigh, and that is the placement and rotation of its center - it is still, e.g., at the world's origin (in this pose), and we want it to be where the center of the posing left thigh is. So, we select the new left thigh's center, then choose "Match all transforms" in the Transform drop-down, and pick the "posing" left thigh in "Explorer". Same as above, check the rotation (Euler angles and local axes), and fix the translation manually if needed. Now our new left thigh should also be OK.
#*All the other body parts are done the same way. Be sure to proceed from the root of the hierarchy to the extremities, and check your results from time to time. Make sure you don't match the posing body parts to the new body parts instead of the other way round. In other words, look carefully at the first steps detailed above, and make sure that you know what you're doing.
All of the above is done in ModTool. I have no idea about how you'd do this in Blender, never tried. [[User:Geyser|AFAIK]], not only is Blender incapable of matching transforms in the local sense, but manual setting of transforms can be done in the global sense only. This means that you would probably need to reduce the new model to Oni's neutral pose, or use a skeleton.
====Making joints look nice====
====Making joints look nice====
Apart from the consideration regarding the pose (see above), you should be aware of the specific nature of Oni's body parts.
Apart from the consideration regarding the pose (see above), you should be aware of the specific nature of Oni's body parts.
Line 134: Line 138:
As for the spine, large overlaps (and clever overall decomposition into pelvis/mid/chest) are needed to allow for the extreme bending of the spine (think [[Backbreaker]]).
As for the spine, large overlaps (and clever overall decomposition into pelvis/mid/chest) are needed to allow for the extreme bending of the spine (think [[Backbreaker]]).
Feet and fists can be resolved rather easily (you just extrude them a bit towards the calf/wrist), but you should also mind such things as two-handed aiming overlays.
Feet and fists can be resolved rather easily (you just extrude them a bit towards the calf/wrist), but you should also mind such things as two-handed aiming overlays.
====Working example====
{|align=right
|http://geyser.oni2.net/edition/characters/gally/GLB_shot.png
|}
For the sake of this sorta tutorial, we shall pretend three things:
*Berserker Gally from GUNNM Martian Memory (a PSX game) is, like, the coolest model ever (see left);
*we want to make into, like, the coolest Oni character mod ever made, or die trying;
*as the provider of the (ripped) model, I am not your <strike>bitch</strike> housemaid (meaning that, although I ''could'' rip an OniSplit-ready DAE or even an Oni-ready TRBS, I will ''not'').
We shall proceed in steps. The ripped model is provided as-is [http://geyser.oni2.net/edition/characters/gally/GLB_ripped.zip HERE] (well, not really as-is; I roundtripped it through 3D Exploration)
#Start a "File/New scene" in XSI, and open this thing with "File/Import/OBJ file". In an "Explorer" window you shall see that there are 15 "bone-something" objects, and 19 "part-something" objects.
#Don't go thinking that the 19 "parts" are the ones you need for Oni, because they're not. They're just meshes. As you will soon find out,
#*there are no shoulder parts,
#*parts 7 to 11 part all belong to the head,
#*part 18 is pelvis, mid and chest combined, and
#*the open hands are in a separate OBJ file.
#There is a bunch of basic things that you want to do before actually adapting this character for Oni
##The first thing you want to do is combine the head meshes into one. Just comment out the "g" tags for parts 8 through 11, in the OBJ file, and you should get [http://geyser.oni2.net/edition/characters/gally/GLB_merged.zip THIS]. Reimport it into a new scene, and see what changed.
##Don't mind the "bone" objects for now. I just happened to include them in the rip, but I'm not sure why.
##Sooner or later you'll want to select all the objects (or just "Select all" and deselect the light and camera) and rotate them by -90° along X, so that Gally is upright.
#Now you want to split the body mesh (part 18) into three parts and to add some placeholder meshes for the shoulders.
##The shoulders you can get from Barabas. Drop his DAE into the "Scene_Root", reparent the shoulders to "Scene_Root", delete the rest of Barabas, and then scale/move the shoulders around until they fit inside Gally's chest. Try to keep them symmetric.
##As for the splitting, here is what you do. You duplicate part 18, twice, then hide all the duplicates but one, delete faraway polys, move the adjacent vertices around a bit, and then close the mesh with new polygons (N for making a new triangle, then Esc and Ctrl+Shift+A before creating a new one, to avoid making a quad). While you're editing the body, you may notice that some quads were apparently triangulated even though they are not perfectly flat, and the triangulation is not done the same way on both sides of the body. You can fix it now (Dissolve, Subdivide, re-Dissolve), or you can save it for later.
##When you're done, you can add the hand meshes from the extra OBJ file. To place them correctly, you can use the coordinates of the tips of "bone_4" and "bone_7" (aha! I knew they'd come in handy)
##When you're done with that too, you want to get her ready for a "matching session" with an Oni character such as Konoko. Select all objects, then "Freeze all transforms" (from the drop-down menu of the "Transform" panel), then scale the whole bunch by 2 along all axes (don't ask, just do it), and "Freeze all transforms" again.
##Now every object (including Barabas's shoulders) has unit scaling, 0 rotation and 0 translation. Since all the meshes are parented to the scene root, "0 rotation and 0 translation" means that all their centers are at the world's origin, and the axes of the centers are aligned with the world axes (you can check that by switching to "Center" in the "Select" panel, or by enabling the drawing of Centers in the "eye" drop-down menu of any viewport). If you haven't done it already, you can rename the "part-something" meshes to the standard names used by OniSplit.
#Now is a good time to save your work, either as an XSI scene or model, or as Collada. I prefer Collada for some reason, but you must be careful to export only the selection (you don't want the "Scene_Root" to be exported, or the camera, or the light). Just select all the objects (including the "bone-somethings", because they might come in handy again), then "File/Crosswalk/Export", set the exported type to COLLADA, the filename to something sensible, and in the Settings, make sure that "Selection Only" and "Keep Referenced Paths Relative" are ON, and that "Verbose" and "XSI Extra" are OFF. You should get something like [http://geyser.oni2.net/edition/characters/gally/GLB_almost.zip THIS] (tweaked a bit in a text editor, to remove the link to TXMPTextures_babamid, and to make the hands and the rest of Gally use the same material GLB).
#Now there's only a few things left to do. Our last step will be the "matching" of Gally's body parts to those of a modified Konoko. But before that, there are some preliminaries.
##Start a new scene in XSI, and drag-drop the Gally you just saved into it. Delete the fists if you want to, and name everything according to OniSplit's standard, if you haven't already.
##Use OniSplit to "extract" '''ONCCkonoko_generic''' to .dae, with the '''-noanim''' tag, and drag-and-drop her into the same scene.
##*If you named Gally's meshes correctly, then Konoko's meshes will be disambiguated with a "2". This is not a problem.
##*Note how the height of Konoko's pelvis (and hip joints) is consistent with Gally's. That's what the factor 2 was for.
##*Also note that Gally's upper body is rather small in proportion to her legs, and that her calves are slightly longer.
##Rotate Konoko's arms and shoulders to match Gally's pose. Try (0, +-65, 180) for shoulders and (0, +-65, 0) for arms.
##Now translate Konoko's body parts (''not'' the centers) so that their centers match the supposed centers of Gally's.
##*Work from the pelvis down the tree, because if you move, e.g., "mid", all the upper body will mode too. So, do "mid" first, and don't touch it afterward.
##*Use Gally's "skeleton" to pinpoint the supposed centers of her meshes. To see Konoko's centers while you move the objects, use the viewport's "eye" settings.
##*Shoulders, mid and chest can be tricky because the original Gally has no shoulders or mid, and chest has translation 0, unlike in Oni (probably the spine is meant only to twist, not to bend). Just try to place all those bones in proportion with the head-neck distance and approximate shoulder width (which is a bit narrower than Konoko's. Maybe it's better to use [[Shinatama Too]] instead of Konoko, here. In any case, don't be afraid to translate Konoko's body parts away from the original locations, as long as this "compact Konoko" gets close to Gally's proportions.
#When you're happy with the overlap, you are ready to match Gally's body parts to Konoko's; both in terms of hierarchy ([[TRIA]]) and in terms of relative placement ([[TRTA]]).
#*Switch to "Center" in the "Select" panel, select "pelvis" (Gally's), then click "Match all transforms" in the "Transform" drop-down, and pick "pelvis2" (Konoko's). Check the result by alternatively selecting "pelvis" and "pelvis2". Look not only at the values in the "Transform" panel, but also, in any viewport, at the center (white circle) and the local axes (colored) lines. The rotation should be OK, but the translation may be off. If it is, just fix it manually, and check the result in the viewport, alternatively selecting "pelvis" and "pelvis2" until you're sure that both centers are the same.
#*When you're done with "pelvis", move on to "left_thigh". Until now it was a sibling of "pelvis", and a child of "Scene_Root". Now that "pelvis" is done, you can make "left_thigh" a child of "pelvis", by drag-and-dropping it onto "pelvis" in the "Explorer" viewport. Then you need to match the relative transforms of this center with respect to the center of "pelvis". Make sure "Center" is selected in the "Select" panel, then select "left_thigh", choose "Match all transforms" in the "Transform" drop-down, and pick "left_thigh2" (Konoko's posing thigh). Again, the rotation will probably be correct, but the translation will probably be off, and you will have to fix it manually. Check the result by alternatively selecting "left_thigh" and "left_thigh2", until you're happy.
#*Now that you've gotten the idea, do the same for all the other body parts (reparent Gally's, and then match Gally's centers to Konoko's). Make sure you do one mesh at a time, and progress from the root of the tree (the pelvis) towards the extremities. Try not to forget any mesh, especially early on, or you will have to start over.
#When the matching is over, select all of Gally's meshes, export to Collada ("selection only"), import into Oni and it should Just Work.
#If there's a problem with any of these steps, just say so. I'm not sure how I could explain it any better without screenshots.
[[Category:Modding tutorials]]
[[Category:Modding tutorials]]