Photon Mapping works by shooting photons from the lights where as most other effects work by shooting rays from the camera. For effects like caustics this has important quality advantages, the figures below demonstrate how this works.
Photons emitted from the light source bounce around the scene and are finally stored on surface
During rendering, final shaded pixels (white) are GI-lit by extrapolating the previously computed photons on the surfaces
The figures also reveal one of the Photon Mapping's weaknesses: it can store photons on parts of the scene that might not be visible to the camera and are, therefore, irrelevant to the final shaded pixels. While certain graphics algorithms exist for improving that situation, Redshift uses the more traditional photon mapping technique which, unfortunately, suffers from this problem. For studio-like scenes (where there is little geometry beyond what the camera can see directly) this might not be an important issue, since most geometry will be visible anyway. But for more complicated scenes (e.g. flythrough through a house containing several rooms and lights), many photons could be required which could be a memory and processing burden.
Photon mapping can recreate both Diffuse GI and Caustics effects. "Diffuse GI" refers to global illumination that is due to rough surfaces while "caustics" are caused by highly reflective or refractive surfaces (like mirrors and glass). All the other GI engines can only capture Diffuse GI. Only Photon Mapping can reproduce caustics.
Photon Mapping Caustics are always enabled! You don't need to set the primary or secondary GI engines to "Photon"! This is explained in more detail in the relevant section below.
We generally recommend using other GI engines than photon mapping when it comes to achieving diffuse GI as they generally tend to be of higher quality in most cases. And, like mentioned above, you can still use Photon Mapping for caustics – even if you don't have it selected as a primary or secondary GI engine.
Benefits of Photon Mapping:
Drawbacks of Photon Mapping:
These are global switches to enable/disable Diffuse GI and Caustics.
When "Mode" is set to "Rebuild (don't save)", new Photon Mapping data will be generated each frame. The data will not be automatically saved to disk.
When "Mode" is set to "Rebuild (prepass only)", new Photon Mapping data will be generated each frame and will save it to the user-specified file. The final rendering pass will be skipped.
When "Mode" is set to "Rebuild", new Photon Mapping data will be generated each frame. After the Photon Mapping processing stage is complete, the results are written to the user-specified file.
Setting "Mode" to "Load" will skip the processing stage and, instead, load the data from the user-specified file.
Because light-emitted photons are independent from the camera settings, fly-through animations can get away with generating the photon map once (on the first frame) and re-using it for all other frames. If, however, photon-emitting lights move or material settings are animated, a new photon map will have to be generated.
These three settings control the number of times that photons may bounce around the geometry. The defaults should work fine for most scenes.
If you are rendering caustics and don't want reflective caustics but only want refractive caustics, you can try limiting the reflection trace depth to zero.
During rendering, the photons generated during the Photon Mapping pass are used to shade the final pixels. To get a smooth result, each final shaded pixel needs to find its closest photons and blur them together.
The "Search Radius" setting controls the distance around each shaded pixel that will be used to find photons. This number is scene-dependent and is in world units. Larger values mean smoother but blurrier results while smaller values mean sharper but, sometimes, splotchy results. This setting is very closely tied to the number of photons shot from the lights. If lights have been configured to shoot many photons, then usually the search radius can be shrunk without artifacts. If too few photons were shot from lights, the search radius has to be large in order to not be splotchy.
The "Max Num Photons" controls the upper limit of photons that can be stored in the "Search Radius". Larger numbers will allow the photon shooting algorithm store many photons per unit area which means a larger memory requirement and not necessarily an improved image quality! We recommend leaving this setting at the default value.
Searching for photons during final rendering can be time-consuming and might slow the rendering down. "Fast Irradiance" allows blurry effects to use a faster, pre-processed approximation that needs less searching and is, thus, faster. The preprocessing step happens after the photons have been computed and might take a few seconds – but the savings during rendering are worth it, so it is recommended that you leave this option enabled.
While Photon Mapping might not be as great of a choice for secondary Diffuse GI, it works very well for caustics.
Setting up Photon Mapping for caustics is similar to using it for diffuse GI, except for the following:
The caustic "Search Radius" is set to 0.1. To get sharp caustics, this setting often has to be fairly small. That also explains why we had to shoot so many photons too. Fewer photons with a larger search radius would have worked too, but the caustics would be blurrier. That might be desirable in some cases.
The caustic "Max Num Photons" was reduced to 30 (from the default 200). Reducing this value forces the renderer to merge photons that are close to each other. This works like follows: if the renderer find more than "Max Num Photons" within "Search Radius", it will keep merging photons together until there are exactly "Max Num Photons" within "Search Radius". Since caustics tends to 'focus' photons in small areas, this can be an important memory optimization: merging photons means fewer photons to be stored in the GPU. And the quality is often not affected. Numbers such as 30-60 typically work well.
1,000,000 caustic photons. Both reflecting and refracting.
When photons are shot from the lights, some of them will reflect and some of them will refract. The glass cylinders are both reflective and refractive so the image above does both. The strong line patterns you see behind each cylinder are due to refraction. The slight line patterns you see on the wall and on the left part of the image are mostly due to refraction.
When you specify a number of photons (1,000,000) in this case, these photons get distributed between reflection and refraction. Sometimes, though, people only care only about reflection or refraction (not both), for aesthetic reasons. Additionally, disabling either means that the entire 1,000,000 photon budget will go entirely to reflection or entirely to refraction – so each one of these will be cleaner than if both were enabled.
You can force caustics to be refractive or reflective by adjusting the trace depths, as shown in the examples below: