Unified Detail Mapping in Cryengine

Overview

Unified detail mapping (UDM) is in this particular case, basically a reversed detail map. Usually the detail map is used for finer details as you get closer. UDM is the opposite. It helps to define big shapes viewed from the distance.

Since the close up detail is provided in the regular tiled textures, we need for big cliffs, rocks, trees, etc. bigger detail to define the shape better when viewed from the distance. The process is very easy, the only thing it requires some rearranging of the layers and some very simple math.

As you can see below the two images the first once is the same rock without and with the UDM.

Making the tileable texture and laying out the UV's for the low poly

First thing is to lay out the UV's for our low poly and make the tileable textures. Please lay out your UV's as you would custom paint your texture to it. We will need that for our UDM. The textures will be tileable though, so please be smart about where you put the texture seams.

Baking out the normal, gloss and AO map out of the sculpt

From the sculpt done in Zbrush/Mudbox we have to bake out three different maps out of our sculpt:

  • The normal map.
  • The AO map.
  • The gloss map.

For the AO map we need after it has been baked out to bring the value down to 128 since as the UDM it will be used as our diffuse texture and being white it will make our whole asset brighter, since we don't want that we need to adjust the value to 128.

Rearranging the layers for the UDM

Now that we have all the required maps baked out we need to put them all into one map and rearrange our layers. First create an empty texture with the same size as our bakes (in this case a 2048 x 2048 texture). Now we take the bakes and start splitting them up.

First we take our normal map bake and go into the layers. We need to take the red channel and the green channel and then put it into the green and alpha channel of the new texture created. You can also put additional diffuse detail textures and color them with the vertex coloring.

Next we take the AO map and put it into the red channel of the new texture. At last we take the gloss map and put it into the blue channel of the new texture.

Our map will look like this once all has been assigned.

Saving out the UDM with the correct settings

Once we have our map done we need to save it out correctly. When you're saving it please name it always (name of texture)_detail.crytif. Save it out as a crytif and in the scroll down menu, choose MergeDetailMap_HighQ.

As for the size, a good size is a 512 x 512 texture for an asset that's 20m large. It's advised not to go higher than 512 x 512 since it's an uncompressed texture and a higher map will use up too much memory.

A super sharp texture is not needed as the tileable texture establishes that and the UDM establishes the shape.

Setting up your Textures in CRYENGINE

Once we have all that done, we need to set up our shader in CRYENGINE and decide the right tiling ratio for our UDM.

Once we have our object in the editor we load in our tiling textures first and set out tiling for it. In this case it's 5 times in U and V.

Next we load in our UDM in the Detail map slot and turn on the detail mapping in our shader settings. Once that is done we need to apply some simple math.

To get the right tiling ratio we need to divide 1 by the number of the tiling of the tileable texture. In this case it's 1 divided by 5 which gives us the result of 0.2. We put that in the tiling value of U and V in the Detail map slot.

After that is done we set up our blend map as regular.

Adding some vertex coloring is also a great way to give some extra break up our tileable texture and make the whole object more interesting.

If everything went correctly we have our asset with the UDM and it looks like this.

Adjusting the Detail bump scale and the Detail diffuse scale

There are two main settings in UDM which we can adjust:

  • The first one is the detail bump scale. Adjusting this setting will decide how strong the normal map comes through. With a value of 0 it won't show up at all. The higher we go the more stronger the normal map will show and come through. For UDM in this case a value of 1 should be enough in some cases a higher or lower value will be required. It depends on the asset and should be tweaked till it looks good.
  • The second one is detail diffuse scale. Adjusting this value will decide how much of the the diffuse map will come through (in our case the AO map). The higher the value the stronger it will show. For UDM and in our case a value of .75 is enough. But it should be decided on a case by case basis and tweaked.

Detail Bump 1Detail Bump 3

Detail Diffuse 0Detail Diffuse 0.75