IGICache

Functions

CID

GetClassID

RED_RC

Filter

RED_RC

FilterEstimator

RED_RC

GPUBuild

int

GetEstimatorPhotonsCount

int

GetCacheSamplesCount

Object *

GetGPUMaterial

Object *

GetGPUMesh

RED_RC

CopyFrom

Detailed Description

class IGICache

Interface to manipulate GI caches.

@related Global Illumination,GI Cache and Tone Mapping for Panorama, function RED::IWindow::FrameTracingGICache

GI caches are built each time a rendering operation including global illumination is processed, or when lighting contribution for baking purposes are performed. This interface exposes the method to manipulate such caches.

A GI cache can be used on the CPU or on the GPU. By default, a cache is not ready for GPU rendering, and a call to RED::IGICache::GPUBuild must occur before using the cache on the GPU.

Public Functions

virtual RED_RC Filter(double iRadius, double iThreshold, double iNormalTolerance) = 0

Filters the GI cache samples.

This method works by looking for neighbour samples in a sphere of user-defined radius around each GI sample in the cache. Those samples are then mixed together to get a new filtered value for the GI sample.

This results in a GI cache with the same number of samples but a smoother signal which reduces the GI noise but also attenuates some fine details.

Parameters
  • iRadius – radius of the sphere centred on each sample in model units.

  • iThreshold – filtering threshold value (in [0, 1]); the greater the value, the smoother the cache after filtering.

  • iNormalTolerance – allowed error in normal orientation between the sample and its neighbours (neighbour samples with larger error are discarded from the filtering operation); in [0, 1].

Returns

RED_OK on success, a RED_RC describing the error otherwise.

virtual RED_RC FilterEstimator(int iNeighborCount) = 0

Filters the GI estimator samples.

This method filters the content of the estimator by replacing each sample contribution by the average of the contributions of the sample neighbours.

This procudes a smoother estimator but, depending of the filter size, some light leaks may appear.

Parameters

iNeighborCount – Number of neighbors that are searched for.

Returns

RED_OK on success, a RED_RC describing the error otherwise.

virtual RED_RC GPUBuild(bool iDisplayGI, bool iDisplayBaking, double iBorderShrink, int iSmoothness, bool iShowEstimator, const RED::State &iState) = 0

Prepares the GI cache for GPU rendering.

Parameters
  • iDisplayGI – Display the GI irradiance lighting stored in the cache?

  • iDisplayBaking – Display the lighting contribution of baked lights?

  • iBorderShrink – This is a percentage ratio in [ 0.0, 1.0 ] that can be set to reduce the size of samples that are close to border geometries. Practically, it can be used to avoid having large samples leak through thin walls among different rooms in a building for instance. The default setup of 1.0 does not modify the area of effect of GPU samples. At 0.0, samples close to occluding geometries will not overlap these geometries.

  • iSmoothness – This is the smoothness value of the cache used for GPU rendering. Values are in the [ 1, inf [ range. This value is equivalent to the RED::OPTIONS_RAY_GI_CACHE_INTERP_SAMPLES_COUNT option used for software GI caches. It defines the number of GI samples searched around a point to shade for the interpolation of the GI around. A common value for this setting is 40. Lower values will preserve more details, but can let artifacts appear, higher value will smooth the result.

  • iShowEstimator – Show estimator samples instead of GI cache samples. The closest estimator sample is revealed.

  • iState – Current transaction parameter.

Returns

RED_OK if the operation has succeeded,

RED_BAD_PARAM if iBorderShrink is no in [ 0.0, 1.0 ],

RED_WORKFLOW_ERROR if ‘iState’ is not a valid transaction,

RED_ALLOC_FAILURE if an internal memory allocation fails,

RED_FAIL otherwise.

virtual int GetEstimatorPhotonsCount() const = 0

Gets the number of estimator photons stored in the cache.

Returns

The number of estimator photons stored in the object.

virtual int GetCacheSamplesCount() const = 0

Gets the number of cache samples.

Returns

The number of cache samples stored in the object.

virtual RED::Object *GetGPUMaterial() const = 0

Gets the material used to render the GI cache in GPU.

Returns

The RED::IMaterial object used to render the GI cache.

virtual RED::Object *GetGPUMesh() const = 0

Gets the mesh used to render the GI cache in GPU.

Returns

The RED::IPointShape object used to render the GI cache.

virtual RED_RC CopyFrom(const RED::Object &iGICache) = 0

Clones a GI cache.

This function copies the iGICache data into ‘this’. A RED::IGICache::GPUBuild needs to be done after the copy since the GPU data are not copied.

Parameters

iGICache – The GI cache to copy.

Returns

RED_OK if the operation has succeeded,

RED_BAD_PARAM if iGICache is not a valid

RED::IGICache

object,

RED_ALLOC_FAILURE if an internal memory allocation fails,

RED_FAIL otherwise.

Public Static Functions

static inline RED::CID GetClassID()