Keywords: maps, materials

Summary

This demo provides a basic example of a material map, which is a tool that employs a raster image to map different materials to different locations on an object. This demo specifically highlights the setup of a material map and the impact of the "pure" vs. "mixed" material option.

Details

A "material map" is a special mechanism in DIRSIG that allows a raster image to map materials across the surface of an object. In contrast to polygon level material assignments, the material map lets materials be assigned across and within polygon boundaries. A common example is a road over a complex terrain. If we are using polygon level material assignment and the road does not align with the polygons in the terrain, then the terrain polygons need to be cut to follow the road edges so that "road" and "not road" material assignments can be made. This generally increases the polygon count without increasing the geometric detail. The material map mechanism projects a map of which materials are where across a set of polygons. As a result, the spatial resolution of those material assignments is independent of the geometric detail.

The material map mechanism involves the creation of a look-up table that relates raster image pixel values (digital counts) to DIRSIG material IDs. Typically, a material map source image comes from a classification of the materials in a real image and that classification typically identifies a limited set of material classes. This discrete set of material classes are represented by a discrete set of digital counts (DCs) used in the raster image map. The look-up table maps these discrete DCs to DIRSIG material IDs. The DIRSIG material map mechanism gives the user the choice of how to deal with a DC count that is not mapped to a DIRSIG material ID. The two choices are:

  1. The "pure" material solution where the material corresponding to the nearest mapped DC is used.

  2. The "mixed" material solution where the materials corresponding to the two adjacent mapped DCs are proportionally mixed.

This demo focuses on the following details of using a material map:

  • The UV projection setup of the raster map onto the geometry.

  • The configuration of the map, including the creation of the raster pixel counts to DIRSIG material ID look-up table.

  • The impact of the "pure" vs. "mixed" mapping solution.

Important Files

This section highlights key files important to the simulation.

Scene Geometry

Observing the impact of the material map is the primary goal of this demo. To simplify the placement of the material map, a square polygon was created in an OBJ file. The 4 geometric vertexes also have texture vertexes, which allows the UV projection method to be used. The square target object can then be easily placed and scaled to fill the field-of-view of the sensor. The square object can be found in geometry/square.obj. This object is instanced over a "ground plane" background via the geometry/demo.glist file. The square object is assigned material ID #1, which will be important when we setup the material map.

Scene Materials

The scene contains 5 materials, which are all defined in the materials/demo.mat file:

  1. Material ID #1 → a proxy material for the square polygon that is remapped to other materials by the material map.

  2. Material ID #10 → a 0% diffuse reflector

  3. Material ID #11 → a 10% diffuse reflector

  4. Material ID #12 → a 20% diffuse reflector

  5. Material ID #13 → a 30% diffuse reflector

Material ID #1 has a minimal configuration because it is never observed directly (the material map will always change geometry with this ID to another ID). The 4 gray materials are all configured with the Ward reflectance model and the Simple radiometry solver.

Material Map

A material map is configured in the .scene file. This section will outline the key components of that configuration.

Input Raster Image

The raster image (below) used in this demo was created by hand in PowerPoint (see the file maps/material_map.pptx).

maps/material_map.png
Figure 1. The input material map image

The image is square (688 x 688) to make it easier to map it to the square polygon object (described previously) without distortion. The image focuses on 4 shades of gray: black (DC = 0), dark gray (DC = 85), light gray (DC = 170) and white (DC = 255). The background is white, the text is black and the 4 square patches each use one of the grays. The exception to these 4 discrete gray values is the gradient at the bottom, which transitions continuously from white to black. This specific region of the map will be used to understand what happens with DCs in the raster map that are not explicitly defined in the DC to material ID look-up table.

Map Projection

The raster image is mapped onto the square polygon target geometry in the scene using the UV Projection method, which leverages an addition coordinate system (called "texture coordinates") present in the square polygon OBJ file.

Note
The user can select either the Drape or UV projection method when setting up a material map. This geometry and projection approach was chosen here to simplify the simulation configuration.

Raster DC to Material Look-up Table

Below is the look-up table the maps the 4 raster DCs to 4 DIRSIG material IDs.

Table 1. Raster image DC to DIRSIG material ID look-up table.
Raster Image DC DIRSIG Material ID

0

10

85

11

17

12

255

13

For this example, the mapping of raster image DCs to materials is very intuitive. The dark DCs are mapped to materials with dark reflectances. However, DCs can mapped to any material. For example, the mappings above could be reversed, which would produce a "negative" version of the input raster map using these scene materials. In most real world use cases, raster image DCs map to completely different materials. It is not uncommon for a scene to mate a terrain polygon mesh with a classmap that remaps DCs to asphalt, grass, soil, etc.

Pure vs. Mixed Materials

The DC to ID look-up table defines what material IDs are used for 4 specific gray values in the input raster image. However, the gradient at the bottom of the input raster image contains all gray values from 0 to 255. What happens when the DC mapped to a given location is not one of the ones in the look-up table? Each material map as the option to either use the closest (in DC space) mapped material or to proportionally mix the two adjacent (in DC space) mapped materials.

In order to explore the impact of this option, two .scene files have been created (and two .sim files to use them). They are identical expect that the mixing option is enabled in one (see the w_mixing.scene file) and disabled in the other (see the wo_mixing.scene file).

Sensor

The sensor for the simulation uses a simple, single channel QVGA (320x240) format camera. For this simulation, there is no sub-pixel sampling so that the impact of the material map can be directly observed.

Setup

This section includes any step-by-step instructions for running and visualizing the simulation. There are two simulation scenarios in this demo: one with adjacent material mixing enabled and one without. Both simulations use the same .platform file, so the output of one simulation will be replaced by the output of the other.

  1. Run the wo_mixing.sim file

  2. Load and observe the output image (see demo.img)

  3. Run the w_mixing.sim file

  4. Load and observe the output image (see demo.img)

To compare the results of the two simulations, you can make a copy of the output image before running the other simulation. Or you can use the Output Prefix option via the GUI or the command-line to put a prefix on the front of the output image files in order to avoid overwriting.

Results

The simulated image below shows the output of the "without mixing" simulation. Note that the continuous gradient present in the input raster map is quantized into bands of uniform gray. That is because when the areas of gradient were rendered, the map used the closest mapped material in the look-up table. So the gradient could only be realized with the 4 gray materials used in the simulation. As a result, the gradient has 4 bands of gray realized by the 4 gray materials.

images/wo_mixing.png
Figure 2. Output of the "without mixing" simulation.

The user may notice that there are some "jagged" edges around the text, edges of the square patches and within the bands of the gradient. These are sampling artifacts from using a single sample per pixel in the simulation. Correctly using pixel subsampling would mitigate these artifacts, but we wanted to highlight how each location only finds a single material.

The simulated image below utilized the same material map setup as above, but with adjacent material mixing enabled. When a DC of 86 was extracted from the map in the "without mixing" scenario, then the material mapped to DC = 85 (the closest to 86) would be used at that location. With mixing enabled, a DC of 86 is between DC = 85 and DC = 170 (the two adjacent DCs that are defined in the look-up table). Therefore, DIRSIG will compute the surface leaving radiance solution using the material for DC = 85 (the "dark gray" material), then for the material for DC = 170 (the "light gray" material) and then mix the surface leaving radiances proportionally (1/85th of the "light gray" solution and 84/85ths of the "dark gray" solution).

Important
Adjacent material mixing is performed at the radiance level. The surface leaving radiance for the two materials are computed and the resulting radiances are mixed.

Because the gradient is linear and because the reflectances associated with the 4 defined materials are linear steps in reflectance, the gradient in the output image (below) is reproduced.

images/w_mixing.png
Figure 3. Output of the "with mixing" simulation.

Final Thoughts

It is important to realize that this demo was created to be simple to understand. However, the setup might falsely convince the user that certain assumptions or requirements must be followed. To prevent that consider the following:

  • The material map image does not need to be square.

  • Either the UV or Drape projection can be used.

  • The input raster image is assumed to be an 8-bit image, so that means a given image can remap to 256 different materials.

  • The discrete set of values in the input raster image do not need to be evenly distributed. For example, the input raster could use DCs = 0 and 1 (only two materials) or DC = 10, 12, 171, 183 and 251 (five materials).

  • Although the materials used in this scene were the materials had a progression in reflectance, the look-up table can map DCs to any valid DIRSIG material.

  • There are no rules enforced about the homogeneity of materials mapped to by a material map. Each material can use different optical properties, radiometry solvers and temperature solvers.

  • Adjacent material mapping happens at the surface leaving radiance level. Therefore an intermediate DC could mix "sand" and "grass" and each material can use different optical properties, radiometry solvers and temperature solvers.

  • There is no reason multiple DCs cannot map to the same material ID. For example DC = 85 → ID #10, DC = 170 → ID #20, DC = 255 → ID #10.