Body Editor with Blender
From Blue Mars Developer Guidebook
This is for Blender 2.49
Blender can be used pretty nicely to edit body shapes, there is a brief discussion of the body editor in the main wiki at http://www.bluemarsdev.com/wiki/index.php/Blue_Mars_Sandbox_Body_Editor, if you want to edit just the face notice the image that shows what constitutes the face part of the body, it doesn't seem to be marked in the loaded object.
When using Blender to edit a body there are some specific rules.
- The origin and rotation of the overall objects cannot be changed from the original as imported.
- The number of faces and vertexes cannot be changed from the original as imported, so when changing the shape, just move the vertexes around, don't cut the object, subdivide, etc.
Importing the templates
There are two starting body templates:
- Blue Mars City Developer Tools\Template\Avatar\Female00\Model\Female0000\Body\Female0000_Body.dae
- Blue Mars City Developer Tools\Template\Avatar\Male00\Model\Male0000\Body\Male0000_Body.dae
One of these has to be imported into Blender via the Collada import tool as the template to modify.
In the Collada importer just use the option:
- New Scenes
You may find it easier to work with if you immediately save the blender file in your working directory as a .blend file, e.g. male.blend. That way you don't have to keep doing the import.
What you get is a pretty complex file with 3 scenes. The one you want to work with is the Male0000_Body scene. There are 7 objects to work with, Body, EyeCover, etc. You can ignore the RenderLayers entry.
For this discussion I'm using the male template.
When the body comes in it is rotated to face away from the normal default, to see the front, use CTRL + (Numpad) 1. It's also big, but don't change the scale or rotation.
You may find the Blender Outliner window very helpful when editing to turn visibility and selectability on and off depending on which object you are working on. For example if you want to work on the teeth, turn the Body visibility off. Don't forget to turn visibility and selectability back on though before exporting, otherwise not all the 7 objects will be exported and it won't work.
You can grab, rotate, scale etc. individual faces, just don't add or subtract faces or vertexes. The Sculpt Mode can be very useful as well as using the Proportional Editing Falloff options in Edit Mode.
It is also very helpful to turn on X-axis Mirror which is in the Mesh Tools More buttons in the Mesh buttons when in Edit Mode if you want to keep your edits symmetrical. Be warned however that Blender seems to be pretty fussy about when it will actually do the mirroring. If the two sides get out of synch with each other mirroring seems to sometimes stop working silently so you may think you've been mirrored, but it hasn't happened. At the very least be very sure you know what you're doing if you start editing the mesh without X-axis Mirror turned on, because once changed, mirroring may never work in that region of the mesh again.
In Sculpt Mode the X mirror option seems to work pretty well, but be watchful, YMMV.
Don't mess with the materials, textures, etc. At best they are ignored, at worst it will produce an unusable dae file. You may want to turn smoothing on, it doesn't seem to hurt the export and helps visualize the final effect a bit better in the Solid Shader in Blender.
Exporting the DAE file
Because the Collada exporter is a bit fragile, you might want to always save your work in a blend file before doing the export so you don't loose it when blender crashes (about 1 out of 4 times for me).
The Collada export only is for the Male0000_Body scene and only for the 7 objects in it. Don't export anything less or more or it won't work. If you get errors about missing objects you probably didn't export just those 7 objects, or not all of them. Just select all with the A key before doing the export.
In the Collada exporter, choose
- Only Export Selection
- Only Current Scene
It may take awhile to do the export, and a Not Responding message may appear, but don't give up unless Blender actually crashes, it can take several seconds or more depending on you computer.
Loading the Body into the Body Editor
To load the body dae file, start the Body Editor and pull down the Body => Make Body... menu option. Then select either the male or female template to start in the top dropdown.
Just below that is a file box where you can browse to your edited and exported dae file. Once you've got that set, hit the Process and Apply button and if everything is hunky dory you'll see you edits in the body. The Weight slider allows you to see what you edits did to the original template, left is original, right is edited.
A nice feature is that you can go back to Blender, make some more edits, reexport to the same dae file and just hit the Process and Apply button again to see your updates without using File => New, restarting the editor, reformatting your disk, etc.