June 25, 2011

Modelling in Maya 101 – Part 1

by Mathias Tangen Leganger

Hi and welcome to this series on modelling and texturing game characters. My name is Mathias and I am a modeller on the game “Evil Junior” currently under production by Illuminatics Gameware. I will be using Maya as my main tool in this series of tutorials, but the principles I’ll touch upon applies to all 3D packages out there, so as long as you know your way around those, you should be able to get something out of this. In addition, I’ll use the functionality of ZBrush and Photoshop (you may also want to use your sculpting or painting package of choice).

Here is a quick crash-course in Maya, before we venture into modelling the base mesh for our character. Those of you who feel comfortable with Maya may want to skip to the modelling section, or hang around and perhaps pick up a few new tricks along the way.  With that out of the way, let’s get to it!

The pipeline

This is how we work on game characters for “Evil Junior“, and I will be using it as an example and go through each step of the process in the following set of tutorials

In Maya

  • Initializing the project
  • Creating the base mesh
  • Unwrapping UVs
  • Exporting to external application

In ZBrush and Photoshop

  • Sculpting in ZBrush
  • Texture-painting in Photoshop
  • Optional: High-poly in ZBrush
  • Optional: Texturing in ZBrush

A little lingo

Just so you’re not thinking of stopping reading right here, allow me to demystify some of the common lingo used when modelling:

  • Vertex – a single point in space
  • Triangle – a face with three edges and three vertices
  • Edge – a line segment connecting two vertices
  • Face – the convex hull of a set of vertices which all lie in the same plane
  • Quad – a face with four edges and four vertices (see right)
  • Polygon or N-gon – a face with multiple faces and vertices
  • Mesh – a collection of faces, edges and vertices making a 3D object
  • Poly-count – the number of polygons in a mesh
  • UV – a local 2D coordinate system used for mapping parts of a mesh to a 2D plane

Tips and tricks

During my time as a modeller I have learned a few things that can save you a heap of time. The essentials are of course to make a plan before you start working – this includes collecting references for anatomy-studies, inspirational images and looking over what other assets your game/demo/whatever already has so that you make sure you stay close to the material that exists already. In addition to that, here are a few bullet-points (literally):

  • Organization: be consistent in your naming conventions and how you organize files and folders
  • Don’t over-complicate your design: be conservative when adding edges, polys or quads – look at what you need first
  • Size: keep an eye on the poly-count – a poly-count run amok can easily make your design worse (and make the 3D engine suffer)
  • Be a []: when possible, use quads – ZBrush prefers quads
  • Keep a good edge-flow: you (and your animators) will appreciate this very much
  • Look behind: enable Backface Culling and Border Edges (the setting is under Displays -> Polygons)
  • Trim: routinely use Save -> Edit -> Delete by type -> History to keep your project file lean and mean
  • ..and the obvious one: make Google your friend – it’s an excellent source for looking up things and finding image references

Controls and layout in Maya

The layout of panels and controls in Maya differ slightly from other 3D packages, and requires a little getting used to. For reference, here are the three things you need to know:

  • Use your keyboard as if you’re playing an FPS-game

  • The spacebar brings up the context menu. Use the mouse to select between the options presented.

  • Right-click to bring up the relative context menu

The main Maya workspace has five areas you should familiarize yourself with early. The sooner you know these elements and what you use them for, the sooner you’ll stop being annoyed at the UI and start producing.

  1. The shelf: place your favorite tools here for quick access
  2. Outliner: this is where you organize your objects
  3. Viewport: navigating in 3D space, looking around your object
  4. Attribute editor: various settings related to your object – very nice to have on screen and handy at all times
  5. Layers: use it to hide elements in your scene to work without visual interruptions

You may want to change some of the default settings in Maya. Don’t let the defaults slow you down.

  • Windows -> Settings/Preferences -> Preferences
    Add your project folder under Settings -> Files/Projects
  • Windows -> Settings/Preferences -> Plugin-in Manager
    Check Loaded and Auto load for objExport.mll so that you can export those nifty meshes of yours as .obj files to ZBrush
  • Create a new project: File -> Project -> New…
    Insert a name and your project folder, chech Use defaults and let Maya do all your dirty-work of creating folders for your stuff
  • Suggestions for organizing your content:
    /scenes – where you save your work
    /sourceimages – where you keep your reference images
    /textures – where you save your maps
    /data – where you put your .obj files in transfer to/from ZBrush

Every craftsman needs the right tools. So let’s do a break-down of your digital toolbox.

  • Choose Polygon to add the tools for polygon modelling to your tool bar
  • Create your own customized shelf by pressing the box in the shelf, and then New shelf 
  • Find the tool you want to add, for example Mesh, and CTRL+SHIFT+Left click so that your tool pops in place on the shelf
  • Oops, something went wrong? Middle click+Drag the icon back to the trash can on the right or change the order of your tools
  • All done? Save your shelf
  • Can’t decide on your tools? Here is something to get you started:

It is time to start on our game character in Maya!

Block-modelling

There are many ways to go about modelling a game character. Here I will use a technique called “block-modelling”. In a nutshell, you start with a cube and slice, dice, push and pull until, shazaam, you have a game character. It is easy to get lost in this process, so some reference may come in handy.

As reference, you may want to draw some sketches of your character (or ask your concept artist if you have one at your disposal). For best effect, the sketches should be ortographic with front and side view with as little perspective distortion as possible. Front and side view should also be properly aligned. You can use rulers while drawing in Photoshop to make sure key features, such as nose and shoulders, of your character are aligned. This way it will be much easier for you to block in those forms of your amazing character.

With your reference in hand (either drawn by you or your minions in the art department), it is time to import your sketches as image planes in Maya. To do so, create a primitive plane with the same dimensions as your reference image. Make a note of these dimensions and use them as reference for scale in your scene. You could for example make your drawings 1000×1000 pixels in Photoshop, and then make a 10×10 plane in Maya. You can choose your choice of unit in the Maya settings and use centimeters for your planes if you need exact unit references in Maya. Scale and rotate your plane into place so that it faces your front view. Use your tool settings in Maya to make sure the plane is parallel with the grid lines. Make a duplicate of the plane and rotate it 90 degrees so that you can see it in the side view. Then open your hypershade and assign a new lambert material. Double-click your new lambert material and enter the attribute editor by clicking CTRL+A. Click the square next to color and find your reference image under file. Repeat the process for your side reference. Done? Put your image planes in a new layer and check the layer so that it reads R. That way your planes are frozen in the background so that you do not accidentally move them around.

We are now ready to start the modelling process. Use the default four-splitted viewport with your image reference visible in your front and side views, and tap space in one of the viewports to snap in and out of that view. Create a primitive cube and embark on your block-modelling journey. Snap the four vertices one side of the cube, and snap those by holding X to the line x=0. In your front view, you should now see one half of the cube extend from the center line and outwards. Select the face of the cube that faces the center line (x=0) and delete it. Now, make a duplicate instance by checking this option in the settings for duplicate. (You may need to choose the correct axis as well.) This way, you have a cube with two halves: You edit one side, and Maya transforms the side across the center line. Work on half the mesh, half the work for you. You can save a lot of time by working symmetrically as long as possible. Thus, save your asymmetric key-characteristics for the end-game of the modelling process (simply delete your duplicate instance and create a default duplicate mirrored across the axis, delete the faces on the center line and merge the vertices on x=0).

While modelling, you can repeat this iterative process:

  1. Push/pull one vertex until satisfied with the form
  2. Add an edge loop where you need more vertices

You can also insert edge loops manually with the split polygon tool. If you have several objects in your view port (for example if you want to merge the mirrored halves of your mesh) simply use combine and then snap vertices on top of each other by holding V. Then merge. Check your HUD if the vertex count drops. (You may need to tweak the merge distance in the settings if your vertices do not merge properly.) Remove redundant edges with delete edge/vertex (removes them both).

When you are satisfied with your mesh, select the duplicated instance and delete it. Select the original mesh, then duplicate. Combine the two halves. Delete any faces on x=0, snap any straying vertices to x=0 and  select all vertices along the line x=0. Merge the selected vertices and check if the number is chopped in half.

Cleaning up

Now we should check for any anomalies. This will save us a lot of time later on.

  • Display ->Polygons -> BackfaceCulling – reveal any faces with flipped normals
    Use Normals -> Reverse on those nasty “invisible” faces
  • Display -> Polygons -> Border Edges – reveal edges with “unmerged” vertices as bold lines
    Snap any straying vertices on top of each other and merge them. Check your vertex count
  • Mesh ->Cleanup… – check Faces with more than 4 sides
    Maya helps you find other irregularities in your mesh
  • Finally, ”smooth” your mesh with Normals -> Soften Edge

Now that you have a clean mesh, assign a lambert material to it (if you have not already done so). You can assign individual materials to specific parts of the character (as in the picture below) to aid you in your texturing process later on. Be aware, however, that you need to unwrap the UVs of your mesh before you assign any map that contains textures to your mesh. Basically, you now have a mesh that is 3D. Your texture maps, on the other hand, are 2D and generally painted in 2D applications such as Photoshop. This is like having a 3D animal that is all gray, and a 2D pelt that contains all the color. What we need to do is to “skin” our 3D character by “unwrapping” its UVs. We then “paint” our texture onto its “pelt” and throw it back onto our mesh. With unwrapped UVs, Maya knows how to project our 2D textures properly onto our 3D mesh. In the image below, you see how Sir Nigel Rochester has his colorful “pelt” projected onto him from the texture map created in Photoshop. We will go about painting textures later on in the tutorial. Now, however, we have some UVs to unwrap.

UV unwrap

OK, it is time to skin our animal and nail the pelt to the wall so that we can paint on it. To do so, fire up your UV Texture Editor inside Maya. Select your object and you should see its UVs spread all over the place in the UV window. In the picture below, the UVs are already unwrapped, and you can see the order emerge from the chaos. Let us impose some order.

Press Image -> Shade. Blue faces are OK, whereas red color indicates overlapping UVs. We do not want overlapping UVs. (Overlap means that one pixel on the texture map will be projected onto several locations on your mesh.) All UVs should be contained within the 0-1 UV space, as marked with a red square in the picture above. There are a variety of UV-unwrapping tools that can be used for the specifc task (or body part) at hand:

  • Planar – for flat stuff, i.e. walls
  • Cylindrical – great for arms, legs and (some) torsos
  • Spherical – works wonders for the head and eyes
  • Automatic – for other stuff (some people only use automatic mapping, but beware of LOADS of tiny pieces in the UV TexEd!)
  • Create Uvs based on camera – this one works pretty well for hands. Select the faces on one side of the hand and map UVs with your camera pointed perpendicularly above it. Repeat for the other side. You now have two sides of your hand in the UV TexEd you can stitch together along one side

Now, throw a checker texture on top of your mesh. This can be the Maya checker or some image. (Google “uv map template” for some nice checker textures.) The squares of your texture should appear as squares in the viewport when projected onto your mesh. This is important in order to avoid texture distortion.

  • Right-Click to select edges (orange) or UVs (green)
  • One edge is connected to another edge, as highlighted in the picture above. You can weld these edges
  • Move your UVs around carefully and be aware of texture distortion (check your viewport!)
  • Use the tools Move and Sew, Separate and Unfold until you have a mesh with cleanly unwrapped UVs (your checker texture should appear nicely with no distorted sqaures)

That’s it. Unwrapping UVs is a hate-it-or-love-it thing. You may actually like it as a puzzle, sort of a interlude between your modelling and texturing. If you hate it, or if you would like to speed up the process, I would recommend trying a third-party UV unwrapping solution. You can get plugins and external programs for this purpose. Headus UVLayout is a great program for unwrapping UVs for organic meshes, such as humanoid characters.

That concludes our UV unwrapping. We can now go ahead and assign maps to our character.

Assigning maps

You can assign a variety of maps to your character.

  • Diffuse map – the “color” of your character enters color -> file
  • Optional: Normal map – the magic geometry that is “not really there” (created for example in ZBrush) enters Bump Mapping-> File (choose Use as: Tangen Space Normals in the Bump2d node)

You can assign other maps as well, such as specular maps for how much light is reflected. If you want something really advanced, play with the hypershade network and create awesome shaders on your own! This is way beyond the scope of this tutorial, but there are many good tutorials out there on the web.

In the next part of the tutorial, we will create a diffuse map for our character and paint the texture in Photoshop. That concludes the first part of this tutorial. Hope you enjoyed it, and look forward to see you for the next installment!

 

avatar
About the author, Mathias Tangen Leganger

Mathias is a student of technology and business in the day, and game artist in the night. He has been a mentor in 3D modelling at The Gathering, 3D designer at the Norwegian Defence Research Establishment, and modeller and texturer on the game Evil Junior for Illuminatics Gameware. Currently stuck in the godforsaken city of Trondheim, he plays and coaches tennis when he is not pushing vertices or crunching literature.

Leave a Comment