©BBB3viz

Table of Contents

This page provides information on the Light cache rollout.


Overview


This section controls and fine-tunes various aspects of the Light Cache. The Light cache rollout appears only when the Light cache method is selected as a Primary engine or Secondary engine on the Global Illumination rollout

For more details on how the Light cache engine calculates GI, please see the Light Cache GI page under Indirect Illumination.


UI Path: ||Render Setup window|| > GI tab > Light cache rollout
(When Light cache is set as a GI engine)




Default Parameters


Preset – Offers default Light cache settings for either Still or Animation rendering.

Subdivs – 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 are traced from the camera). For more information, see the Subdivs Parameter example below.

Sample size – Controls the size of the individual light cache samples. For more information, see the Sample Size example below.

Show calc. phase – Shows the paths that are traced. This does not affect the calculation of the light cache and is provided only as a feedback to the user. This option is ignored when rendering to fields - in that case, the calculation phase is never displayed.

Store direct light – When enabled, the light cache also stores and interpolates direct light. This can be useful for scenes with many lights when either irradiance map or direct GI (brute force) method is used for the primary diffuse bounces, since direct lighting is computed from the light cache instead of sampling each and every light. Note that only the diffuse illumination produced by the scene lights is stored. If you want to use the light cache directly for approximating the GI while keeping the direct lighting sharp, disable this option.

Retrace – Enables retracing of GI near corners. This helps prevent light leaks and flickering. Normally, this should be enabled. The value specifies the extent to which GI near corners are retraced instead of being read from the light cache. A value of 0.0 disables retracing. A value of 2.0 is good for still images, and 8.0 is good for animations. Higher values result in more rays traced at render time. For more information, see the Retrace example below.

Path guiding (experimental) – Uses a path guiding method (Intel® Open Path Guiding Library) to optimize the sampling quality. Path guiding is useful for scenes where GI or glossy reflections are hard to sample, such as interior scenes or scenes with a lot of occlusion. It is supported by VRayMtl, Environment Fog with enabled GI and Volume Grid with enabled GI. When using this option, note that the Subdivs should be at least 1000, and for same scenes - up to 3000. This option is available with V-Ray CPU only.

Note that Path guiding produces different results, when Max ray intensity or Sub-pixel mapping are enabled compared to when switched off. Different results in the raw render elements are expected, but they produce the correct result when multiplied by the respective filter render element. In some scenes containing diffuse surfaces with low poly count, the results may differ compared to rendering with this option switched off.

Please see the Path Guiding Examples below.

Mode – Determines the rendering mode of the light cache:

Single frame – Computes a new light cache for each frame of an animation.
From file
 – 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. 

File – Specifies the file name to load the light cache from, when the Mode is set to From file. Please note that you can also load a light cache by dragging and dropping a .vrlmap file directly in your viewport. Just be aware that doing so loads it for usage immediately, turning GI on, changing its Secondary engine to Light cache and its Mode to From file.

Save – Saves the light cache to a file on disk for later reuse. Note that the Don't delete option must be enabled for this to work. Otherwise, the light cache is deleted as soon as rendering is complete, and it is not possible to save it.

Don't delete – When enabled (the default), the light cache remains in memory after the rendering. Disable this option to automatically delete the light cache (and thus save memory).

Auto save – When enabled, the light cache is automatically written to the specified file. Note that the light cache is written as soon as it is calculated, rather than at the actual end of the rendering.

Switch to saved cache – When enabled, after the rendering is complete, the light cache Mode is automatically set to From file and the name of the auto-saved light cache file is copied to the File parameter.

To save a separate Light Cache file for each frame of an animation, append %04d suffix to the name of the file.




Example: Subdivs Parameter


The Subdivs parameter controls the number of rays that are shot into the scene and the noise quality of the light cache samples.

Here is a scene rendered with different settings for the Subdivs parameter (all other settings are the same).

As we add more samples, the noise is reduced, but the render times increase. When the Subdivs parameter is doubled, the light cache takes approximately 4 times longer to calculate.


Subdivs = 500

Subdivs = 1000

Subdivs = 2000

500
2000





Example: Sample Size


The Sample size parameter controls the size of the individual light cache samples. Smaller values produce a more detailed lighting solution, but are noisier and take more RAM. Larger values produce less detail, but take less RAM and may be faster to calculate. 

Here is a scene rendered with different values for the Sample size parameter. All other values are the same.

Note the light leak from the wall on the right in the last image. This happens because samples from the other side of the wall are quite large and end up being used on the side facing the camera.


Sample size = 0.01

Sample size = 0.02

Sample size = 0.03

0.01
0






Example: Retrace


The first set of images shows how the Retrace parameter can be used to reduce light leaks due to the light cache interpolation. The scene is an interior with parts of the exterior visible. For the GI settings, Brute Force is used for primary bounces (it is selected as the Primary engine in the Global Illumination Rollout) and Light cache is the Secondary engine.

The bright light cache samples from the exterior blend with the darker samples from the interior, causing light leaks when the light cache is calculated. The Retrace option (with the default value of 2.0) successfully resolves the problem at the expense of increased calculation time for the light cache.



Off
On



Off
On



In this second example, when Retrace is turned on, its value determines whether brute force is used instead of light cache near corners or objects that are close together. When the Retrace is greater than 0, only brute force is used which helps give a far more accurate result, although this may slow down rendering. However, if the Retrace value is 0.0, then only the light cache is used and thus retracing is disabled. This is faster but less accurate and more prone to noise and artifacts from light leakage.


If a high value is used for the Retrace, light leakage and artifacts will disappear and brute force will be used for a larger area. As a result, the render may appear more noisy. Therefore, the default Retrace value of 2.0 is sufficient in most cases.


Retrace is turned off.

Retrace turned on with a value set to 2.0. Notice how the light leaks above the window disappear and shadows in certain areas appear darker.

Retrace turned on with a value set to 0.0. As a result only the light cache has been used, which will be faster but produces artifacts near corners or in places where objects are close to each other.





Example: Path Guiding

For this example the scene is lit by VRayDome light with an HDRI and two rectangular VRayLights.
VRayEnvironmentFog is used as atmospheric effect with Scatter GI turned On and General Noise tex for the Fog density and the Fog transparency.
Render Setup: Progressive image sampler with Min. subdivs: 1 and Max. subdivs: 100; Max render time 20min and Noise threshold 0.05; Light cache Subdivs 1500


OFF
ON

Beauty Path Guiding

OFF
ON

SampleRate Path Guiding




Avoiding flickering in animations


Since the light cache is a biased GI solution, it can introduce some unwanted flickering in animations. Below are some tips to reduce this effect.

  • For interior renders or other complicated lighting situations, increasing the light cache Subdivs parameter makes the light cache smoother and more accurate; values around 2000 or 3000 typically work well.

  • The Retrace option helps to reduce light leaks and flickering. For animations, a value of 8.0 works well.


For animations with moving objects and/or moving camera:

  • Set the Subdivs parameter to 3000, Sample size to 0.01, Retrace enabled and Retrace threshold to 8.0.


Notes


  • Do not apply perfectly white or near-white materials to the majority of the objects in the scene, as this causes excessive render times. This is because the amount of reflected light in the scene will decrease very gradually and the light cache will have to trace longer paths. Also avoid materials that have one of their RGB components set to maximum (255) or above.

  • 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 might be possible to reduce this effect by assigning different GI Surface ID's to the objects on both sides of the thin surface (see the Object settings window); the effect can also be reduced by decreasing the Sample size and/or the filtering.

  • The Light Cache calculation cannot be distributed among several machines for distributed rendering.

  • An alternative way of loading a light cache is by dragging and dropping a .vrlmap file directly in your viewport. Just be aware that doing so will load it for usage immediately, turning GI on, changing its Secondary engine to Light cache and its Mode to From file.