Making animated 'pets' for IMVU using Blender 3D - advanced Prep & Export
Making a pet for IMVU is just as easy as making any other item as also requires a 'mesh' (the object itself) and a 'skeleton' (the armature everything is 'attached' to - also referred to as a "rig").
The images directly below show the top, side and front view of a simple 'pet' ("Monster in a Box") made for IMVU using Blender 3D. Note that although this pet has a number of bones in the armature, that's not an absolute necessary.
What's needed to make an IMVU pet? ^
In order for any item to work in IMVU it has three requirements;
Mesh - the mesh can be composed of a number of separate objects and materials during construction, however, the mesh objects need to be joined together into a single mesh before exporting; this results in one single object with one or many material and/or texture references.
Armature - only a single armature will be exported. Make sure that it a number of armature have been used and animation action created that those animation play correctly when applied to the 'joined' master armature that's needed for export to CAL3D.
Action - animation actions can be of any number and any length. Keep in mind that the longer the animation the larger the resulting file after export; although text based and easily compressed into a product *.cfl, it's best to keep in mind the overall 2MB file size limit on the *.cfl files saved and used by IMVU product system.
The 'mesh' component ^
The mesh needs to have at least one material applied and one texture UVW mapped to it. It also needs to be vertex weighted and parented to the armature - by default only one vertex group is need, however, if the pet is to be animated in some fashion a vertex group per bone name may be necessary (depending on the results wanted).
'Pet' placement relative to the two main 'root' bones in the IMVU avatars master skeleton (shows only "Female03MasterRoot" and "zHead"); where a pet appears in IMVUs chat client is dependant on these two bones.
The image above displays the two 'master' or 'root' bones - "Female03MasterRoot" and "zHead" - both of which can act as a 'root' location point of reference for the positioning of the pet as well as the generally accepted 'zones' (the pink boxes) where pet meshes actually sit when used in the chat client; "Position 1" and "Position 2" are the primary locations used to place pets but they can, in theory, be placed anywhere around the avatar.
A mesh must be vertex parented to the individual bones of the master armature used by the pet. The number of vertex groups created depends on the number of bones in an armature and/or if any given bone has an effect on the mesh (for example, 'arm' bones moving an 'arm' mesh section). Select the mesh and press "TAB" to enter "EDIT mode". Press "A" to select all faces/vertexes (may need to do this twice, once to clear any previously selected faces, and again to reselect everything). In the editing buttons window (F9) find the panel titled "Links and Materials" and within that find "Vertex Groups". Click "New" to create a new vertex group and in the text box that appears type "Female03MasterRoot" and hit keyboard "return/enter".
Important note: names are case sensitive; "female03masterroot" is not the same as "Female03MasterRoot"
Once the new group has been created click the "Assign" button; this will then assign the new vertex group to the selected faces/vertexes of the mesh. This can be tested by clicking the "Desel." and "Select" buttons to see if the mesh faces are selected and de-selected. Repeat the above steps for each bone used to animate part of the pet mesh. If the pet is 'static', in that it doesn't animate, then only one vertex group needs to be created, which is named (parented) the same as the armatures root bone. The above step needs to be repeated for every part of the mesh that is controlled by a bone and able to move as a result. Vertex groups are an important part of 'animation'.
The ' armature' component ^
The armature needs to have a minimum of two bones; a 'root' and an 'ancillary' bone (note; "ancillary" bone can be named something else). Both are required; if the pet is to be animated in some fashion then more bones may be necessary, each of which needs to be uniquely named with an associated vertex group present in the mesh.
Relative positions of normal armature placement for pets
Where to place an armature, it's physical location ^
Where the armature is placed depends on what the pet is and what it is expected to do.
Ground based pet ^
Has an armature root approximate to 'feet' of the avatar. A ground based pet will shift and move when ever the avatar itself moves location, i.e. when carrying out an action with another avatar, the pet will move to the same location the avatar does.
The root bone is "Female03MasterRoot"
Shoulder height ^
Has an armature root approximate to the 'head' of the avatar. Similar to the above, except the pet will also carry out similar 'actions' - that is, ranges of movement - based on what the avatar does, i.e. if the avatar does a back-flip, the pet will also do one.
The root bone is "Head", "zHead", "AttachmentRoot" or "AttachmentNode" depending on what range of motion is required.
Shoulder height, non moving ^
Has an armature root at the 'feet' of the avatar but the actual pet approximate to the 'head'. This allows the pet to appear at shoulder height but not be effected by any movement based on what the avatar does except when carrying out 'global' actions (moving from one spot to another).
The root bone is "Female03MasterRoot".
Placement and naming ^
The placement of the pet relative to the avatar is done in the IMVU Previewer so the root bones does not necessarily need to be called "Female03MasterRoot", however, for practical reasons it's often convenient to call it that or something that makes it clear it's the 'ROOT' bone.
When creating the pet in Blender however, it's best to think of, position and work on the pet based around its position, where it will appear in the client and to which avatar bone its to be parented to (see above).
The reason for this is that if working on a flying pet that has a root bone placed at the avatars feet (Female03MasterRoot), subsequently connected the pet to "zHead" in the Previewer will result in the pet being too far above the avatars head - this is due to the distance between the pet itself and the root bone being constructed in Blender relative to a pet that should have been connected to Female03MasterRoot, not zHead.
Bone relationships and 'parents' ^
The root bone ("Female03MasterRoot" in this instance) must not have any 'parents', it should be the top of the bone chain - everything links to it and not the other way around, so "Root « body « bouncy-bit" would be the correct format, not, "body « Root « bouncy-bit".
Female03MasterRoot shown as the 'root' or 'master' bone to which
everything is connected
Top view showing bone relationships
Front view (relative to pet) showing bone relationships
Individual bone orientation ^
When adding an armature for use it's best to add the object when in top view so as to minimise any problems associated with rotating the bones in edit mode. Looking down on a scene that would mean;
"Y axis" points 'up' (to the top of the screen)
"X axis" points to the 'right'
"Z axis" points 'out' (towards the viewer so it can't be seen)
IMVU 'pet' ("Box Monster") looking down from top view showing bone axis orientations in 'orthographic' view
Perspective view of "Box Monster" IMVU 'pet' show bone orientation
An Action ^
This is distinct from the section above about bone positions as this is related to what the pet does rather than where it does it. What this means is that there are two types of 'movement' achievable with pets;
Although both do require an 'action' (animation) be present before exporting anything from Blender to CAL3D for use in IMVU, the latter is a little more involved as it means creating 'extended' animation's that progress along the timeline for several seconds or minutes depending on the desired results. Note that the only difference between an animated item and anything else is simply related to using more keyframes and more time to carry out a movement or motion and then using that information in IMVU.
To make an extended animation then, open the Action Editor ("Shift+F12"). Create a NEW Action by selecting "Add New" from the drop down list in the header bar to create a new Action - this will duplicate the currently selected action. Rename where appropriate (changing the name in the Header). Select the armature and enter POSE mode (Ctrl+TAB). Select and position a bone then press "I" and select "Insert LocRotScale" or "Insert LocRot" to insert a keyframe at frame "1". Left click in the timeline or click on the playback marker (by default a green line) and drag it along the timeline to where the next keyframe will be placed (alternatively, with the mouse pointer in the Action window use the arrow and Shift+Arrow keys to move the time line). Pose bones (manipulate them using the usual manipulation tools) and then press "I" again to insert a new keyframe at marked. Repeat until the timeline is extended for a number of frames relative to the bone movement required to carry out the animated action itself. Repeat the process for each movement required, creating a 'new' action for each of "walk", "run", "fly" and so on, for example.
"Walk" animation Action
"Blink" animation Action
"Pounce" animation Action
Exporting the Pets animation's ^
Each pet movement needs a separate action/animation and each of these animation's need to be exported individually - it's not possible to 'batch' export animation data so each action has to go through the CAL3D export process on it's own. Once a series of separate animation 'Actions' has been made they can be exported one-at-a-time. To Export RMB to select the armature (in either 'Pose' or 'Object' mode). Or, select the mesh and then the Armature if this is the first export in a series. Next select from the drop down list in the Action Editor the appropriate animation to apply to the armature and then 'play' it (mouse over the 3D window, then press keyboard "Alt+A") to make sure all is correct before export. With sequence active in the Action Editor and assigned to the Armature, click "File » Export » Cal 3D (.cfg .xaf .xsf .xmf, .xrf)...". The Browse window will appear. Here appropriately name the file then click the button titled "Cal3D Export". In the pop up that appears, leave everything 'as is' (use defaults) and click "OK". The files will then be exported to Cal3D. Repeat the steps above for each individual action.
Design note: make sure to select the armature and apply one of the other actions before repeating the process again. Be sure also to change the name of each exported file in the file save view so as not to overwrite previous exports, the CAL3D exporter won't do this for you.
At the end of this process there will be a number of different *.xaf files, each one being a specific export of a particular animation action. These new files now need to be put together in IMVUs Previewer tool.