Making of Varga - Part 1 - 3D Character Model Normal Mapping in Maya

This is not a step-by-step tutorial. I will summarize the workflow I used for one of my characters with lots of images and some print-screens directly from the applications used (Maya/Mudbox/Photoshop, etc ...), also at the end I will provide some info about tangent space normal maps so you could think of this tutorial as primarily normal mapping related stuff.

1. Intro

This character is my entry for the Dominance War II competition. The main theme of the competition was to design a game (low-poly) character while adhering to some rules (limitations) about the specs that we could use for geometry and textures (main character can't exceed 6000 triangles, 1000 more triangles for weapons/gear and we could also use a pet but the budget will come from the main character; for textures we could use 1x2048 square for main character + pet, if any, and another 1x1024 square for weapons/detachable gear; diffuse, specular, normal, bump, opacity, glow, reflection maps were allowed). This tutorial is intended for game (low-poly) characters and assumes that you have a basic knowledge of normal mapping and its use; you can search on google if you need more info about this subject. I will start by showing you the final files sent to the competition to give you an idea about the direction this tutorial will go.

Concept sheet :

Construction sheet :

Texture sheet :

Beauty shot :

Winning pose :

2. Game Modeling Workflows

Nowadays almost all games are using normal maps for ingame characters, even mmos, so a high poly version of the character will most likely be needed to bake the normals for the low version. The normal maps can be done without the help of a high rez version of the model, from bump maps, even painted directly by hand (I will show you some tricks I use to paint normal maps directly in Photoshop later on) though its less likely that you can achieve the same results as a high poly version would give.

The assets required for the creation of a character will most likely be:

* low poly version (or multiple versions for different LODs)

* high rez poly version used to compute normals for the low poly one (you could also bake occlusion maps and other maps that will help you later when texturing ...see paragraph "4.3.Transfer maps" for this)

* all kinds of textures that the game engine will support (diffuse, normal, specular are the most often used ones)

I suppose that a concept/drawing is available and the steps that will follow are modeling/texturing.
There are mainly two approaches you can take when modeling (the difference between them being the order in which the assets are created):

* low poly model -> diffuse texture -> high poly model-> normal map and other textures

* high poly model-> low poly model -> normal map -> diffuse and other textures

Both ways can give good results if done properly and the choice will mainly depend on the pipe-line already established; I used to work both ways in the past, but I prefer the last approach.

Though the low/diffuse/high workflow might have some advantages (like the low-poly version of the characters will be ready to go down the pipeline to animators earlier in the process, or the creation of the highrez version will be quicker if you work carefully and keep lots of selections into the diffuse .psd file than you can later on apply as displacements on the high rez mesh) it has one big disadvantage and I will illustrate it in a quick example.

Let's say that below is a piece from a model (a shirt with some buttons)... I'll assume the low poly and the diffuse textures are ready ...

 

The next step down the line will be detailing the low poly version, so I will import a cleaned up version of the low poly into Mudbox to upres and detail. Then I will also load the diffuse texture to check that the detail I'll add will register correctly with the diffuse... then I'll start to add divisions/levels to the geo and adding details like big folds and big volumes...



I will use height maps made from the diffuse texture to displace the fine details (it will speed up the process and also this way I will make sure that the computed normal map will match closely with the diffuse than if I were to sculpt directly using the mapped diffuse on top of high) ...



Everything is working well and I will export the final level to compute the normal map with Maya/3ds Max or any other program that will use raytracing for the process and will assure proper display of the normal map in the final engine. But if I was not too careful when detailing, I will encounter something like in the images below (the effect was exaggerated here so I can get my point across).

 010.swf (right click to save)

You can see that the details in the diffuse on one hand and the normal map on the other won't register correctly ... this is due to the fact that during the sculpting of the big folds, I displaced/shifted the geometry a little and though I used displacement maps to add details like buttons, this will not guarantee that when raytracing the details for the normal map they will overlay perfectly with the diffuse. To avoid this, the high rez detailing should be done with care, and if possible, don't do big displacements from the original cage/low poly version ... but this will hinder you since the whole point is to add as much variation in the surface direction as you can -- big volumes included.

 As a side note, if you are using normal maps computed within Maya (with the Transfer Maps Tool) and want to render with the mental ray renderer within Maya, than make sure to check that in the Render Settings dialog -> mental ray tab->Translation->Performance. You have to have checked the Maya Derivatives (like in the image below - note that this option is off by default). This way, you will use Maya’s derivatives calculation for bump mapping, thereby providing compatibility with Maya for mental ray. Also note that this option is only available when Export Polygon Derivatives is turned on.

 

The second approach for modeling: high poly/low poly/UVs /textures will give you the freedom to start sculpting and adding details from the beginning and you will be free of the problem stated above as well. However, when modeling the high version you first have to keep in mind that this will be used to bake normals for a low poly cage and model it accordingly. You will have to estimate what details are worth adding and that it will be used properly when computing the normal map for the low poly version. For instance, if I have the high poly below:



...I could use a single quad plane for the low poly but the result won't represent the high version very well. When viewed from above they seem to look identical...



But when viewed at a slanted angle, you'll notice that the single quad plane does poorly in reproducing the high details.

 

A better approach is to spend a couple more polygons to make the low poly more likely match the high version.

 

Then the low poly with normal map will look better when viewed at slanted angles. (of course, depending on the polygon budget you could add more geometry to improve the current rugged look)



Also, you have to avoid modeling complicated shape details that will be hard to enclose within a low poly cage later on because they will "eat" too many polygons in an attempt to be displayed properly. Though you might be tempted to go crazy and add lots of detail as shown below.

 

The high rez model might look nice but when building the low version on top of the high one, you will always have to stay within a polygon budget (5-10k triangles or whatever) and if you did not plan high poly details in advance you might face the situation where you will need more polygons than allotted to better match the already high model, and you will have to go back and change the high version. But with some practice you will know what details are worth incorporating in the high version and what details to drop because they will be hard to reproduce.

Another big advantage of the last workflow is that you could also bake an ambient occlusion map and other maps (a simple diffuse pass or even specular passes to give more variation to the textures) using the detail from the high poly model -- and you could use them as a starting point for the textures.

Also you could try a combination of the two methods shown above, in fact this is what I have done for Varga and I will show you later on in the following paragraphs.

3. Tools Used

Before I start showing you the workflow I used for Varga, I will summarize the tools I used for this project.

First let me summarize the specs of the PC that I worked on because most of the limitations I encountered on the way were hardware dependent:

* Athlon XP 2500+ @2400 (but overclocking won't do much good on this old machine smile)
* 1GB of RAM
* Video GeForce 6600GT

You can probably guess that this is no high-end machine and I was seriously limited to the number of polygons I could use at the same time (in Mudbox I could go as high as 2 million triangles but then it moves too slow), in Maya, I had a lot of crashes when trying to import .obj files bigger than 1.5 mil tris (not enough RAM) and I tried to break down the model into pieces (head, torso, hips, legs, arms, etc.) so that I could attain enough polygons to sculpt the details I wanted without crashing or unmanageable scenes (usually the polycount per piece will not exceed 1mil tris).

Regarding the software used ,I am mainly a Maya user so lot of the work was done in Maya (modeling, UVs, texture baking, rendering).
For high rez sculpting, I used Mudbox (built a low cage inside Maya and exported it to Mudbox for further detailing). After the sculpting part was complete, I exported one of the higher levels as a .obj file (usually a 100-300k tris mesh worked fine at this stage, no need to export the highest level) and imported it to Topogun, along with a low poly cage (if I already have one, or if not, build a new one from scratch within Topogun) and rebuild the topology to better match the details. I added to the high rez mesh. After this process was complete, I import the low and high versions back into Maya and compute the normal maps using the Transfer Maps Tool.
The normal maps were further tweaked within Photoshop; some were done completely in Photoshop (check the maps for Peril- the bow later on).

Now that I'm done with all this chit-chat, let me show you some WIP images in the following paragraph.

4. Workflow Used for Varga

Usually for game characters you will have some specs to follow : limit to the number of triangles , size and numbers of textures used; you will have to conform with the number/size of the textures but if you exceed the polycount by 500 - 1000tris (let's say for 8k budget) and the character is looking cool...it's less likely the client will be mad . For this competition, the limit was 6000 tris and I didn't want to exceed that so the first step was to build a low poly cage to allot the polygons between all the assets (the main char, pet, weapon). It doesn't have to be final, but it does allow me to see what details I can incorporate into the high version.

4.1. Low Poly Cage

Below is a quick time lapse with the first low poly versions (the triangulated one is the final version).

018.swf (right click to save)

After I modeled a low version of the whole character, I had a better idea as to how I was going to distribute the polygons between the main character, the pet and weapon/gear. The next step was to start breaking down the model into pieces and cleaning them up. For sculpting, it's better to have clean topology, mostly quad faces -- try to avoid triangles and situations when more than 4 polygons will meet at one point (add extra tessellation to get rid of all the irregularities in the mesh; this way you will have more predictable results when subdividing and sculpting). You can move triangles and points where more than 4 quads will connect in the areas that are less important/visible. Also you should aim for a topology that will have mostly square quads (avoid polygons that are more than double in one direction than in the other....add extra tessellations to fix this ... remember this will be for high rez so the polycount won't matter).

 Below are some pieces ready to be imported into Mudbox and detailed further.

4.2. Detailing in Mudbox

The next step is to import the cages into Mudbox and add as much detail as you or your machine can ... one will break eventually .

This is the most fun part for me in the whole workflow...I will show you some time lapse images with the progress for some of the sections.

Boot (little below 1mil tris for the highest level) (right click to save)

Hips (1.6 mil tris for the highest level) (right click to save)

Leg (around 500k tris for the highest level) (right click to save)

Arm (around 600k tris for the highest level) (right click to save)

Torso (around 800k tris for the highest level) (right click to save)

 Below you can see the entire high rez model at 8.5mil triangles (I managed to import all the pieces into Maya for this tutorial on my new machine, but Maya will eat up like 3.5G of RAM for this)

025.swf (right click to save)

Now that the fun part is over I will take the low poly version I have done in the beginning and change it to conform better with the high rez version. I used Topogun for this -- imported the low version and one of the higher levels as a reference model, change the topology however I want and I will make sure that the low poly will resemble as best as it can with the high version in order to get good normal maps when baking normals.

 

I will repeat the same process for every piece I have sculpted separately and when everything is said and done, I will be ready to go to the next stage -- baking the normal maps.

4.3. Transfer Maps

At this point the low poly version and all the high rez pieces are ready and I will continue with the UV mapping.
There are a lot of tools for UVs that you can use: UVLayout, Unfold 3D, plugins for pelt mapping, etc... and some will say one is better than other but I do all my UV work with the tools built within Maya. They might require more attention and planning on where to cut the UVs and sometimes will produce junk UVs but after a second trial, things work well. I have tried Headus UVLayout and Unfold as well, but I like Maya's unfold better because it works faster for me.
I won't show you how I worked on UVs because lots of the people I know don't use Maya for UVmapping and most likely the information I give will be redundant.
The idea is to unfold the UVs with minimal stretching. A good hint is to keep your cuts in the less visible parts of the model (like for the arms and legs keep them on the inner part) and you could break down the UV shells accordingly to the pieces in the high rez version (for instance, the boot will go as one shell, each leg as one shell, etc...)

After the UVs have been completed, I'll be ready to bake normals and other maps if necessary.
I used the Transfer Maps Tool within Maya for this (but render to texture within 3ds Max works the same way).
I will exemplify this process on the boot:

Before starting, keep in mind that the UVs on the piece of geometry you are going to bake normals for should not overlap (in the end you can overlap UVs for arms or other similar objects, but for accurate results, move the overlapping UVs outside the 01 space or shrink them down in a corner or unused space while baking).

-Import both low and high versions into Maya and make sure they are on top of each other.

-Open the Transfer Maps dialog box (found in Rendering menus in Lighting/Shading-> Transfer maps...)

 

-Select the low poly version and in the Target Meshes click on Add Selected, then select the high version and in the Source Meshes click Add Selected (see image above). (if you do not add any geometry to the Source Meshes then Maya will sample all the geo in the scene for the process) -In the Display option for the target mesh, select Envelope (or you can select both to display both the target mesh and the envelope).

 

-This will create an user-editable geometry (merely an offset of the current low poly version) that will be used as an envelope to look for the source meshes. You can change the offset of the envelope by changing Search envelope% slider (or by typing a value); the idea is that you will get better results if you will have the high rez version inside the envelope (like in the third example in the following image)

 

-If you go too far with the offset the baking might not work properly, usually I will do some trial-and-error values for the offset until I have most of the high rez inside the envelope like in the image below.

 

Then select the envelope and tweak its vertices/faces/edges until the high rez will be completely inside the envelope.

 

-Select the maps you want to bake; I will resume to normal map (you could also bake ambient occlusion maps ... this way you will sample the AO from the high rez version, but I didn't have too much time to compute AO maps also because they require some time to render ...depending on your machine, mine was too slow at the time for this; instead I used Batch Bake mental ray with the normal mapped low poly to bake a Final Gather pass for occlusion ... works a lot faster with comparable results... see later on for details). Also, make sure you browse for a path to save the file, select file format, map dimensions and other details you want. In addition, be sure you set the search method to inside envelope only since the high rez will be inside the envelope.

 
-Now you are ready to render to textures and hit the Bake button.

-As a note make sure to save the file before you hit the bake button because after rendering the texture, Maya will delete the envelope and you might need it again (especially if you spent some time tweaking it to better enclose the high rez) or if your map does not look ok and need to rebake, make sure to undo a couple of steps until the envelope pops up in the scene again (saving the scene is safer though smile).

-If the normal map does not look ok from the first time come back again to the Transfer Maps dialog and re-adjust some settings (but when you have an envelope that completely encloses the high rez version, its less likely problems will occur. On the other hand, you will have some hard time if the envelope intersects with the high rez...if you are too lazy to tweak the envelope you could set the searching method to "inside then outside" or to "closest to envelope"; there are situations when it might work and situations when you will have problems: usually you will have problems when multiple surfaces intersects on the high rez version. Let's say those straps on top of the arm for example... in that case, if the envelope intersects with the high geometry as well, then it might sample the wrong surface.


The same steps you have to follow if you are using Render to Texture inside 3ds Max:
-Select low poly mesh, go to rendering->render to texture.
-Check projection mapping (to turn it on).
-Push Pick and select the high rez model.
-Afterwards, Max usually will create a crazy envelope/cage (autocreate process).
-Select the projection modifier.
-Go to cage section and hit Reset to reset the cage (the cage will fit the low poly exactly).
-In the push section, you can change the Amount to offset the cage like in Maya, where it is trying to enclose the high poly version.
-Same as in Maya, you can alter the cage by expanding the projection modifier and tweaking the individual elements until the whole high poly will be inside the cage.
-After all the tweaking is done, select the low poly again and in Render to texture dialog, hit render.
-If the map is not looking proper, you might come back again and do more tweaking of the cage.



Next, I will show you another cheap way of computing occlusion using mental ray and final gather on the normal mapped low poly version (it will not look the same as the ambient maps computed from the high version, but will be a lot faster).

Let's say this is the final low poly with normal map (I will be covering the boot only, but you can apply the same steps for the entire character at once).


 

Make a big plane and place it under your model.

 

Make sure that the environment background color for perspective camera is white (this way when final gather will be used and the rays don't intersect any geometry, then the returned color will be white).

 

Set the renderer to mental ray, make sure that you have checked the export Maya Derivatives.

 

Make sure in the Render Settings-> Common tab ->Render Options that you have the Enable Default Light option unchecked, it's checked by default (this will assure that Maya will not create a default light and pass it to mental ray if you have none in the scene) and delete or hide all the lights in the scenes (if there are any).

 

Make sure to enable Final Gathering (usually I set the Quality Preset in the mental ray tab to Production and then enable FG and increase the accuracy to 1000-1500 and leave the other options to default).

 

Assign a new lambert to the low poly geo and set its color to full white and change the diffuse to 1. (also change the same options for the default lambert or assign a new lambert to the ground plane and set its color to full white and diffuse to 1)

 

Select the material assigned to the low poly geo and assign/connect the normal map texture into the bump channel. Make sure you set the bump as Tangent Space Normals.

 

Before baking, you can make a test render with mental ray and if everything was done properly, you should have a similar result.

 

Next, open the bake dialog found in the Rendering menu set under Lighting/Shading->Batch bake (mental ray) ... go to the options and make sure you check bake shadows and orthogonal reflection, and also set other options to pretty much what you see in the image below ... set the file type and size and you are ready to go!



Hit the convert button and again, if was set properly, you will end up with a texture like below (if you cannot find the textures, you could always check the log or if you did not enter a path in the dialog they usually are saved in the current project folder in renderData/mentalray/lightMaps).

 

It won't be as crisp as an ambient map computed directly from the high version but will compute a lot faster. Using the same process, you can bake some quick specular passes to use for the textures: Save the same scene with another name(spec_bake or something) and disable the FG in mental ray tab; delete the ground plane. Change the material assigned to the low poly to blinn, change its color to black, specular color to white and reflectivity to 0.

 

Make a couple of directional lights and position them to light from above around the object.

 

Use the same batch bake mental ray options, but it will compute super fast now (its tracing only the specular pass, this time, double the resolution when baking and you will donwsample it in Photoshop to use on top of textures... you will achieve better results with this method). You should end up with a texture like below and you can overlay it on your diffuse textures with screen/color dodge blending modes (to give more variations)... it works great for plastic, metal, leather or other materials that have high specularity (it wont look so good for cloth, as an example).

 

Enough said about baking ... bare with me for the last section, in the second half of this tutorial(I kept the cool tips for the end) :-)

Links:

0 التعليقات:

Post a Comment