Jeff Mills has graciously allowed a reprint of an awesome April 11th, 2013 tutorial – thank you Jeff and thank you ADL =)
Now that the age of mesh importation is a reality in the Second Life and Open Simulator virtual environments, the quest to find helpful techniques to utilize this ability can create a difficult and frustrating situation. Over the past two years, we have seen artisans and developers create everything from amazing vehicles, architecturally correct buildings and amazingly realistic mesh avatars that impress as well as confuse the viewer as to how they are made. It is difficult to locate good documentation that dispels the mystery. It is time to demystify the closely guarded secrets and show the basics of avatar mesh creation with a systematic approach. This tutorial will show the basics of using open source 3D software as well as other free resources to make your own mesh avatars and attachments.
The prerequisite for this tutorial is a basic-to-intermediate understanding of 3D mesh creation and the principles of animation with industry tools such as Autodesk’s 3D Max, Maya, Softimage and the free open source Blender 3D creation tool. This tutorial will focus on a pipeline that uses Softimage import into Blender. However, the principles for importing models into Blender are the same for other 3D software.
Sources of 3D Models and Tools
If you are not an artist, fear not. There are many free resources available. Sites such as www.TurboSquid.com (Figure 1) have many items free for use and quite a few models that make great attachments and / or models that serve as complete avatars. Sites such as the ADL 3D Repository 3dr.adlnet.gov, 3D Exchange www.3dexchange.com, and Flat Pyramid www.flatpyramid.com are several other resources that provide free models and models for purchase.
Autodesk’s Softimage (Figure 2) is a free full animation suite offered to game developers for use in creating collaborative design activity (COLLADA) models. This tool is excellent for building, adjusting and texturing meshes and exports to Blender with ease. You can download the software at http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=13571320.
The Second Life and Open Simulator communities have long embraced Blender.org (Figure 3) and the free 3D creation tool. Benefits of using Blender include several direct plugins that export to Second Life and Open Simulator. You can download and install Blender 2.65 at http://www.blender.org/download/get-blender.
The main file needed for mesh manipulation is conveniently available on the Machinimatrix website (Figure 4). The file is the avatar-workbench-265.blend file found at http://blog.machinimatrix.org/avatar-workbench.
Setting up the Blender Rig
The first step in the process is to start Blender 2.65 and open the avatar-workbench-265 file (Figure 5).
This armature will be used for all avatar mesh manipulations. The avatar is a scaled version of the avatar mesh found inside of the Second Life or Open Simulator client. If you are not familiar with Blender, the manual has documentation concerning moving and selecting objects in the main viewport. This tutorial assumes a base knowledge of Blender use.
Exporting the Rig for use in Softimage XSI Mod Tool
Three parts of the avatar mesh are to be exported into Softimage XSI Mod Tool. XSI Mod Tool will allow proper adjustment of the clothing mesh that was downloaded from Turbosquid.com. If you have more experience with other 3D programs, this export will work equally well for this process.
Right click each of the three parts while holding down the “Shift” key (Figure 6). Select “File-Export-Wavefront (.obj)” and save the .obj on your computer. This process is specifically for those individuals who have experience working with a particular 3D package of their choosing. If you have experience with Blender, the same steps shown for XSI Mod Tool can be done with Blender.
Import the Mesh into Softimage XSI Mod Tool
Open the XSI Mod Tool and import the mesh dress (Figure 7). Turbosquid offers this mesh as a Wavefront .obj file. Other file formats such as COLLADA .dae files are acceptable as well. Align the mesh dress to the avatar body by translating, scaling and moving vertices on the mesh surface.
The goal is to form the dress over the body as close as possible while keeping the avatar surface from protruding through the mesh of the dress. The example above (Figure 8) shows a lattice deformation that moves vertices into the proper places. Depending on the 3D program used, various techniques can accomplish the process.
Once the positioning is completed, freeze the dress model’s state as shown in (Figure 9). This makes all the modifications permanent and collapses the operator stack. We are now ready for export back to Blender for avatar mesh weighting. This critical process makes the mesh stick precisely to the avatar when applied in Second Life or Open Simulator.
Export the dress mesh from “File-Crosswalk-Export” in the top menu (Figure 10). Choose COLLADA from the “Crosswalk File Type” block and under the “Settings” tab, match the checked blocks shown at the right hand side of the dialogue block. In the “File Name” block, select the save location in the same file folder as the location of the dress mesh texture and name the mesh. The final step is to click the “Export” button.
Importing the Mesh Dress into Blender
Return to Blender and reopen the avatar-workbench-265.blend file. From the main menu select “File-Import-Collada (Default) (.dae)” and select the adjusted COLLADA dress model exported from the XSI Mod Tool. Use the “S” key to scale the dress to the avatar body. Keep the avatar mesh from showing through the dress (Figure 11).
The parenting or enveloping to the armature is accomplished by selecting the dress and armature. Hold down “Ctrl+P” and choose from the dropdown “With Automatic Weights” (Figure 12). This associates the vertices of the mesh dress to the bones by proximity. Blender averages the influence of each of the vertices and how much movement each bone controls. This procedure is not precise. If you select the bones influencing the mesh dress at this point and rotate in any direction you will see how many of the vertices pull and deform poorly. The program does not understand the visual aesthetics of the weighting process. This is why the artist needs to tweak and adjust by a process called Weight Painting.
Weight Painting the Vertices of the Mesh
The dress mesh is ready to be weight painted for proper deformation. Select the dress by right clicking and from the “Mode” panel (Figure 13) select “Weight Paint”. The dress mesh will display a blue surface color indicating the Weight Paint mode. The “T” key will open the tool panel on the left-hand side of the 3D viewport. The weight paint controls will display.
The armature must be set to the “Pose Mode” from the Mode panel in order to move the avatar around and see how the dress deforms. Right click on the armature.
The armature is represented as the skeleton framework shown inside the avatar mesh (Figure 14). Once highlighted in orange, select the “Pose Mode” and the armature will now change to an active blue color.
Each bone that makes up the armature is selectable and movable. Rotation will be the only movement used to check mesh deformation. The dress is now ready to have vertices adjusted or re-weighted to the appropriate bone of the armature.
Select the dress mesh and ensure that the “Mode” panel shows “Weight Paint”. Right click any of the bones and you will see the weight influence of the bone. In this mode, the cursor will represent a paintbrush. The weight panel control displays weight, radius of the brush and strength of the brush. The “Blend” box switches the brush to different paint states. The predominant “Blend” states used will be “Add”, “Subtract” and “Blur” (Figure 15).
Begin painting the weight influence per bone. Using the “Z” key will toggle the mesh back and forth between a solid surface and a wireframe view. It is easier to see the progress of painting in the wireframe view. The wireframe view eliminates lighting and shadows making the surface color more visible on sides facing away from the light source.
As the brush adds and subtracts from the bone influence, use the “R” key or “Rotation” to move the bones. This will show how the dress is stretching per the bone’s influence (Figure 16). The weighting process requires testing of each bone to see how the mesh is responding to the bone movement. Subtract bones that have no influence on the mesh dress entirely. Every bone in the armature may have some weight assigned. Individual rotation of each bone will show if there is influence.
The process of painting weights can be a tedious process. Patience will assure a proper blend between the individual bone influences.
Preparing Mesh for Export to Second Life or Open Simulator
When all weight painting is complete, the mesh is ready for export to use in Second Life or Open Simulator. Select the dress and return the mode back to “Object Mode” (Figure 17). Next, select the armature and change the mode to “Object Mode” as well. The head, upper torso and lower torso meshes of the avatar are not needed for export. The dress is the only mesh we are concerned with in this example.
Select both dress mesh and armature by right clicking while holding “Shift” down.
Under “File” on the top menu bar, select “Export-Collada (Default) (.dae). On the left-hand “Export COLLADA” panel, check the “Selection Only” block (Figure 18). This ensures that the dress mesh is the only thing exported and not other elements in the scene. Under “Texture Options”, make sure that “Only Active UV layer”, “Include UV Textures” and “Include Material Textures” are selected as well. This keeps proper UV information.
Uncheck the block “Copy”. The final block selection is “Export for Second Life”. This selection is how Blender formats proper avatar weighting for Second Life and Open Simulator. Save the COLLADA file to the same folder as the dress texture. Second Life and Open Simulator will not find the texture unless it is in the same folder as the COLLADA mesh.
Importing the Dress Mesh into Second Life or Open Simulator
In this example, the mesh dress will be imported into the public Second Life grid. The process is identical for the versions of Open Simulator that support mesh. Find a location that allows build rights. From the inventory window, select “Upload-Model” from the upload widget in the bottom left-hand corner (Figure 19). Navigate to the folder with the Dress.dae file. Select the dress and it will open in the Upload Model panel.
First, name the mesh in the “Model name” block. The dropdown “This model represents” will tell Second Life or Open Simulator that the mesh being uploaded will function as an avatar shape (Figure 20).
Select “Use LoD above” in the Medium block under the “Level of Detail” tab. This step will ensure the model will retain the higher level of detail and not collapse when the client’s camera travels away from the avatar.
Under the “Upload options” tab, check the “Include textures”. This applies the texture based on the UV coordinates of the mesh as well as places a copy of the texture in your inventory with the same name as your mesh. Under the “For avatar models only”, check the “Include skin weight” and “Include joint positions”. This includes the weight deformation that was created in Blender.
Lastly, check “Calculate weights & fee”. This will calculate the land impact on the simulator and assess cost on the public Second Life grid. No cost is associated with upload in Open Simulator. Once calculations are complete, the “Upload” button will appear. Click “Upload” to import into the inventory (Figure 21).
The mesh dress is ready to be worn. Locate the dress in the inventory window. Right click the dress object and select “Wear” (Figure 22). The dress will automatically deform over the avatar. Additional adjustments may be required to tuck correctly into the dress. If the avatar’s shape varies greatly from the default shape, adjust the body sliders to fit the avatar skin within the contours of the dress.
There are some techniques used to better conceal the avatar shape beneath the dress. In this example (Figure 23), the avatar skin textures have alpha channels applied where the dress falls. This makes areas of the body invisible even if the body protrudes through the mesh dress.
In conclusion, this is just one of many things that you can do with these techniques. The same methods apply for an entire avatar mesh. With some practice and patience, you can create virtual environments with a great level of additional detail and creativity (Figure 24).
About the Author
Jeff Mills: As a contractor with Katmai, Jeff provides support to the Advanced Distributed Learning (ADL) Initiative. The views expressed are those of the author and do not necessarily represent the views or policies of ADL.
follow the ADL Initiative @ADL_Initiative