There are two functions that are especially important to writers of photon shaders.
The shader interface function mi_choose_scatter_type chooses a scatter type for a photon based on the probabilities for diffuse, glossy, and specular reflection and refraction. It can also choose absorption, that is, that the photon should be traced no further. The function also ensures a correct energy level in the scene by altering the reflection coefficients according to the scatter choice.
During regular ray marching, material shaders of caustic-receiving objects should call the mi_compute_irradiance function to "pick up" the illumination caused by photons reaching the object during preprocessing.
Copyright © 1986-2009 by mental images GmbH