Friday, 27 September 2013

Normal Mapping the Time Device + basic Normal Mapping tips

Normal mapping in Blender always seemed such an awkward thing to accomplish. After reading into "mesh exploding" something finally clicked! If you want to know more about normal mapping I made a mini tutorial at the end of this article.

Now about the Time Device prop. I started modelling using the subdivision method as described in the scientist character modelling overview. This allowed me to make it look as nice as possible and not worry about re-topologising it later.
Image showing the high poly mesh before exploding

Image showing the mesh after optimisation

Once a Low poly mesh was produced, I removed the parts that can be duplicated and unwrapped it as efficiently as possible.

Next, and this is important, I made a copy of the low poly mesh and moved it far away from the original meshes. I then "exploded" both the high poly and original low poly meshes as described on some other sites. This essentially consists of taking all the parts that can be separated (anything that's a separate mesh, or can be made separate) and moving them far from their original positions.

Note: This is done for both high poly and low poly meshes making sure each corresponding high poly and low poly parts overlap.

Image showing how the high poly mesh was exploded. The low poly mesh was then matched as closely as possible.

Image shows how the high poly and low poly meshes are overlapped ready for baking

This may seem crazy but remember that mesh copy I made? The non-exploded and exploded versions share the same UVs. This means that a normal map baked on the exploded version, will work on the non-exploded version and be glitch free! The original low poly mesh is left untouched and baked map can be applied to it!

Image showing how the baked normal map on the exploded mesh applies fine on the non exploded mesh

Exploding the mesh reduces the interference between all the components and seems to produce much cleaner results.

Hope someone found this informative. Read on for more normal map related stuff!

Mini tutorial - Normal mapping Distance and Bias settings

This is something I only recently understood.

Lets make a normal map for this object (the picture shows the low poly and the high poly models):
Image shows the high poly model that will be projected into a normal map

I have identified the parts which will cause issues with the baking. In this case it happens to be the corners because the low poly deviates a lot from the high poly. 

The distance value represents an imaginary "cage" around every mesh comprising your model (or Object). This cage is both on the outside of the mesh and on the inside. The Distance value can only be made positive. Nevertheless the cage extends the same distance in the oposite direction. This ensure that no matter if the high poly extends outside or inside the low poly, the cage will still pick it up. The Bias is another imaginary cage, around your meshes, inside the first cage. The values are in Blender units (Bu).

So for each separate mesh in your model (within the same Object), you will get a separate cage with the same settings. You may need to explode your model as I explained above if this causes problems.

Anything outside the Distance (or cage) will not be baked. So when you get some solid colour artefacts in your bakes, this happens because the high poly mesh has polygons that extend beyond that distance. They intersect with the cage. You simply need to increase the Distance value until the cage is large enough that no intersections occur.

Distance, in Blender units required for the bake to work

You can see that in order to resolve the detail of the high poly mesh, we need to set the distance parameter to be as close to the maximum distance between the high poly and low poly mesh. In this case, the maximum distance between the low and high poly models occurs at the corners and is around 0.1 Bu. So that's the minimum Distance value I can use for this low poly mesh.

The Bias value functions in a similar way. Anything inside the Bias cage will be projected onto the mesh to which that cage belongs to. Anything that extends beyond the Bias will not be baked.

 The first picture has a Bias of 0 and even though the cube is still within the Distance, it doesn't get baked to the normal map. This shows why the method above works .

The second picture shows that with some tweaked values you can project the cube onto the map. It also shows the Distance and Bias cages and clarifies what the Bias value does (please ignore the fact that I forgot an edge loop resulting in the corner of the main mesh being a little screwed up).

By making the Bias 0, the cube was totally ignored. Setting the Bias to the correct value (the distance from the surface of the main mesh, to a point beyond the cube) allowed the cube to be projected on the surface.

Note: in order for this to work, you need to increase the Distance value so as to include the cube within the Distance cage (see the previous picture).

In most cases the Bias value is not needed unless you want to project some objects onto your model e.g. you could project some screw holes, rivets, shirt buttons or anything that stands out from the surface of the mesh onto the normal map without needing extra geometry on the low poly mesh. This is good for many situations where you want to add small details without increasing poly count.

In conclusion here are some basic settings to keep in mind.

Single mesh where low poly matches high poly very closely:
Distance = 0.2
Bias = 0

Multiple meshes (say, box with complex surface plus screw holes around 0.1 Bu away from the main mesh)
distance = 0.2
Bias = 0.15

Note: these values will need to be tweaked because every model has a different scale etc.

I hope this was useful to some people! 

1 comment: