Light caching (sometimes also called light mapping) is a technique for approximating the global illumination in a scene. This method was developed originally by Chaos Group specifically for the VRAYforC4D renderer. It is very similar to Photon mapping, but without many of its limitations.
The light cache is built by tracing many many eye paths from the camera. Each of the bounces in the path stores the illumination from the rest of the path into a 3d structure, very similar to the Photon map. On the other hand, in a sense, it is the exact opposite of the Photon map, which traces paths from the lights, and stores the accumulated energy from the beginning of the path into the Photon map.
Although very simple, the light-caching approach has many advantages over the Photon map:
- It is easier to set up. We only have the camera to trace rays from, as opposed to the Photon map, which must process each light in the scene and usually requires separate setup for each light.
- The light-caching approach works efficiently with any lights – including skylight, self-illuminated objects, non-physical lights, photometric lights etc. In contrast, the Photon map is limited in the lighting effects it can reproduce – for example, thePhoton map cannot reproduce the illumination from skylight or from standard omni lights without inverse-square falloff.
- The light cache produces correct results in corners and around small objects. The Photon map, on the other hand, relies on tricky density estimation schemes, which often produce wrong results in these cases, either darkening or brightening those areas.
- In many cases the light cache can be visualized directly for very fast and smooth previews of the lighting in the scene.
- Even with these advantages, light caching is similar in speed to the Photon map and can produce approximations to the global lighting in a scene very quickly. In addition, the light cache can be used successfully for adding GI effects to animations.
Of course, the light cache has some limitations:
- Like the Irradiance map, it is view-dependent and is generated for a particular position of the camera.
- Like the Photon map, the light cache is not adaptive. The illumination is computed at a fixed resolution, which is determined by the user.
These parameters affect the calculation phase of the light cache; they do not affect the final rendering.
Override LC Subdivision – this option, allow override Subdivision passes number with auto passes number depended from Sample ratio and image resolution.
Sample ratio – this setting defines number of subdivs depends to the final image size resolution. Lowering the ratio reduces time but also lowers light cache quality.
Subdivision – this determines how many paths are traced from the camera. The actual number of paths is the square of the subdivs (the default 1000 subdivs mean that 1 000 000 paths will be traced from the camera).
Sample size – this determines the spacing of the samples in the light cache. Smaller numbers mean that the samples will be closer to each other, the light cache will preserve sharp details in lighting, but it will be more noisy and will take more memory. Larger numbers will smooth out the light cache but will loose detail. This value can be either in world units or relative to the image size, depending on light cache Scale mode.
Use Camera Path – when this option is on, VRAYforC4D will calculate the light cache samples for the entire camera path, instead of just the current view, in the same way as this is done for the Fly-through mode. This is useful when rendering animations with moving objects where the camera also moves and the light cache needs to be in Single frame mode. In this case, setting the Use camera path option on will help to reduce any flickering, as the GI sample positions on static geometry will not change.
Mode – determines the rendering mode of the light cache:
- Single frame – this will compute a new light cache for each frame of an animation.
- Fly-through – this will compute a light cache for an entire fly-through animation, assuming that the camera position/orientation is the only thing that changes. The movement of the camera in the active time segment only is taken in consideration. Note that it may be better to use World Scale for fly-through animations. The light cache is computed only at the first rendered frame and is reused without changes for subsequent frames.
- From file – in this mode the light cache is loaded from a file. The light cache file does not include the prefiltering of the light cache; prefiltering is performed after the light cache is loaded, so that you can adjust it without the need to recompute the light cache. Load file – specifies the file name to load the light cache from, when the Mode is set to From file.
- Path tracing – in this mode, the light cache algorithm is used to sample the final image progressively.
Enable LC retrace – Retrace threshold – when enabled, this option improves the precision of the global illumination in cases where the light cache will produce too large an error. This is especially obvious with the Use light cache for glossy rays option, or near corners where light leaks might be possible because of the light cache interpolation. For glossy reflections and refractions, VRAYforC4D dynamically decides whether to use the light cache or not based on the surface glossiness and the distance from it so that the errors due to the light cache are minimized. Note that this options may increase the render time.
Retrace threshold – this parameter dynamically decides whether to use the light cache or not.
On render end
This group of controls determine what happens with the light cache after rendering is complete.
Auto save – when on, the light cache will be automatically written to the specified file. Note that the light cache will be written as soon as it is calculated, rather than at the actual end of the rendering.
Auto save file – when on, after the rendeing is complete, the light cache Mode will be automatically set to From file and the name of the auto-saved light cache file will be copied to the File parameter.
Do not set the Adaptive amount in the DMC sampler rollup to 0.0 when using the light cache, as this will cause excessive render times.
Do not apply perfectly white or very close to white materials to a majority of the objects in the scene, as this will cause excessive render times. This is because the amount of reflected light in the scene will decrease very gradually and the light cachewill have to trace longer paths. Also avoid materials that have one of their RGB components set to maximum (255) or above.
If you want to use the light cache for animation, you should choose a large enough value for the Filter size in order to remove the flickering in the GI.
There is no difference between light caches computed for primary bounces (direct visualization) and for secondary bounces. You can safely use light caches computed in one of these modes for the other.
Similar to the Photon map, you can get “light leaks” with the light cache around very thin surfaces with substantially different illumination on both sides. Sometimes it may be possible to reduce this effect by decreasing the Sample size and/or the filtering.