This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

NormalMapper

NormalMapper is a versatile and fast tool to generate a bunch of height-based textures in one run:

  • A high quality normal map.
    Notice
    To increase the accuracy and flexibility of generation, control the direction of ray tracing using a cage mesh.
  • A parallax map.
  • A height map for tessellation.
  • An additional surface texture to aid artists in selecting and painting separate surfaces.

These textures are created for a low-poly model based on a corresponding high-poly model. The resulting maps being applied to the low-poly mesh at rendering time drastically improve its look making it similar to the a high-poly version.

NormalMapper module

The main advantage over a heightmap-based normal map generator, which usually uses a diffuse texture, is a compensation of distortion of normals. The compensation is done in such a way that the resulting normals, after they are applied, will be the same as for the high-poly model. This can never be achieved with 2D normal map generators.

Usage

To create a normal map along with a parallax map, a height map and/or a surfaces texture, you need to do the following:

  1. Load a low-poly mesh by clicking Load Low.
  2. Load a high-poly mesh by clicking Load High.
  3. Set normal mapping options at the right side of the ResourceEditor window.
  4. If besides a normal map other textures should be generated, specify the Parallax, Height and/or Surface options.
  5. For baking parallax and height maps for one mesh:
    • Set the Level to 0 to bake real maximum height displacement.
    • Set the Clamp to 0 not to clamp any heights.
    Notice
    If several separate meshes are parts of one object and it is necessary to bake their displacement relative each other, see details here.
  6. Click Run to start generation.
  7. Switch to the Normal Map mode to check the generated normal map.
  8. Click Save to save all checked textures.
Warning
NormalMapper is designed to work only within the first UV tile region (texture coordinates [0;1]). Multiple UV tiles are ignored.

Display Modes

NormalMapper has two viewing panes. The display mode can be switched in the the drop-down list in the upper left corner of each pane:

  • Mesh to display a low-poly mesh.
  • Tangent to display tangent space (U in red, V in green and a normal vector in blue) for vertices of a low-poly mesh.
  • Normal Map to display the generated normal map applied to the low-poly mesh. If there are no normal maps loaded, an empty one-channel (red) map will be displayed by default.
  • TexCoord 0 to display a generated normal map according to the first UV set.
  • TexCoord 1 to display the second UV set. Normal map cannot be generated basing on the second UV set. It is for viewing purposes only.
  • Cage Mesh to display a cage mesh.
  • High Mesh to display a high-poly mesh.

File Options

The set of file options is present at the right side of the window:

Load Low Load a low-poly mesh for which a normal map will be baked.

Low-poly mesh

Low-poly mesh
Notice
You can also load the low-poly mesh by pressing Ctrl+O.
Reload Reload a mesh/normal map.
Clear Clear a mesh/normal map.
Load High Load a high-poly mesh basing on which a normal map will be baked.

High-poly mesh

High-poly mesh
Notice
You can also load the high-poly mesh by pressing Ctrl+H.
Load Cage Load a cage mesh. This mesh that allows cleaner baking of the normal map.

Without a cage, the rays are cast from the low-poly mesh to the high-poly one (in both directions along the normals of a low-poly). It is done to determine what point of a high-poly mesh (full geometry of which allows to calculate per-vertex normals) corresponds to a low-poly mesh point. Whatever point is intersected first, it gets to be baked into the map. However, if there are complex geometry details in the high-poly model or overlapping surfaces, the first met point may not be a proper one. Instead of baking an outer surface, an underneath one that is closest to the low-poly mesh will be baked into a map.

A cage allows to avoid such situations. When loaded, the rays are traced from it rather then from a low-poly mesh.

  • A cage mesh is usually a low-poly mesh slightly bloated to be bigger in size and cover both a high-poly and a low-poly meshes. Though even a simple box would do for a cage.
  • It should not necessarily cover all volume of the mesh. The cage can be partial - only above such surfaces where complex geometry details are found.

Tracing of rays with and without a Cage

Without a Cage, rays are traced from a Low-poly mesh. With a Cage, rays are traced from it.

Let's take an example as illustrated above (in section): we have a low-poly mesh (a simple plane) and a high-poly mesh, which has details above its surface. We can also load a cage that is above both a low- and a high-poly mesh.

Without a cage rays will be traced from a low-poly surface (from underneath) and all details will be ignored. With a cage rays will be traced from the cage surface (from above). All details will be properly baked as they are the first surface met.
Without a Cage With a Cage
Normal mapping without a Cage
Normal mapping with a Cage
Notice
You can also load the cage mesh by pressing Ctrl+C.
Normal Map Load an additional normal map. The generated normal map will be combined together with the loaded one. This option allows to create bumping very easily. Additional normal map is displayed in the High mesh mode, i.e. applied to a high-poly model.

Additional normal map

Additional normal map
Notice
You can also load the normal map by pressing Ctrl+N.
Reload All Reload all resources.
Notice
You can also reload resources by pressing Ctrl+R.

Visualization Options

The set of visualizations options:

Info Display information about the mesh that is currently in the viewport. Such data is shown as the number of surfaces, vertices and triangles. After Run was once clicked, the real maximum displacement between a low-poly and a high-poly mesh is displayed.
Notice
You can also enable the option by pressing I.
Compass Toggle an XYZ compass in the upper right corner of the viewport.
Notice
You can also enable the option by pressing C.
Triangles Toggles showing a base grid plane.
Notice
You can also enable the option by pressing T.

Normal Mapping Options

The set of normal mapping options:

Seamless Optimization for UV seams (recommended for tessellation height maps). This option averages the color of corresponding pixels on each side of the seam. Only one-pixel border is affected.
Use 16-bit Create a normal map with a 16-bit precision. It be of better quality, but larger in size. If unchecked, a map with 8-bit precision will be created.
Two Sided Use two-sided intersections.
Parallax Create a parallax map (with _p postfix in the name). The parallax displacement is calculated basing on the high-poly model.

White color represents no parallax displacement; black represents maximum lowering for pixels (according to the set Level).

Parallax map

Generated tessellation height map
Height Create a height map for tessellation (with _h postfix in the name). The height displacement is calculated basing on the high-poly model.

Black color represents no tessellation displacement; white represents maximum elevation for vertices (according to the set Level).

Tessellation height map

Generated tessellation height map
Surface Create a texture with randomly colored surfaces (with _s postfix in the name). This texture is not used inside the Unigine engine, it is for artists only. It can be used to conveniently select the contour of a separate surface in 2D graphics editors.

Surfaces texture

Generated surfaces texture
Size Size of the generated textures.
AA Anti-aliasing mode for the output normal map. If used, consumes additional memory.
The higher the value, the softer and more blurred the normal map will be.

Without AA With AA
Anti-aliasing = 0x
Anti-aliasing = 32x
Level
Clamp
Level and Clamp parameters allow to control how the calculated displacement values are baked into the textures. These options are in effect for both a parallax and a height map.

Level and Clamp

Level and Clamp

Level. NormalMapper automatically normalizes the displacement range from 0 to 1 (255 gradations for 8-bit texture). What height in units will be equal to the maximum 1, is controlled by the Level parameter. All heights above it are cut out and not baked into the texture.
Level allows to create textures for several meshes relative the same height scale. It is important when one object is represented as separate meshes with different textures.

  • The Level is measured in units from the zero (in both directions for a height map; in one direction for a parallax map). All heights that fall outside this range are cut off. Changing the Level does not affect the zero value in the texture:
    • In the parallax map, zero (values higher then a low-poly surface) will still be the same white. Only the range
    • In the height map, zero is grey color that equals 128. The Level will not change it. It will only affect negative displacement (dark grey in range from 0 to 127) and positive displacement (light gray in range from 128 to 255).
  • By the value of 0, the real maximum height displacement between a low-poly and a high-poly mesh will be used as texture pure white (or pure black, depending whether it is above or below a low-poly mesh).
  • The higher the Level, the fewer gradations will be left for the actually represented height range. The resulting texture will be non-contrasting. It is strongly recommended to set the Level sufficiently low.
  • The real displacement value between the low-poly and a high-poly meshed is displayed in the Info after NormalMapper was once run. It can change slightly with different texture sizes, because of different sampling rates. The real displacement value can be used as a reference point to set the Level.

For example, if a height map should be created basing on this high-poly and low-poly meshes:

Base meshes for a height map

Changing the level will bring the following. Note that the zero level at the middle did not change, only the peaks are baked differently:

Level = 0. Real displacement is used as max.
High Level.
Low Level. Heights were cut off.

Clamp parameter allows to cut off displacement values that are above the specified line within a set Level range. (See illustration above).

  • By the value of 0, no clamping is done.
  • The Clamp parameter is in effect only when it is lower than the Level. The maximum height (1 in texture coordinates) relative to which displacement values are normalized stays the same, while heights outside the Clamping range are cut off.
Clamp allows to cut off too high displacement when textures are baked for several meshes and the Level of normalization cannot be changed.

Clamp is lower than Level Clamp is lower that Level
Clamp is lower than Level.
Even lower Clamp. More heights are cut off.

How to use Level and Clamp parameters for baking several meshes:

  1. Load the first low-poly and a high-poly meshes.
  2. Test run the calculations (for faster test, choose smallest texture size). Note what the maximum Displacement value between a low-poly and a high-poly is:

    Real maximum displacement

  3. Repeat the same actions for all other meshes.
  4. Choose the mesh with the highest displacement.
    • Set the Level value close to the real displacement, for example 9.6 units.
    • Set the required texture size
    • Click Run.
  5. For all other meshes, set the same Level, for example 9.6.
  6. If for any of the meshes it is required to clamp unnecessary heights, set Clamp value lower than the Level, for example to 8 units.Everything above this height will not be baked into the texture.
Extrude Extrusion in pixels for all generated textures. This option adds colored pixels around the contour of each UV shell. The color value is simply copied from the nearby pixel. It allows to get rid of possible darkening where seams meet.
  • The lower the size of the textures, the more visible darkening along the seams is. Increasing Extrusion parameter may help in this case.

Extrusion

Extrusion

No pixel extrusion With pixel extrusion
Extrusion = 0 pixels
Extrusion = 4 pixels
Run Create textures: a normal map and all the others for which options are checked (parallax map, height map and a surfaces texture). The normal map applied to the low-poly mesh can be seen in the Normal map mode.
Save Save created textures. Specify the name of the normal map with a postfix _n at the end and all other textures (with options checked) will be named accordingly:
Notice
All these textures will be saved into the same format as a normal map.

There are several options for saving:

  • ATI2 Compression - compress the texture to the ATI2 format.
  • Two Component - save a normal map as a two-component (RG) texture. Two-component map is not for further editing: it is intended to be loaded and used in the engine as it was saved. Two-component maps also cannot be stored in the .jpg format.

Three component normal map Two component normal map
Three component normal map
Two component normal map
Notice
You can also save the mesh by pressing Ctrl+S.

Supported File Formats

Supported formats of geometry data:

  • Unigine mesh (.mesh)
  • Unigine skinned mesh (.smesh)
  • Wavefront (.obj)
  • COLLADA (.dae)

Supported formats of textures:

  • Targa (.tga)
  • Portable Network Graphics (.png)
  • JPEG (.jpg)
  • Photoshop Document (.psd)
  • Direct Draw Surface (.dds)
  • Portable Pixmap (.ppm)
  • Portable Graymap (.pgm)
  • High Dynamic Range (.hdr)
  • Silicon Graphics Image (.sgi)

Hot Keys

  • Ctrl+O — load a low-poly mesh.
  • Ctrl+H — load a high-poly mesh.
  • Ctrl+C — load a cage mesh.
  • Ctrl+N — load an additional normal map.
  • Ctrl+Rreload all resources.
  • Ctrl+Ssave the generated normal map and other textures, if specified.
  • I — toggle mesh info.
  • C — toggle a XYZ compass.
  • T — toggle base grid, surface triangles or a wireframe.
  • F1 — show the help window.
Last update: 2017-07-03
Build: ()