mib_lightmap_write

 
 
 

Category: mental ray > Lightmap

Shader Family: Lightmap

Output: Lightmap

mental ray supports light mapping as a two-stage process that runs on certain objects (whose materials contain a lightmap shader) to compute illumination or other information, and write the result into a texture or elsewhere. The first stage calls the lightmap shader in vertex mode once for every vertex of the object, and collects the returned information. The second stage calls the lightmap shader in output mode to use the collected information to paint a texture or other output data by looping over all triangles of the object.

The lightmap shaders in the base shader library collect direct and indirect illumination, and create a writable texture map from it. Although mental ray knows only about one lightmap shader, the base lightmap shader is split into the main shader that handles the output stage, and a separate shader for the vertex stage that is called by the main shader. This makes it easier to substitute only one stage with another user-written shader.

The mib_lightmap_write shader gathers geometric information and texture coordinates on the triangle vertices and then writes a triangular region of texture for each triangle. For each pixel of the texture that the triangle covers, a sampling function is called and the results are written to the shader. The lightmap shader is connected to a material through its lightmap port.

Name

The name of the shader node displayed in the render tree. Enter any name you like, or leave the default.

texture

The writable texture where the lightmap will be written.

coord

A shader that returns the texture UV coordinates at the current particular point, such as mib_texture_remap.

input

A shader returning the data to be written to each texture pixel. For example, using mib_lightmap_sample here is useful to gather illumination to write into the light map.

fg_mode

When final gathering is enabled, these mode settings allow you to tune quality by controlling the placement of final gather points all over the surface. This is usually required to achieve quality on the backside of objects or in areas which are out of view of the camera, places where the mental ray final gather view dependent optimizations might not cover.

Supported values are:

  • A value of -1 turns off this feature.

  • A value of 0 (zero) forces a final gather point on every vertex (of the tessellated geometry).

  • A value of 1 forces a final gather point on every texture pixel (texel).

  • A value of 2 forces a final gather point on every second texel.

  • A value of 3 forces a final gather point on every third texel (default).

  • A value of n (n > 3)forces a final gather point on every n-th texel.