ISoftRenderingContext

Functions

CID

GetClassID

int

GetRayTransparencyDepth

int

GetRayShadowDepth

int

GetRayReflectionDepth

int

GetRayRefractionDepth

bool

GetRayRefractionBack

int

GetShadowMapDepth

double

GetRayCutoffThreshold

double

GetRayAdaptiveSamplingThreshold

double

GetRayAdaptiveSamplingAllowedTime

double

GetRayMaxSecondaryRayIntensity

bool

IsGlossyEffects

bool

IsAreaSampling

int

GetRayVolumeDepth

bool

IsRayDisplacement

bool

IsRayForcedTransparency

double

GetPhysicalLightCutoff

int

GetRayWorldCacheSamplesCount

void

GetClearColor

void

GetClearDepth

void

GetBackgroundDepth

Object *

GetBackgroundCubeImage

const Matrix &

GetBackgroundCubeImageMatrix

Object *

GetBackground2DImage

const Matrix &

GetBackground2DImageMatrix

bool

GetBackgroundImagesDirectVisibility

double

GetBackgroundImagesIntensityScaleCube

double

GetBackgroundImagesIntensityScale2D

bool

IsBackgroundImage

void

GetAmbientLight

unsigned int

GetLightsCount

const ISoftLight &

GetLight

bool

IsVolumetricEffects

Object *

GetVolumeShape

bool

IsEmissiveBackground

int

ShowGISamples

bool

IsGIEnabled

void

GetGISettings

void

GetCaustics

const Matrix &

GetViewingMatrix

const Matrix &

GetInvertViewingMatrix

const Matrix &

GetViewProjectionMatrix

const Matrix &

GetProjectionMatrix

const Matrix &

GetViewportMatrix

const Matrix &

GetViewProjectionViewportMatrix

int

GetStateNumber

Object *

GetVRL

Detailed Description

class ISoftRenderingContext : public RED::IREDObject

Software rendering context interface. Contains global rendering parameters.

@related The CPU Programming Pipeline, Writing a Custom Software Rendering Shader, class RED::ISoftRayContext, class RED::ISoftShaderContext

Use this interface to retrieve the values of all the engine parameters at render time.

Public Functions

virtual int GetRayTransparencyDepth() const = 0
Returns

The maximal depth of ray-traced transparencies.

virtual int GetRayShadowDepth() const = 0
Returns

The maximal depth of ray-traced shadows.

virtual int GetRayReflectionDepth() const = 0
Returns

The maximal depth of ray-traced reflections.

virtual int GetRayRefractionDepth() const = 0
Returns

The maximal depth of ray-traced refractions.

virtual bool GetRayRefractionBack() const = 0
Returns

The ray refraction back option value.

virtual int GetShadowMapDepth() const = 0
Returns

The maximal depth of shadow maps.

virtual double GetRayCutoffThreshold() const = 0
Returns

The minimal needed intensity for a ray to be propagated.

virtual double GetRayAdaptiveSamplingThreshold() const = 0
Returns

The ray-tracer adaptive sampling threshold.

virtual double GetRayAdaptiveSamplingAllowedTime() const = 0
Returns

The ray-tracer adaptive sampling allowed time.

virtual double GetRayMaxSecondaryRayIntensity() const = 0
Returns

The ray-tracer maximal secondary ray intensity threshold.

virtual bool IsGlossyEffects() const = 0
Returns

true if glossy ray-traced effects are enabled, false otherwise.

virtual bool IsAreaSampling() const = 0
Returns

true if area sampling effects are enabled, false otherwise.

virtual int GetRayVolumeDepth() const = 0
Returns

The maximal depth of ray-traced volume.

virtual bool IsRayDisplacement() const = 0
Returns

True if displacement mapping is enabled, false otherwise.

virtual bool IsRayForcedTransparency() const = 0
Returns

true if the software ray-tracer needs to go through all transparency layers, regardeless of the opacity of hit surfaces.

virtual double GetPhysicalLightCutoff() const = 0
Returns

the physical light cutoff option value.

virtual int GetRayWorldCacheSamplesCount() const = 0
Returns

The number of samples to process for a world cache calculation.

virtual void GetClearColor(double oClearColor[4]) const = 0

Gets the clear color.

This is the buffer clear color that was defined using RED::IViewpointRenderList::SetClearColor.

Parameters

oClearColor – The image clear color.

virtual void GetClearDepth(double &oClearDepth) const = 0

Gets the clear depth.

This is the buffer clear depth that was defined using RED::IViewpointRenderList::SetClearDepth.

Parameters

oClearDepth – The image clear depth.

virtual void GetBackgroundDepth(double &oBackgroundDepth) const = 0

Retrieves the depth of the background images.

The rendering of the background writes a depth value in the rendering buffer. This value is set to a constant depth, slightly below 1.0, which is the default clear depth of a rendering buffer.

Parameters

oBackgroundDepth – The background image rendering depth.

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

Retrieves the background cube image.

Returns

The address of the current background cube image.

virtual const RED::Matrix &GetBackgroundCubeImageMatrix() const = 0

Retrieves the background cube image transform.

Returns

The background cube image matrix that transforms the ray direction prior to sampling the background image.

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

Retrieves the background 2D image.

Returns

The address of the current background 2D image.

virtual const RED::Matrix &GetBackground2DImageMatrix() const = 0

Retrieves the background 2D image transform.

Returns

The background 2D image matrix that transforms the fragment position prior to sampling the background image.

virtual bool GetBackgroundImagesDirectVisibility() const = 0

Retrieves background images direct visibility setting.

Returns

‘true’: in this case, background images are seen for all direct rays that don’t hit any scene geometry. ‘false’: the cube background image is seen in indirect rays that don’t hit any scene geometry. The 2D background image is not visible.

virtual double GetBackgroundImagesIntensityScaleCube() const = 0
Returns

The intensity scaling factor applied to the background cube image.

virtual double GetBackgroundImagesIntensityScale2D() const = 0
Returns

The intensity scaling factor applied to the background 2D image.

virtual bool IsBackgroundImage() const = 0

Do we have a background image to handle?

Returns

true if we have at least one background image being set.

virtual void GetAmbientLight(double oAmbientLight[4]) const = 0

Gets the color of the ambient light.

Parameters

oAmbientLight – The ambient light color.

virtual unsigned int GetLightsCount() const = 0

Returns the number of lights.

Returns

the number of lights.

virtual const RED::ISoftLight &GetLight(unsigned int iLight) const = 0

Returns the requested light.

Parameters

iLight – index of the light to retrieve.

Returns

The requested light.

virtual bool IsVolumetricEffects() const = 0

Do we have volumetric effects in the rendering of our scene?

Returns

true if we have a volumetric shape that defines volumetric effects for our scene, false otherwise.

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

Retrieves the volume shape of our scene if any.

Returns

The volume shape.

virtual bool IsEmissiveBackground() const = 0

Do we consider the background as emitting energy?

We have an emissive background if our scene contains an emissive skylight which is set to be emissive using RED::ISkyLightShape::SetEmissiveSky.

Returns

true if the scene background is emissive for the GI, false otherwise.

virtual int ShowGISamples() const = 0

Do we want to show the GI samples?

The returned value is defined by the RED::OPTIONS_RAY_GI_SHOW_SAMPLES option.

Returns

1, 2 or 3 if GI samples must be displayed, 0 otherwise.

virtual bool IsGIEnabled() const = 0

Return true if GI is enabled.

Note that GI is considered disabled, regardless of the option value being set, if we render an image using external, ready-to-use, GI caches.

Returns

true if GI is enabled, false otherwise.

virtual void GetGISettings(bool &oGIEnabled, double &oGIError, double &oGlossinessThreshold, bool &oLighting, int &oEstimatorSamplingRate, int &oEstimatorInterSamplesCount, int &oCachePassesCount, int &oCacheHemiSamplesCount, int &oCacheInterpSamplesCount, double &oCacheNormalTolerance, double &oCacheDistanceTolerance, bool &oCachePrecise) const = 0

Gets the current GI settings.

Note that GI is considered disabled, regardless of the option value being set, if we render an image using external, ready-to-use, GI caches.

Parameters
  • oGIEnabled – true if GI is enabled, false otherwise.

  • oGIError – user-defined GI error.

  • oGlossinessThreshold – the user-defined threshold for glossiness approximation using the GI cache (see RED::OPTIONS_RAY_GI_FOR_GLOSSINESS).

  • oLighting – the value of the RED::OPTIONS_RAY_GI_FOR_LIGHTING option.

  • oEstimatorSamplingRate – the number of rays traced to compute the GI estimator.

  • oEstimatorInterSamplesCount – the number of samples used during GI estimator interpolation.

  • oCachePassesCount – the number of passes to compute the irradiance cache (can be negative in convergence mode).

  • oCacheHemiSamplesCount – the hemispherical sampling rays count.

  • oCacheInterpSamplesCount – the cache interpolation count.

  • oCacheNormalTolerance – the cache normal tolerance.

  • oCacheDistanceTolerance – the cache distance tolerance.

  • oCachePrecise – the precise cache flag value.

virtual void GetCaustics(bool &oEnabled, unsigned int &oPhotonsCount, double &oSearchRadius, unsigned int &oSearchPhotonsCount) const = 0

Gets the current caustics settings.

Caustics are automatically disabled as soon as the photons count or the search radius is 0 (even if the caustics are enabled at the engine level). So, the ‘oEnabled’ value returned by the call may not reflect the true value of the corresponding engine option (RED::OPTIONS_RAY_ENABLE_CAUSTICS).

Parameters
  • oEnabled – true if caustics are enabled, false otherwise.

  • oPhotonsCount – total number of requested caustics photons.

  • oSearchRadius – caustics photons search radius in scene units.

  • oSearchPhotonsCount – maximum number of photons to be searched for.

virtual const RED::Matrix &GetViewingMatrix() const = 0

Gets the viewing transform matrix (sight, top, right, eye).

Returns

the viewing transform matrix (sight, top, right, eye).

virtual const RED::Matrix &GetInvertViewingMatrix() const = 0

Gets the inverse of the viewing transform matrix.

Returns

the inverse of the viewing transform matrix.

virtual const RED::Matrix &GetViewProjectionMatrix() const = 0

Gets the view matrix * projection matrix of the camera.

The view-projection matrix is the product of the camera projection matrix by the invert viewing matrix defined by the camera axis system. See RED::IViewpoint::GetViewProjectionMatrix for details.

Returns

the view-projection transform matrix.

virtual const RED::Matrix &GetProjectionMatrix() const = 0

Gets the projection transform matrix.

The projection matrix is the camera perspective / orthographic or custom transform matrix. See RED::IViewpoint::GetProjectionMatrix for details.

Returns

The projection transform matrix.

virtual const RED::Matrix &GetViewportMatrix() const = 0

Gets the viewport transform matrix.

The viewport transform matrix for the rendered camera. See RED::IViewpointRenderList::GetViewportMatrix for details.

Returns

The viewport transform matrix.

virtual const RED::Matrix &GetViewProjectionViewportMatrix() const = 0

Gets the viewport * view-projection transform matrix.

This method returns the viewport matrix of the camera in it’s VRL multiplied by the view-projection matrix of the camera. This is the complete transform applied to a (x,y,z,1) position in space to get to a screen (x,y,z,w) coordinate.

The method returns non normalized coordinates (e.g. full screen coordinates). The RED::ISoftRenderingContext::GetViewProjectionMatrix transforms a point into normalized coordinates before the application of the viewport transform.

For all details on the REDsdk transformation pipeline, please refer to \ref bk_ba_matrix_transforms_in_a_cluster.

Returns

The model-view projection transform matrix.

virtual int GetStateNumber() const = 0
Returns

The number of the transaction being rendered.

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

Gets the source VRL hosting our rendered camera.

Returns

The address of the VRL we’re rendered in.

Public Static Functions

static inline RED::CID GetClassID()