Wednesday, November 8, 2017

Let's talk baking!!!

OK, so, you have a high-res mesh, and a retopoed low-res mesh, and now you're ready to get busy with some baking...  Let's talk about the basic hows and whys as a refresher....

1: Why do we bake?
The most simple way I can explain it is, we do it for the details.  Many games and films utilize pipelines that allow you to sculpt high-resolution detail on one model, and project those details on to a model of reduced geometric complexity -- i.e. baking.

Here is an example of a character with relatively low geometric complexity, but higher frequency detail captured by baking a normal map in substance painter from a high resolution Zbrush model.  (I shared this asset with you guys, so it should be in my share folder at school.)

With a Substance pipeline, the baking process can yield even more benefits than adding detail alone.  Substance allows you to paint actual materials (or substances) layer by layer, but the baking you do in substance can help you easily create effects that allow you to blend between substances convincingly.  

2: What do I need to get started baking? 
A: A high resolution, sculpted mesh (Zbrush in our case)
B:  lower resolution mesh, with good topology, shader assignments, and UVs (Maya in our case)
C:  baking tool (Substance Painter in our case)

3: Is there anything special I should know?
Yes, lots actually.  While naming and UV's and Materials sound like really boring topics, it's important to get these aspects right because doing them correctly once will ensure smooth progression for the creative aspects later.  Neglect the tedious stuff up front, and run the risk of paying for it 10X later.

 Here are some major things to consider:

A: Naming matters! 
The names of your subtools in Zbrush should correspond to your names of meshes in Maya.  Say we have three objects as separate subtools in Maya.  Let's call them: Thing_A_high, Thing_B_high, and Thing_C_high.  Notice, each subtool has the "_high" suffix.  Also notice the first letter of each subtool is capitalized (this is something Zbrush does).   

In Maya, I'll have the same names for the low-resolution models that correspond to the subtools in zbrush.  So, I'll have three models called:  Thing_A_low, Thing_B_low, and Thing_C_low.  Naming (and case sensitivity) will be very important for baking later. Make sure the names of your models (Maya) and Subtools (zbrush) have the same base names, and the appropriate high/low suffixes.

B: UV's matter!
You need to have clean UVs that correspond to the mesh shapes for your low-res models.  Your high-res models never need to have any UVs.  Stretching, non-mirrored overlapping, or improperly scaled UVs will lead to terrible artifacts. Your UVs should be clean, and proportional to the model in world space as we discussed in class.  

C: Materials matter! 
Each texture set should be labeled as a different material in Maya.  The names of the Materials in Maya will become the names of the texture sets in Substance Painter.  For example, if  I want three different texture sets for the three spheres described above, I might make three materials called: Thing_A, Thing_B. and Thing_C.  If I want the models to share a texture set, I might just make a single material called something like "All_Things."  The texture set names can help us drive the names of the textures we export from Substance Painter, so it's really important that we make sure to name them!

D: File Format matters!
When I have multiple objects to bake to a single texture set I usually choose FBX from Zbrush (zplugins>>FBX Import/Export).  The main reason for this is it's a single file which remembers the names of all of the individual pieces of geometry.  When coming from Maya, I also usually use fbx because it remembers names of geometry and material names (both of which will be important in Substance.  So, when in doubt, use fbx instead of obj.

Taking the above in to account, here is what the Zbrush file should look like for the high-res models. Note subtool names/orginzation.
When you are ready to export, make sure your desired subtools are visible, and go to zplugins>>FBX Import/Export.  Make sure it's set to visible subtools, and hit export.  For larger polygon counts, this can take a while:

Taking the above in to account, here is what the Maya file should look like for the low-res models.  Note the UVs, naming, and material assignment.

4: Let's bake already!
First, let's set up our project.  When you open Substance Painter, go to the File>>New  Menu.  Choose Mesh>>Select and point to your low resolution FBX file (exported from Maya with good names, UVs, and material names).

Once that loads in to painter, you can begin to bake.  In the "TextureSetSettings" tab, click on "Bake Textures."  In the High Poly Parameters section, click the plus button to add your high res FBX (from Zbrush, with named subtools).  Next, click on the "same Mesh Name Only" in the common tab.  Also check this box in the Ambient Occlusion tab as well.  If you have multiple texture sets, you will definitly need to make sure you click on "apply to all texture sets button" here too.  I usually do an initial test bake at a low resolution, like 512, then, after I confirm the bake works, I re-bake at a higher resolution and usually with Antialiasing on at 2X2 or 4X4 depending on how fine I want the bake to be.  You may need to adjust the "maximum frontal distance" and "maximum rear distance" in the bake if you see small artifacts in the bake.  This extends how far the low res mesh will "search" for a high res mesh to compare to.  Setting up the initial bake is an iterative process, keep working at this part until you get a good looking bake.   Remember, the textures generated from these bakes will be used as the foundation for your shader work later, so getting good bakes with few artifacts is key to having success later.
 

You can visualize your individual bakes on your models and in the 2D view by hitting "B" on the keyboard repeatedly.  This will cycle through the bakes.  Hit "M" to return to material mode when you are done checking your bakes.


That's it for baking.  If you are having trouble with bakes, please make sure you check out this list to make sure you're following these guidelines.  Another post about painting an iterating on textures will be coming soon, and make sure to check out the previous post regarding the model setup, topology, and UVs.  (Also, for the 3 sphere scene, I shared this asset with you guys, so it should be in my share folder at school.)


No comments:

Post a Comment