Shaders and Trace Functions

Trace functions are functions provided by mental ray that allow a shader to cast a ray into the scene, most of them using standard ray tracing. Not all types of tracing functions can be used in all types of shaders. Conversely, many trace functions cause shaders to be called. This section lists these interdependencies.

The following table shows which shaders are called from which trace functions. Displacement, contour, and photon shaders are never called by any of the functions, and may not call any of them. Note that probe rays never call shaders.

function calls shaderlensmtlenvlightshadvol
mi_trace_eye
mi_trace_reflection
mi_trace_refraction
mi_trace_transparent
mi_trace_environment
mi_trace_light
mi_sample_light
mi_trace_shadow
mi_trace_shadow_seg
yes, the function calls shaders of this type
no, the function does not call shaders of this type

The following table shows which trace functions may be called from certain types of shaders:

function called from shaderlensmtlenvlightshad ray
vol
light
vol
mi_trace_eye
mi_trace_reflection *****
mi_trace_refraction *****
mi_trace_transparent *****
mi_trace_environment **
mi_trace_light *****
mi_sample_light *****
mi_trace_shadow
mi_trace_shadow_seg
yes
no
*
yes, if the shader generates an artificial intersection point by setting point, normal, and normal_geom in the state.
*
no, except if the shader removes internal data by setting state->cache to NULL and generates an artificial intersection point if none is present.

Copyright © 1986-2009 by mental images GmbH