Keywords: normal maps

Summary

This demo focuses on the use of "normal maps" to emulate high resolution surface topology on low resolution geometry models. Similar to bump maps, a normal map can be used to spatially modulate the surface normal vector across an otherwise flat surface. This is accomplished by encoding the XYZ normal vector into an RGB image. In this example, a pair of real 3D objects (a hemisphere and a truncated pyramid) are featured and a second pair of the same objects are emulated using a normal map.

Details

Normal maps are another tool used by 3D content artists to introduce the appearance of high resolution geometry without the costs associated with it (memory usage, rendering time, etc.). In this example, a pair of 3D target objects (hemisphere and a truncated pyramid) were instanced in the scene. The real 3D targets were then imaged with DIRSIG, the surface normal truth was captured and the XYZ components of the normal vector across the objects were encoded into an RGB image. This RGB image is then used on a flat part of the scene to emulate a second pair of the same 3D targets by spatially perturbing the surface normals to make it look like the surface is tilted. It is important to note that a normal map does not displace the surface (the surface remains flat).

Important Files

This section highlights key files important to the simulation.

The Real Targets

The real targets are defined in the geometry/demo.glist file using a scaled 1 x 1 meter square OBJ for the background (see geometry/1x1.obj), the built-in sphere geometry (the sphere center is at the same Z as the background surface) and an OBJ model of the truncated pyramid (see geometry/chunky_bar.obj). The background plane, sphere and pyramid are all assigned the same material via various GLIST attribution options. This material is a diffuse 20% reflector using the Ward BRDF model (see below):

Material description for the "real" 3D targets.
MATERIAL_ENTRY {
    NAME = 20% diffuse
    ID = 1
    EDITOR_COLOR = 1.0000, 1.0000, 1.0000
    DOUBLE_SIDED = TRUE

    SURFACE_PROPERTIES {
        REFLECTANCE_PROP_NAME = WardBRDF
        REFLECTANCE_PROP {
            DS_WEIGHTS = 0.2 0.0   
            XY_SIGMAS = 0.0 0.0
        }
    }

    RAD_SOLVER_NAME = Simple
    RAD_SOLVER {
        QUALITY = LOW
    }
}

The Normal Map Image

The normal map for the emulated targets was created from surface normal truth generated by the normal.sim simulation. This simulation produces a 1024x512 image (the size doesn’t matter) and corresponding truth data. The XYZ surface normal vector component images were then loaded into the DIRSIG image viewer as an RGB image using the Selected Min/Max Scaling and saved to the maps/normals.png file to serve as the normal map for the "fake" objects. The resulting RGB normal map is shown below:

normals
Figure 1. The input image used to emulate the normals of the "fake" objects.

The Fake Targets

The "fake" targets are emulated using the normal map. To create this 2nd pair of objects, the normal map is UV projected onto a rectangle that occupies the lower half of the scene. This rectangle is created using the same 1 x 1 meter square used for the background plane, however it is scaled to the same 2:1 aspect ratio of the normal map. This second plane is offset in Z by a 0.001 so that it is above the larger plane defining the background of the rest of the scene. This plane has to be assigned a different material than the rest of the scene because this material will have the normal map assigned to it. This material entry is shown below, and it is identical to the other material with the exception of the NORMAL_MAP entry:

Material description for the "fake" 3D targets using normal maps.
MATERIAL_ENTRY {
    NAME = 20% Diffuse (w/ normal map)
    ID = 2
    EDITOR_COLOR = 1.0000, 1.0000, 1.0000
    DOUBLE_SIDED = TRUE

    NORMAL_MAP {
        UV_PROJECTOR {
            ORIGIN = CARTESIAN
            FLIPX = FALSE
            FLIPY = FALSE
            EXTENDX = MIRROR
            EXTENDY = MIRROR
        }
        IMAGE_FILENAME = normals.png
    }

    SURFACE_PROPERTIES {
        REFLECTANCE_PROP_NAME = WardBRDF
        REFLECTANCE_PROP {
            DS_WEIGHTS = 0.20 0.0   
            XY_SIGMAS = 0.0 0.0
        }
    }

    RAD_SOLVER_NAME = Simple
    RAD_SOLVER {
        QUALITY = LOW
    }
}

With the exception of the standard projector setup used by all material file defined maps, the NORMAL_MAP has a single option: the IMAGE_FILENAME, which specifies the name of the RGB normal map image file. This file will be looked for using the scene or bundle "maps" path.

Setup

This section includes any step-by-step instructions for running and visualizing the simulation.

To run the single-frame simulation, perform the following steps:

  1. Run the DIRSIG demo.sim file

  2. Load the resulting demo-t0000-c0000.img radiance file in the image viewer.

To run the multi-frame animation, perform the following steps:

  1. Run the DIRSIG video.sim file

  2. Load the resulting demo-t0000-c0000.img, demo-t0000-c0001.img, etc. radiance files in the image viewer.

Results

The output of the single-frame simulation is shown below. The image feature two rows of targets, with each row containing the hemisphere and truncated pyramid objects. The top row contains the real 3D geometry and the bottom row contains the same geometry as emulated by a normal map. The key difference is that the 3D targets self-shadow and cast shadows onto the background, where as the normal mapped targets only self-shadow. Aside from the adjacent shadowing differences, the emulated targets feature the expected illumination gradients as if the surface has actual 3D topology, when they are only flat (2D) objects.

demo
Figure 2. Output of the single-frame simulation.

The multi-frame animation below shows what the scene looks like as the camera moves from vertical viewing. As the the off-vertical angle increases, the lack of the 3D nature of the emulated targets becomes even more apparent.

video
Figure 3. Output of the multi-frame animation.