Engine GI options

The GI process comes with some parameters in the engine. This is to let the users arbitrate between speed and accuracy. This can't be an automatic process because of the data to be rendered and the expectations of the user, but we tried to keep the number of parameters as low as possible.

GI estimator parameters

The quality of the GI estimator depends on the number of traced rays. The more rays, the better the estimation (think of it as sampling light sources: more rays will produce better shadows). The number of rays traced to build the estimator is given by: RED::OPTIONS_RAY_GI_ESTIMATOR_SAMPLING_RATE. The actual number of rays is the squared option value. Hence, if the option is set to 1000 (which is the default value), 1000x1000 = 1M rays will be traced.

The number of GI samples in the estimator does not depend on the number of traced rays but rather on the GI error (see The GI error).

GI cache parameters

The number of cache passes is set by RED::OPTIONS_RAY_GI_CACHE_PASSES_COUNT. The greater the number of passes, the more GI samples in the final GI cache. The engine uses the GI samples from the previous passes to estimate where new samples should be added. The refinement criterion depends on the local variation of the visibility function.

The GI cache after 1, 2 and 3 passes. Notice how the GI samples distribution follows the lighting complexity (more samples where lighting changes quickly).

In the image above, the RED::OPTIONS_RAY_GI_SHOW_SAMPLES was turned on.

For large flat areas, the cache contains very few samples. Instead, it concentrates its computation effort on locations where the signal is likely to vary stronger. Once the location of a GI cache sample is found, its value is computed by tracing a lot of rays around it in the scene. For each ray intersection, the lighting is estimated using the GI estimator by averaging several GI estimator samples together.

The RED::OPTIONS_RAY_GI_CACHE_HEMI_SAMPLING_RATE defines the number of rays taken for each GI cache sample. The actual number of rays is the squared option value. Default is 22; so number of rays actually traced is 22x22=484. Modifying this value helps in increasing the quality of the GI cache samples (just like increasing the number of shadow samples in a light helps increasing the shadow quality).

For the same number of GI samples, the quality of the GI estimate can be raised by increasing the value of RED::OPTIONS_RAY_GI_CACHE_HEMI_SAMPLING_RATE (22 to the left, 30 to the right).

Later, during the rendering, the GI cache is used to estimate the GI in each shading point. A user-defined number of GI samples (RED::OPTIONS_RAY_GI_CACHE_INTERP_SAMPLES_COUNT) is requested from the cache around the shading position. Then, the GI samples are averaged together to compute the estimate. The greater the samples count, the softer the interpolation. Be careful as if you use too many GI samples for interpolation, you can produce light leaks (light passing through obstacles).

When the number of samples is too high (orange case), GI is interpolated from both sides of the wall and light leak is visible), otherwise (blue case) most of the interpolated GI samples are on the correct side of the wall and light leak is not visible.

The GI error

The GI error (RED::OPTIONS_RAY_GI_ERROR) is common to both GI steps. This error value controls the precision of the GI structures being computed. As a consequence, the smaller the error, the bigger the number of entries in the GI structures.

A common issue when lowering the GI error is to get worst pictures. This is because lowering the error produces more GI samples but do not increase the individual GI sample quality and the GI interpolation works with a fixed number of GI samples. Hence, decreasing the GI error value increases the GI noise frequency, leading to the bubble effect. To overcome this, it's necessary to increase the GI samples quality together with decreasing the GI error.

Decreasing the error only captures more details (especially in corners and under the green sphere) but does not increase the GI cache quality.

To reduce the bubble effect due to a denser GI cache, we can increase the RED::OPTIONS_RAY_GI_CACHE_HEMI_SAMPLING_RATE option value:

RED::OPTIONS_RAY_GI_CACHE_HEMI_SAMPLING_RATE has been set to 50 (instead of 20) for a better GI sample quality. The bubble effect has now almost gone at the price of a longer rendering time.


This parameter should be reserved to experienced user, as modifying it implies adapting other GI parameter values as well. It's preferable to make it part of a GI preset.