Table of Contents

This page provides information on the Light Cache rollout under the GI tab in V-Ray's Render Settings.

 

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 from 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


 

||Properties Editor|| > Render > GI tab > Light Cache rollout
(When Light Cache is chosen as an engine from the Global Illumination rollout)


Parameters


 

Mode – Determines the rendering mode of the light cache:

  • Progressive path tracing – The light cache algorithm is used to sample the final image progressively.

  • Single frame – Computes a new light cache for each frame of an animation.

  • Fly-through – Computes 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 set Scale to World for fly-through animations. The light cache for the entire animated sequence is computed only at the first rendered frame and is reused without changes for subsequent frames.

  • 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.

Calculation Parameters

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 will be traced from the camera).

Sample size – Determines the spacing of the samples in the light cache. Smaller numbers mean that the samples is closer to each other, the light cache preserves sharp details in lighting, but it is more noisy and takes more memory. Larger numbers smooths out the light cache but loses detail. This value can be either in world units or relative to the image size, depending on whether or not the World scale option is checked or not.

Sample scale – Determines the units of the Sample size and the Filter size:

Screen – The units are fractions of the final image (a value of 1.0 means the samples will be as large as the whole image). Samples that are closer to the camera are smaller, and samples that are far away are larger. Note that the units do not depend on the image resolution. This value is best suited for stills or animations where the light cache needs to be computed at each frame.  
World
 – The sizes are fixed in world units everywhere. This can affect the quality of the samples - samples that are close to the camera are sampled more often and appear smoother, while samples that are far away are noisier. This value might work better for fly-through animations, since it forces constant sample density everywhere.

Depth  Controls the maximum number of secondary bounces that a ray of light may do. Note that this value is an upper limit.

Store direct light  When enabled, the light cache also stores and interpolate 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.

Adaptive tracing – When enabled, V-Ray stores additional information about the incoming light for each light cache sample, and try to put more samples into the directions from which more light coming. This may help to reduce the noise in the light cache, particularly in the case of caustics.

Show calc. phase  Turning this option on 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.

Auto Num. Phases – Splits the calculation into the number of available CPU threads.

Reconstruction Parameters

These parameters control how the light cache is used in the final rendering, after is has been calculated.

 Filter/Type – It determines the type of render-time filter for the light cache. The filter determines how irradiance is interpolated from the samples in the light cache.

None  No filtering is performed. The nearest sample to the shaded point is taken as the irradiance value. This is the fastest option, but it may produce artifacts near corners, if the light cache is noisy. You can use pre-filtering (see above) to decrease that noise. This option works best if the light cache is used for secondary bounces only or for testing purposes.
Nearest 
 
This filter looks up the nearest samples to the shading point and averages their value. This filter is not suitable for direct visualization of the light cache, but is useful if you use the light cache for secondary bounces. A property of this filter is that it adapts to the sample density of the light cache and is c
omputed for a nearly constant time. The Filter Samples parameter determines how many of the nearest samples to look up from the light cache.
Fixed 
 
This filter looks up and averages all samples from the light cache that fall within a certain distance from the shaded point. This filter produces smooth results and is suitable for direct visualization of the light cache (when it is used as the primary GI engine). The size of the filter is determined by the Filter Samples parameter. Larger values blur the light cache and smooth out noise. Typical values for the  Filter Samples are 2-6 times larger than the Sample Samples. Note that Filter Samples uses the same scale as the Sample Samples and its meaning depends on the Scale parameter.

Prefilter – When turned on, the samples in the light cache are filtered before rendering. Note that this is different from the normal light cache filtering (see below) which happens during rendering. Pre-filtering is performed by examining each sample in turn, and modifying it so that it represents the average of the given number of nearby samples. More prefilter samples mean a blurrier and less noisy light cache. Pre-filtering is computed once after a new light cache is computed or loaded from disk.

Use for glossy rays – When enabled, the light cache is used to compute lighting for glossy rays as well, in addition to normal GI rays. This can speed up rendering of scenes with glossy reflections quite a lot. When you use this option, it is recommended to also enable the  Retrace threshold  option, which prevents the light cache from being visible in very glossy surfaces.

Use camera path – When enabled, V-Ray calculates 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 helps to reduce any flickering, as the GI sample positions on static geometry do not change.

Use retrace threshold – When enabled, this option improves the precision of the global illumination in cases where the light cache produces 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, V-Ray 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 thresh. – Sets the value for the retracing threshold. 

Files

Auto SaveIf this option is set, V-Ray automatically saves the light cache to the specified file at the end of the rendering. This mode is particularly useful if you want to send the irradiance map for rendering on a different machine through network rendering.

 


 


 

 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). The Sample Scale option is set to World.

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. Here, the Scale option is set to Screen.

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. Compare with the images rendered in the previous example, where Scale is set to World. Also note the difference in the noise level between the samples.

 

 

 

Sample size = 0.01

Sample size = 0.02

Sample size = 0.0

0.01
0.0

 

 



Example: Sample scale

 

The Sample scale parameter determines whether the Sample size and Filter size parameters are in Screen space or World space.

In the table below, Screen scale was used and the scene was rendered with different image and world sizes. The Sample size was constant for all images (default value 0.02).

As you can see, we always get the same number of light cache samples for all cases, regardless of resolution or scene size. In fact, when scaled to the same size, the images look identical. For this reason, Screen scale is applicable to the large variety of scenes.

 

 

Scene scaled down to 50%

Normal scene

Scene scaled up to 200%

Resolution 250x300

 

 

 

Resolution 500x600

 

 

 

Resolution 1000x1200

 

 

 

 


 

In the table below, the World scale mode was used. Again, the scene is rendered at three different resolutions and scales, but with the same light cache parameters. The sample size was set to be 1/5th of the sphere's radius in the scene at normal scale.

You will notice that the number of samples again does not depend on the image resolution, but it does depend on the scene size.

Also notice how the samples near the camera appear larger because of the perspective. Compare with Screen scale, which compensates for this effect and tries to make samples with more or less equal sizes in the image.

Another thing to note is that we don't get light leaks even when the samples are relatively large, as we did in the Sample Size example. This is because World scale forces a uniform sample size on both sides of the right wall.

 

 

Scene scaled down to 50%

Normal scene

Scene scaled up to 200%

Resolution 250x300

 

 

 

Resolution 500x600

 

 

 

Resolution 1000x1200

 

 

 

 


  

Example: Retrace

 

The first set of images shows how the Retrace thresh. 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 thresh. option (with the default value of 2.0) successfully resolves the problem at the expense of increased calculation time for the light cache.

 

 

Use Retrace Threshold


Disabled
Enabled

Use retrace threshold: Close Up


Disabled
Enabled

 

 

 

The second scene in this example shows how the Retrace thresh. option can be used to improve the appearance of glossy reflections and refractions with the Use for glossy rays option. In this case, V-Ray dynamically decides whether to use the light cache or not, based on the glossiness of the surface and the distance from it.

Use retrace threshold

Disabled
Enabled

 

Use retrace threshold

Disabled
Enabled

 

Without retracing, the light cache samples are clearly visible in the glossy reflections and refractions.

In this third example, when Use retrace threshold is turned on, the Retrace thresh. value determines whether Brute Force will be used instead of Light cache near corners or objects that are close together. When the Retrace thresh. 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 thresh. value is 0.0, then only the light cache will be used and thus retracing is disabled.  This will be faster but less accurate and more prone to noise and artifacts from light leakage.

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

 

Use retrace threshold is turned off.

 Use retrace threshold turned on with a value set to 2.0.

Use retrace threshold turned on with a value set to 0.0. 

 

 

 

Notes


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