![]()
Photon tracing
Photon tracing creates a photon map (see Photon maps), which is used by mental ray for Maya to render global illumination and caustics.
Photons work as follows:
- Light sources can emit photons (packets of energy).See Turn on photon emission for a light source.
- Photons bounce around in the scene until the Max Photon Depth is met.
- Photos can be reflected off of surfaces.
- Photons can be refracted (transmitted) through surfaces.
- Each time a photon hits a surface, the value of the incoming energy is stored in the photon map (provided Conditions for photon storage are met).
To turn on photon tracing, see Turn on photon emission for a light source.
Conditions for photon storage
Photons are stored only if the following conditions are met:
- The surface must have a diffuse component.
All Maya materials (Lambert, Blinn, and so on) store photons, as long as the Diffuse attribute is not set to 0.
Some custom mental ray for Maya shaders do not store photons
- The photon has bounced at least once.
The first surface hit, the illumination of which is handles by direct (not indirect) illumination, is not stored in the map.
- The Max Photon Depth, the setting that controls the number of times photons bounce around in scene, has not yet been met.
- Directional light sources are not used. (Use either a point light for interior volumes [because they emit in all directions] or a spot light.)
Photons have both a direction and a position; directional lights have only a direction, so mental ray for Maya can’t determine the position of photons. As a result, too many photons are emitted but not recorded in the photon map, rendering resources are wasted, and artifacts can appear.
- For limitations of photon tracing, see Troubleshoot photon tracing limitations.
Advanced information about photon tracing
For general information about photon tracing, see Photon maps.
Some photon shader parameters work a little differently than their Maya counterparts. Besides carrying color (or other relevant) information, some parameters also determine the probabilities of how photons interact with objects.
These probabilities (P) are computed as follows:
P3 = P(transmission) = INTENSITY(transparency) P(diffuse transmission) = translucence P(specular transmission) = 1 - translucence P2 = P(specular reflection) = reflectivity * INTENSITY(specularColor) P1 = P(diffuse reflection) = diffuse * INTENSITY(color) * (1 - INTENSITY(transparency)) P0 = P(absorption) = absorbs * (2.0 - P1 - P2 - P3)The interaction with the highest P-value is most likely to be chosen. So, the ratios of the P-values determine what fraction of the incident photons are refracted (transmitted), reflected, and absorbed, respectively. The probabilities match the Maya materials in that derivation from Maya will give satisfactory results.
Note first that photons are only stored when hitting a diffuse surface. So if P1 is zero for a specific instance, no photons are stored. To improve performance, you should disable the Globillum/Caustic Receiver.
Translucence determines what fraction of all refracted (transmitted) photons are diffusely transmitted and translucenceFocus controls the diffusity.
Absorption takes place only if the intensity of each color involved is less than one and Diffuse and Reflectivity are within the prescribed range.
If the probability for specular reflection P2 is greater than zero, either a non-zero Shinyness (isotropic), or non-zero spreadX and spreadY (anisotropic) must be specified.
Examples
Diffuse green reflection with red diffuse transmission
absorbs on diffuse 1.5 color 0.0 1.0 0.0 transparency 1.0 0.0 0.0 translucence 1.0 1/6 diffuse transmission 1/6 diffuse reflection 2/3 absorptionFull specular refraction (caustics)
Diffuse green reflection with specular isotropic blue reflection