3D Modeler Overview and Best Practices for Maya
- Additional Resource: Unity's Manual for Modeling Optimized Characters
- Maya and Unity have a 1:1 scale ratio, which is in Meters. A 1x1x1 meter cube in Maya is equal to a 1x1x1 cube in Unity.
- Faces and Polygons will be interchangeable terms--they're called Faces in Maya and Polygons in a game engine. The Mesh is the polygonal part of the model.
- Try to keep the model's polygon count under 6000 triangles. To give some perspective, Half-Life 2 characters had roughly 2500-3000 triangles (see Fig. 1). File:Polycount.jpg
- Use 3 and 4 sided polygons. Unity will automatically convert 4-sided polygons into triangles but anything over 4-sides will cause unpredictable results.
- If you think you have polygons with over 4 sides, you can go to Polygons Mode: Mesh -> Cleanup... to convert all of them into a 4or 3 sided face.
- Watch out for backface culling. In a game engine, usually only the front side of a face is rendered, to save on processing power. This means that if your model has a funny issue in Unity where you're looking at the inside of a model, it might mean your faces are pointing in the wrong direction. You can check which direction your faces are pointing (called Face Normals) by going to Display -> Polygons -> Face Normals. Your model will end up looking like a porcupine. If any of the faces are pointed in the wrong direction, you can select the offending faces and use Polygon Mode: Normals -> Reverse (see Fig. 2). File:Facenormals.jpg
- If you're modeling a character, insert extra geometry around the joints so the limbs can bend properly.
- Delete history on your mesh once you're done. Do this by Edit -> Delete by Type -> History. Don't forget to save a backup copy prior to deleting history, too.
- Freeze transformations on your mesh. Modify -> Freeze Transformations.
- Use Duplicate (ctrl+d) instead of copy. Duplicate is much cleaner and causes less potential issues.
- A UV Unwrap is the act of preparing the model to be textured. A UV Map is the end result of an Unwrap.
- UV Unwrapping can be done by either the modeler or the texture artist.
- The UV Unwrap needs to be done in the 0 to 1 space (the upper right quadrant). The UV texture editor can be accessed by Polygon Mode: Edit UVs -> UV Texture Editor (see Fig. 3). File:Uvmap.jpg
- Whoever is doing the unwrapping needs to make sure that the UV Unwrap in the end is final before the modeler starts rigging the model. Once the model is skinned onto a rig, you cannot change the UV Map. (There is a work-around for that, elaborated in the skinning section.)
- Bones and Joints will be interchangeable terms.
- Try to keep your rig under 60 bones. The more bones, the more processing power is used to calculate position.
- Name your bones properly. It would suck for you to go back to your rig and not know which bone is for what. e.g. The left thigh bone should be named left_thigh_bone. You can use Modify -> Prefix Hierarchy Names... and Modify -> Search and Replace Names... to assist in that.
- Remember to freeze transformations on your handles (Modify -> Freeze Transformations). This way, you can return your model to the t-pose by selecting all your handles and typing in 0, 0, 0 in the x, y and z.
- Try and keep your hierarchies clean and organized.
- Use Layers to help separate different parts of the model. These are similar to Photoshop layers. Access it via the Channel/Layer Editor to the right side of Maya. e.g. Use a layer for the Mesh, a layer for the rig and a layer for the handles. This way, you can hide the rig, set the mesh to render only and the only thing you can select in the viewport are the handles. This will make animation much easier (see Fig. 4). File:Layers.jpg
- For symmetrical rigs, use Animation Mode: Skeleton -> Mirror Joint -> (Click the box icon next to it) to assist.
- For fast weight painting, use interactive skin bind. Animation Mode: Skin -> Bind Skin -> Interactive Skin Bind -> (Click the box). The bind zones can be manipulated in various ways by click and drag and shift-click-and-drag. Note: Do not rotate the bind zones--this will cause Maya to crash.
- In the scenario that the mesh needs to be changed or the UV Map needs to be redone but you want to keep most of the weight painting, follow these steps:
- Duplicate the mesh (ctrl+d) or find the original mesh prior to skinning.
- Detach the skin on the duplicated mesh if you did that.
- Delete history and detach skin on the new mesh.
- Make the modifications onto the new mesh.
- Skin the new mesh onto the rig.
- Select the old mesh and then the new mesh (or was it the other way around?) and use Animation Mode: Skin -> Edit Smooth Skin -> Copy Skin Weights -> (Little Box) to transfer weights from one mesh to the other.
- Double check the model and make sure the weight paint is correct.
- Detach the old mesh (Animation Mode: Skin -> Detach Skin) and delete it.
- Unity supports both smooth bind and hard bind.
- Unity will sample the frame rate which is set in Maya. However, 30 fps is recommended. 30 is a nice number. You can do 60 too if you want.
- Unity will only take scale, rotate, translate and bone-based animations.
- Make absolutely sure to set up a standardized naming convention for all your files! It will save your programmers a lot of trouble. For example,"all files are in caramel case (funnyCakePictureThing), all models have the md_ prefix (md_coolDragonPerson.fbx) and all materials have the ma_ prefix followed by the name of the object it is a material of followed by what material it is (ma_coolDragonPerson_shinyShirt_texture.png)." File:Fbx.jpg
- Unity can still see hidden meshes! Remember to delete any hidden mesh before export.
- You can give either directly use Maya's .ma or .mb file in Unity or export the model as an .fbx file first before importing it into Unity. The only difference is that when you import a .ma or .mb file, Unity will convert it to FBX behind the scenes. The FBX Export Method is recommended.
- If your animations behave strangely in Unity (twitchiness, bones fly to keyframes that don't exist, etc), you may have to redo your export. This is due to a bug in FBX 2011, any Maya animation imported into Unity directly or using the FBX 2011 format will break. To work around this problem, export the Maya file using the FBX 2010 format. You can do this inside the export options. UPDATE: This problem should be fixed in Unity version 3.20f4.
- You can either import one giant Maya file with every animation in it and split them inside Unity or separate the model file and each animation into their own scene files. Name the animation files with the model_name@animation_name convention. e.g. person.mb, firstname.lastname@example.org, Person@flipping.mb, etc. The @ method is recommended because splitting them inside Unity is annoying.
- You can use standard Maya controls to navigate the space in Unity. Alt + Mouseclicks to move the camera, f to focus.
- In the FBX Export options, remember to check the box for baking the animation (see Fig. 5).