Understanding Texture Mapping

This page describes how the texture mapping multi layer system works and how the rays interact with it.

Texture Mapping Process

When a Texture Mapping is created on a surface or a face, it is considered as merged with that surface.

The Texture Mapping can contain one or several layers. On each layer you can define an image type of texture, a normal map and/or apply specific optical properties. You can even superimpose different types of mapping and combine a normal map and an image texture for example.

When rays hit the Texture Mapping, they interact with the layer(s) you created. Depending on the level of transparency (alpha) of the layers, a certain amount of information can be processed on the current layer or on the next. If you created a Texture Mapping with an image texture containing alpha channels, a certain amount (expressed in %) of the rays will get through these areas of transparency to reach the next layer and continue interacting with it.

Then, the rays that interact with a layer are submitted to direction and color change according to the texture mapping created.

This process, described below, is repeated on each layer.

Phase One: The Layer Selection

The layer selection determines if the ray can carry on interacting with the layer (Ln) or goes to the next layer (Ln-1).

To determine the layer selection, the algorithm checks the transparency level (α of the layer Ln Image Texture pixel on which the ray is interacting.

α is a component of the Image Texture which corresponds to the transparency layer in addition to other R,G,B layers and is coded on 8-bit with values being within the 0-255 range.

The probability to interact with the layer Ln or to go to the layer Ln-1 is calculated according to the level of α, for 0 < α < 255. There is α-in-255 chance that a ray uses the Layer Ln optical properties.

  • If α = 255, the pixel of the texture file is opaque and the ray interacts only with the Surface State of the layer Ln.
  • If α = 0, the pixel is transparent and the ray does not consider optical properties from the Layer Ln, it goes to the layer Ln-1.

Phase Two: Surface State Interaction

When the ray carries on interacting with the layer Ln, the second step is the surface state interaction. The surface state corresponds to the optical properties and the texture normalization applied to the layer.

The ray is then submitted to:

  • Direction change according to the Optical Properties of the layer.

    Once a ray interacts with the Surface State of a layer, the ray no longer interacts with other layers and is either transmitted toward the volume, reflected, or absorbed.

  • Color change according to the Texture normalization parameter selected:

    • Color from BRDF: ray color changes according the Optical Properties of the layer.
    • Color from Texture: ray color changes according the Image Texture RGB components.
    • Color from None: ray color changes according the Optical Properties and the Image Texture RGB components.