The depthmap is not user assignable and is only used for the automatic mode. Its sole purpose is a small memory/performance optimization.
For ease of use, passing an explicit lightmap in the proper format is not required. However, since all participating shaders must know about the lightmaps used, a special kind of Phenomenon can be used in which the first two parameters of the Phenomenon must be the lightmap and depthmap pair. Anywhere the individual shaders are used within the Phenomenon, they must be linked to these first two parameters via interface connections, instead of being set to a specific value.
Only if these conditions are met, automatic lightmap creation can be used. If the conditions are not met, manual specification of the lightmap have to be used.
Here is pseudocode for a Phenomenon that meets these criteria:
declare phenomenon material "my_sss_phenomenon" ( color texture "lightmap", # must be first color texture "depthmap", # must be second color "diffuse_paint", color "my_special_color", scalar "lightmap_size", # for example ... ) shader "myscattering" "misss_fast_shader" ( "lightmap" = interface "lightmap", # required "depthmap" = interface "depthmap", # required "diffuse_illum" ... ... ) shader "mylightmapping" "misss_lightmap_write" ( "lightmap" = interface "lightmap", # required "depthmap" = interface "depthmap", # required "lightmap_group" "A", "lightmap_size" = interface "lightmap_size", # for example ... ) ... end declare
Failing to follow these guidelines may cause the Phenomenon to behave unpredictably and may possibly abort rendering when the shaders attempt to communicate over a parameter slot that is missing or used for another purpose.
When mental ray renders lightmaps, it tries to distribute the workload to several hosts on a per-object basis. However, the misss_fast_ shaders encourage (due to memory efficiency) and in some cases require (for separate objects to scatter into each other) several objects to share the same lightmap.
Multiple hosts writing into the same lightmap is not possible in mental ray, and will create a collision, where incomplete or incorrect lightmap data can be created.
The following are some ways around the problem:
Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.