Importing character models

From OniGalore
Revision as of 17:03, 15 June 2008 by EdT (talk | contribs) (removed links to older version of OniSplit)
Jump to navigation Jump to search
Here are a few guidelines for wannabe modders.

Modding tools

A powerful free tool available on PC only is XSI Mod Tool. More or less free equivalents thereof probably exist on the Mac platform. Blender is mostly OK, but it suffers from a nerdish user interface and an equally nerdish COLLADA plugin (written in Python rather than C++, broken and pretty much dead). It is certainly possible to get things done in Blender, but since it's not the best and only tool, support from experts is hard to come by.

Note that Autodesk now provides a converter between the FBX and COLLADA formats, so whatever tool you have that can reliably import/export FBX, you can consider it for authoring Oni characters, even if OniSplit only imports from COLLADA at the moment.

Overview

Onisplit allows you to export .dae files from both TRBS and ONCC, with or without a -noanim tag in the case of ONCC. Examples:

  • after having globalized all the characters, go to the Oni\edition\GameDataFolder\level0_Final folder
  • enter ..\..\install\OniSplit.exe -extract:dae collada -noanim ONCCmuro_generic.oni
or ..\..\install\OniSplit.exe -extract:dae collada ONCCgriffin_generic.oni
or ..\..\install\OniSplit.exe -extract:dae collada TRBSkonoko_body_high.oni

Of course the relative paths used here are only an example. Mac users, adapt command-line syntax as necessary.

This will create the files ONCCmuro_generic.dae, ONCCgriffin_generic.dae, and TRBSkonoko_generic.dae in the folder Oni\edition\GameDataFolder\level0_Final\collada. The difference between ONCCgriffin_generic.dae and ONCCmuro_generic.dae is that Griffin will appear with an idle pose, whereas Muro will be in the defaul animation state (all bones aligned to their parents). As for TRBSkonoko_body_high.oni.dae, she will be in the default animation state and will have no materials/textures set up. See the notes below for explanations.

Importing characters is limited to the generation of TRBS from .dae files ATM. For the above characters it goes as follows:

  • after the example above, go to the Oni\edition\GameDataFolder\level0_Final folder
  • enter ..\..\install\OniSplit.exe -create:trbs collada collada\ONCCmuro_generic.dae
or ..\..\install\OniSplit.exe -create:trbs collada collada\ONCCgriffin_generic.dae
or ..\..\install\OniSplit.exe -create:trbs collada collada\TRBSkonoko_body_high.dae

This will create TRBSmuro_generic.oni, TRBSgriffin_generic.oni, and TRBSkonoko_body_high.oni in in the folder Oni\edition\GameDataFolder\level0_Final\collada.

You can rename these TRBS appropriately so that they are used by either some of the old ONCC or some new, cloned ones. Finally, rebuild the level to test the model.

Notes

Textures

The textures are listed in the TRMA file, which is only visible from the ONCC, not the TRBS. If you want to use the textures while editing the model, extract the .dae from an ONCC. Textures are currently ignored upon creating the TRBS (however, the TRBS will of course retain the changes you may have made to the UV coordinates). Possibly future versions of OniSplit will automatically generate a TRMA if the .dae file has textures.

Default orientation

The primary axis of the bones is X. When all the bones are aligned with their parents, you get something like this:

15-o-14-o-13-o-12-o  4-o-3-o-2-o       ^ z
                  |            |       ^
           :)11-o-10-o-9-o-8-o-1  < < <^< < <
                  |            |   x   ^
19-o-18-o-17-o-16-o  7-o-6-o-5-o       ^

If you want to get an idea of what it actually looks like, just export any Oni character with the -noanim tag:

  • after having globalized all the characters, go to the Oni\edition\GameDataFolder\level0_Final folder
  • enter ..\..\install\OniSplit.exe -extract:dae collada -noanim ONCCkonoko_generic.oni
or ..\..\install\OniSplit.exe -extract:dae collada TRBSkonoko_body_high.oni

The relative positions and rotations of the body parts in this state provide a reference for any other pose. In fact, what is relevant here is not only the relative placement of the meshes, but also the placement of the center of rotation (a.k.a. joint) of every body part with respect to its parent.

Idle pose

If you use -extract:dae TargetFolder ONCCkonoko_generic.oni (with ONCC rather than the TRBS , and without -noanim), OniSplit will look up the idle animation from the ONCC's TRAC. Rotations (relative to the reference layout of the joints) are applied to the body parts.

Keep in mind that this idle pose exported by OniSplit is just an arbitrary natural-looking pose, as opposed to the reference state (exported with the -noanim tag). It is certainly not a standard pose for you to match when importing a new model (unless you are swapping body parts between Oni characters that use the same idle pose, in which case you don't have to match anything anyway).

There is actually no such thing as a "standard" pose for 3D characters: the width of the stance, the stiffness of the spine, the angle at which the arms extend from the body - all that varies a lot between models. However, before you glue the body parts of such a character to an Oni-ready skeleton, you can rotate the bones of the latter to match the pose of the new geometry (not the other way round).

Also note that the new body parts need to be aligned with the underlying bones not only geometrically, but in a way consistent with the relative placement and rotation of the joints. In XSI Mod Tool, any new body part can be positioned correctly for a specific pose and then be told to "Match All Transforms" of the underlying bone, thus becoming a consistent part of the character. Dunno about Blender.

Importing

Only TRBS are created at the moment, although TRMA could also be generated. An ONCC contains much more information than links to TRBS and TRMA and thus can not be generated automatically ATM.

The easiest way to try out an imported character in Oni is to rename the imported TRBS so that it replaces an existing one. Eventually, you can clone an ONCC and make it link to the new TRBS.

The authoring of the new ONCC can be done either in binary (with a hex editor) or with OUP.

Bastardizing

This is possibly the easiest kind of modding, that doesn't require texturing skills or even, in most cases, attentive handling of poses and joints. The idea is to:

  1. take two Oni characters (for simplicity, two characters who use the same skeleton: e.g., the Konokos from CHAPTER 13 . PHOENIX RISING and CHAPTER 10 . CAT AND MOUSE)
  2. load both of them simultaneously into Mod Tool or Blender (e.g., one as a hierarchy (.dae), the other as a collection of objects (.obj) )
  3. reparent some body parts and trim the rest (since the orientations and joint offsets match, you don't need to rotate/move anything)
  4. export, adapt the TRMA if needed, rebuild the level and play

This allows one to recombine Oni's characters into "new" ones very easily. The easiest thing is to add sunglasses to any Konoko model ^_^

Cel-shading

An effect similar to cel-shading can be obtained by enclosing the mesh in a shell painted in black and facing inwards.

As of 0.9.8, OniSplit can perform this operation with every body part, in an automatic way, with one control parameter.

The syntax is as follows:

FolderWhereOniSplitIs\OniSplit.exe -create:trbs TargetFolderForCreatedTRBS -cel FolderWhereTheModelIs\name_of_the_model.dae
or FolderWhereOniSplitIs\OniSplit.exe -create:trbs TargetFolderForCreatedTRBS -cel:0.1 FolderWhereTheModelIs\name_of_the_model.dae

The -cel option enables the generation of the shell. The optional parameter (default 0.07) defines the thickness of the shell.

Note that the shells may not be good-looking in every situation without some further tweaking (after reextracting the TRBS).

Some examples of automatically generated shells (not tweaked) can be seen here: http://geyser.oni2.net/edition/celshading

New models

Apart from the consideration regarding the idle pose (see above), you should be aware of the specific nature of Oni's body parts. Have a good look at an Oni model before you import a new one. Especially look at the generous overlaps between the body parts.

If you're importing a skinned character, you may have to completely remodel the following regions: elbows, knees, waist, diaphragm. E.g., both the thigh part and the calf part should encompass the region around the knee, roughly fist-sized. Same for the elbow.

The bulk of the shoulder parts is merely supposed to bridge the gap between the chest and the arms for the more extreme anims. Oni's characters mostly use capsule-shaped primitives for shoulders, so you can always borrow those from a thug or whoever.

As for the spine, large overlaps (and clever overall decomposition into pelvis/mid/chest) are needed to allow for the extremes. Feet and fists can be resolved rather easily (you just extrude them a bit towards the calf/wrist), but also mind the extremes.