High Poly To Low Poly: Decimating And Baking in Blender
OK you have got a high polygon Blender model with let's say 10-20k vertices, maybe bought from one of the 3D model shops out there, and now this needs to be decimated because processing of animations takes ages in our game. How can we do this in Blender 2.5x/2.6x?
Mesh Manipulation Strategies
Back in Blender 2.4x there was a python script called mesh_poly_reduce.py by Campbell Barton that did the job not too bad and was highly respected in forum posts. But it was not ported for 2.5 and a deeper look into it told me that I am not the one able to do the job - what a pity.
After doing some more research I found out that there are mainly two ways to go:
- Retopo strategy
Put the high poly on layer 2, lock it in outliner view to be not selectable. Then start on layer 1 from the scratch while both layers are visible. This way you do a complete remodeling based on a perfect template.
- Decimate strategy
- Again put your high poly on layer 2, make a copy and put it on layer 1. Then add the Decimate modifier to your low poly candidate on layer 1. Play around with the decimate ratio and apply it when the number of vertices and faces seems to be fine for you.
Now start adjusting the somewhat damaged low poly model.
- One of the readers left a comment pointing to an open source tool called MeshLab. I didn't try this out because I didn't know about it. But it seems definitely a better starting point than the decimate modifier. There is a video tutorial (12 min) at cgcookie.com: Decimating Sculpts with MeshLab
Which one is better depends on the demands and and last not least on your modeling skills. Maybe after all I would prefer the first method next time (s. Low-Poly Character over a High-Poly model or A quick guide to using Blenders Retopo(logy) tool).
Decimating with Decimate Modifier
I started with about 700 vertices because mobile platforms require less than 1500 triangles. The following guidelines might be useful even if you decide to take the retopo way.
- Keep your model in symmetry. Either use the mirror modifier or delete, duplicate and mirror the "better" half of the mesh and use X mirror setting in edit mode. Bear in mind that X mirror setting does not affect extruding, deleting, etc. but just transform operations.
- Merge (Alt+M) and Remove Doubles are your tools to eliminate unnecessary vertices, use the limit value when removing doubles from selections.
- Try to create edges at all those places where materials change e.g. the border between shirt and trousers. This will save time later for UV mapping and baking.
- If regions of the high poly model that use textures via UV mapping can be reflected on the low poly vertex setup, it helps on UV mapping.
- Take care for all joints your model will need later on. So your knees and elbows for example will be easier to manage while skinning the rig for animation.
- Don't put too much effort on face modeling because texture and normal map help you to gain an acceptable quality.
UV Mapping/ Seams
I found the Smart UV Project is performing pretty well for easy and more static models, but for my human model this is useless. The only way to get a good mapping is by creating the right seams. Again there is no one and only rule but a few hints:
- Take the edges where material changes. If you need to adjust UVs manually it is easier to detect the right position.
- Mark seams on every sharp edge.
- Cut the body vertically at both sides or in the center (belly button).
- I didn't find a way to select all seams at once later on in Blender so I assigned every new seam to a vertex group before hitting Mark Seam.
- The face should be one separate region.
- If parts of your high poly mesh use textures and the low poly's vertices are similarly structured, it is a good idea to separate these regions with seams.
If your seams are placed well there is almost no manual editing in UV editor needed. So take your time to save time.
Baking Texture And Normal Map
To get more information about the principals of baking see for example:
Blender 2.5 Making a model low poly and baking textures onto it (describes the decimating whole process)
It took me days until I finally got a good result because I made two errors. The first one was discussed above - the seams. The second one was smoothing before baking. The problem was that low poly model with freshly baked normal map looks like Frankenstein at the edges although it contained the correct normal vectors at all other positions:
The solution is to select the low poly in object mode and click smooth. After this you have to repeat the procedure of unwrapping and baking.
Other things you have to take care of are:
- Remove doubles. Select all your vertices in edit mode, hit Remove Doubles and increase slightly the Merge Threshold.
- Recalculation of normals with all faces / vertices selected. It looks like:
If there are still faces pointing in the wrong direction you can use Flip Direction (on the affected only) to adjust them.
- To get an idea of where your normals are pointing you can enable Display Normals / Face in edit mode under properties (N) Mesh Display to see them:
- Hidden faces that reside inside the model can lead to trouble in combination with textures and normal maps. Displaying the normals can help you to detect them.
- If you want to bake textures and normal maps you have to use 2 texture channels for your low poly material with different images. I often saw that Blender got a little bit confused when switching between them. So always check in UV image editor if the image you just selected is the same after baking. I always do a manual save file (Alt+S) in UV editor after baking. Sometimes you have to refresh the images in texture view manually to be sure that they are up to date.
2 or 3 times I ran into the situation where the baked image was black and white. I got that fixed by doing unwrap again.
That's it so far. I hope this tutorial helped you a little bit navigating through all the pitfalls. My take home message from spending a lot of time with this:
I would never buy again a high poly model that needs to be decimated. Instead I would do it on my own because it is easier and if not even faster, at least more sustainable because at the end you will have learned more about modeling than just the boring and time consuming process of bug fixing.