class RED::ISoftRayContext

Define read-only access methods to the context of a soft tracer ray. More...

#include <REDISoftRayContext.h>

Inherits: IREDObject.

Public functions:

virtual boolCanApproximateLighting ( double oLighting[4], double oIndirectLighting[4], const double iPoint[3], const double iNormal[3], const RED::ISoftRenderingContext & iRenderingContext ) const = 0
virtual RED_RCEstimateCaustics ( double oCaustics[4], const double iPoint[3], const double iNormal[3], const RED::ISoftRenderingContext & iRenderingContext ) const = 0
virtual RED_RCEstimateGI ( double oGI[4], const double iPoint[3], const double iNormal[3], unsigned int iRayDepth, const RED::ISoftRenderingContext & iRenderingContext ) const = 0
virtual const RED::Object *GetCamera ( ) const = 0
virtual voidGetCutoff ( double oCutoff[4] ) const = 0
virtual intGetDepth ( ) const = 0
virtual intGetElementUID ( ) const = 0
virtual const RED::Object *GetGeometryDatabase ( ) const = 0
virtual voidGetGlossySampleDir ( double oSampleDir[3] ) const = 0
virtual voidGetHitInterval ( double & oTMin, double & oTMax ) const = 0
virtual const RED::Matrix *GetInverseTransposeMatrix ( ) const = 0
virtual doubleGetIOR ( ) const = 0
virtual const RED::ISoftLight *GetLight ( const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual const RED::Matrix *GetMatrix ( ) const = 0
virtual doubleGetNextIOR ( ) const = 0
virtual doubleGetNormalFacing ( ) const = 0
virtual voidGetObjectElementIndices ( int & oI0, int & oI1, int & oI2 ) const = 0
virtual intGetObjectElementNumber ( ) const = 0
virtual voidGetObjectElementUVs ( double & oU, double & oV ) const = 0
virtual voidGetObjectElementWCS ( double oP0[4], double oP1[4], double oP2[4] ) const = 0
virtual RED::LayerSet *GetObjectLayerSet ( ) const = 0
virtual RED::Object *GetObjectMaterial ( ) const = 0
virtual RED::Matrix *GetObjectMatrix ( ) const = 0
virtual RED::Object *GetObjectShape ( ) const = 0
virtual const RED::ShapePath &GetObjectShapePath ( ) const = 0
virtual intGetObjectUID ( ) const = 0
virtual voidGetPixelCoordinates ( double oPixel[2] ) const = 0
virtual voidGetPrimaryPixelFrustum ( double oFrustumPlanes[24] ) const = 0
virtual voidGetReflectionColor ( double oColor[4] ) const = 0
virtual voidGetReflectionDistance ( double & oDistance ) const = 0
virtual voidGetRefractionColor ( double oColor[4] ) const = 0
virtual voidGetRefractionDistance ( double & oDistance ) const = 0
virtual RED_RCGetShadowColor ( double oShadowColor[4], const RED::ISoftLight * iLight, const RED::ISoftRenderingContext & iRenderCtx, const double * iSamplePos = NULL, int iSampleTID = 0, bool iForceTwoSided = false ) const = 0
virtual intGetThreadID ( ) const = 0
virtual voidGetWCSDifferentials ( double oWCSdPdX[4], double oWCSdPdY[4] ) const = 0
virtual voidGetWCSHit ( double oWCSHit[4] ) const = 0
virtual voidGetWCSIncoming ( double oWCSIncoming[4] ) const = 0
virtual voidGetWCSNormal ( double oWCSNormal[4], const RED::RenderCode & iRenderCode, RED_VSH_INPUT iChannel = RED_VSH_NORMAL ) const = 0
virtual voidGetWCSTangent ( double oWCSTangent[4], const RED::RenderCode & iRenderCode, RED_VSH_INPUT iChannel = RED_VSH_COLOR ) const = 0
virtual boolHasDifferentials ( ) const = 0
virtual voidInterpolate ( double oInterpolated[4], const RED::RenderCode & iRenderCode, RED_VSH_INPUT iChannel ) const = 0
virtual voidInterpolate ( double oInterpolated[4], RED::MESH_CHANNEL iMeshChannel ) const = 0
virtual boolIsComputingGI ( ) const = 0
virtual boolIsGICache ( ) const = 0
virtual boolIsGlossinessAnglesOnly ( ) const = 0
virtual boolIsIOROnly ( ) const = 0
virtual boolIsNoBumpNormalOnly ( ) const = 0
virtual boolIsShadingNormalOnly ( ) const = 0
virtual boolIsTangentOnly ( ) const = 0
virtual RED_RCPrepareLights ( const double * iPoint, const double * iNormal, bool iIncludeBakedLights, const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual doubleRandF ( ) const = 0
virtual unsigned intRandI ( ) const = 0
virtual voidSampleBackgroundImage ( double oColor[4], const double iE[4], const double iP[4], bool iDirect, const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual voidSampleFontGlyphTexture ( double oColor[4], RED_VSH_INPUT iUVChannel, const RED::ISoftShaderContext & iShaderContext, const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual voidSampleNormalMap ( double oBumpNormalWCS[4], double oNormalWCS[4], double oTangentWCS[4], int iTextureBind, RED_VSH_INPUT iUVChannel, RED_VSH_INPUT iNormalChannel, RED_VSH_INPUT iTangentChannel, int iUVMatrixBind, const RED::ISoftShaderContext & iShaderContext, const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual voidSampleTexture ( double oColor[4], const RED::Object * iTexture, RED::MESH_CHANNEL iUVChannel, const RED::Matrix & iUVMatrix, const RED::ISoftShaderContext & iShaderContext, const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual voidSampleTexture ( double oColor[4], int iTextureBind, RED_VSH_INPUT iUVChannel, int iUVMatrixBind, const double iColor[4], const RED::ISoftShaderContext & iShaderContext, const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual voidSampleTexture ( double oColor[4], int iColorBind, int iTextureBind, RED_VSH_INPUT iUVChannel, int iUVMatrixBind, const RED::ISoftShaderContext & iShaderContext, const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual voidSampleTexture ( double oColor[4], int iColorBind, int iTextureBind, const double iUV[4], const RED::Matrix & iUVMatrix, const RED::ISoftShaderContext & iShaderContext, const RED::ISoftRenderingContext & iRenderContext ) const = 0
virtual voidSampleTexture ( double oColor[4], const RED::Object * iTexture, const double iUV[4], const RED::ISoftShaderContext & iShaderContext, const RED::ISoftRenderingContext & iRenderContext ) const = 0

Public static functions:

static RED::CIDGetClassID ( )

Detailed description:

Define read-only access methods to the context of a soft tracer ray.

This interface is retrieved from a RED::SOFT_SHADER_CALLBACK, and contains all the informations that are accessible for the current ray that is being processed by the software ray-tracer.

Functions documentation

public virtual bool RED::ISoftRayContext::CanApproximateLighting(doubleoLighting[4],
doubleoIndirectLighting[4],
const doubleiPoint[3],
const doubleiNormal[3],
const RED::ISoftRenderingContext &iRenderingContext
)const = 0

Returns true if approximated lighting can be used, false otherwise.

Parameters:

oLighting:if approximate lighting can be used, this variable stores the returned lighting approximation at the given point.
oIndirectLighting:if approximate lighting can be used, this variable stores the returned indirect lighting approximation at the given point.
iPoint:shading position.
iNormal:normal at the shading position.
iRenderingContext:reference to the current rendering context.

Returns:

true if approximated lighting can be used, false otherwise.
public virtual RED_RC RED::ISoftRayContext::EstimateCaustics(doubleoCaustics[4],
const doubleiPoint[3],
const doubleiNormal[3],
const RED::ISoftRenderingContext &iRenderingContext
)const = 0

Estimates the illumination due to caustics at a given point and orientation.

Parameters:

oCaustics:reference to the returned caustics color.
iPoint:point where to estimate the caustics.
iNormal:normal at the previous point.
iRenderingContext:global rendering context.

Returns:

RED_OK in case of success,
RED_ALLOC_FAILURE if an internal error has failed,
RED_FAIL otherwise.
public virtual RED_RC RED::ISoftRayContext::EstimateGI(doubleoGI[4],
const doubleiPoint[3],
const doubleiNormal[3],
unsigned intiRayDepth,
const RED::ISoftRenderingContext &iRenderingContext
)const = 0

Estimates the GI at a given point with the given orientation.

Parameters:

oGI:reference to the returned indirect illumination (direct illumination is not included).
iPoint:point where to estimate the irradiance.
iNormal:normal at the previous point.
iRayDepth:depth of the ray.
iRenderingContext:global rendering context.

Returns:

RED_OK in case of success,
RED_ALLOC_FAILURE if an internal error has failed,
RED_FAIL otherwise.
public virtual const RED::Object * RED::ISoftRayContext::GetCamera() const = 0

Returns:

a pointer to the camera the ray comes from (can be NULL)
public virtual void RED::ISoftRayContext::GetCutoff(doubleoCutoff[4]) const = 0

Gets the ray cutoff information.

Parameters:

oCutoffthe ray cutoff information.
public virtual int RED::ISoftRayContext::GetDepth() const = 0

Returns:

The depth we're at in the ray-tree.
public virtual int RED::ISoftRayContext::GetElementUID() const = 0

Gets the hit element of the hit object unique ID (UID).

The UID is the unique identifier for the hit element in the hit object. Two different triangles in a mesh have different UIDs. The two meshes objects themselves have different UIDs, returned by RED::ISoftRayContext::GetObjectUID.

If the hit primitive is a custom primitive, the returned hit element is -1.

public virtual const RED::Object * RED::ISoftRayContext::GetGeometryDatabase() const = 0

Returns:

The geometry database containing the scene we're rendering. Maybe returned NULL for some specific rendering workflows.

The returned object implements the RED::IGeometryDatabase interface. Note that when accessed from a RED::ISoftRayContext, we're in a threaded rendering, and the RED::IGeometryDatabase should be used using RED::ISoftRayContext::GetThreadID as calling thread number.

public virtual void RED::ISoftRayContext::GetGlossySampleDir(doubleoSampleDir[3]) const = 0

Gets a sampling direction for glossiness.

This method returns a normalized direction in the cone defined by the material glossiness angle parameter. Each time the method is called, a new sampling direction is returned.

Parameters:

oSampleDir:the returned sampling direction.
public virtual void RED::ISoftRayContext::GetHitInterval(double &oTMin,
double &oTMax
)const = 0

Gets the parametric hit interval of the primitive on the ray or frustum.

For a ray propagation (ray bounces at depth > 0 for standard images), this method returns the parametric length of the hit point along the propagated ray. In this configuration, 'oTMin' and 'oTMax' are identical and set to this unique value.

For a frustum propagation (case of a pixel analytics query), this method returns the parametric boundaries (as a z-buffer depth) of the intersection of the primitive with the propagated frustum. 'oTMin' corresponds to the closest hit point of the hit primitive with the frustum; 'oTMax' corresponds to the farthest hit point of the same primitive with the frustum.

Parameters:

oTMin:Parametric interval of the hit primitive.
oTMax:Parametric interval of the hit primitive.

Gets the inverse transpose matrix of the last object hit on the ray stack. The result can be NULL if the object has no matrix.

Returns:

a pointer to the inverse transpose matrix (can be NULL).
public virtual double RED::ISoftRayContext::GetIOR() const = 0

Gets the index of refraction (IOR) of the hit material.

Returns:

the index of refraction (IOR) of the hit material.
public virtual const RED::ISoftLight * RED::ISoftRayContext::GetLight(const RED::ISoftRenderingContext &iRenderContext) const = 0

Retrieves the current light to be rendered.

Parameters:

iRenderContext:The rendering context.

Returns:

the address of the current light to render, NULL if the parsing is over.
public virtual const RED::Matrix * RED::ISoftRayContext::GetMatrix() const = 0

Gets the transformation matrix of the last object hit on the ray stack. The result can be NULL if the object has no matrix.

Returns:

a pointer to the matrix (can be NULL).
public virtual double RED::ISoftRayContext::GetNextIOR() const = 0

Gets the index of refraction (IOR) of the next material in the ray tree.

Returns:

the index of refraction (IOR) of the next material in the ray tree.
public virtual double RED::ISoftRayContext::GetNormalFacing() const = 0

Checks the facing of the eye vector against the hit triangle normal.

Returns:

+1.0f if we are front facing the hit triangle; -1.0f otherwise.
public virtual void RED::ISoftRayContext::GetObjectElementIndices(int &oI0,
int &oI1,
int &oI2
)const = 0

Retrieves the hit element mesh indices in the hit object.

This method returns the hit element indices in the hit object. For a triangle, this means the triangle three vertex indices [ oI0, oI1, oI2 ]; for a line strip or segment, this means two vertex indices [ oI0, oI1, -1 ]; for a point, only one vertex index is returned: [ oI0, -1, -1 ].

In the case of a custom primitive hit, the returned element indices are all -1.

Parameters:

oI0:Index of the first vertex of the hit element in the hit object instance.
oI1:Index of the second vertex of the hit element in the hit object instance.
oI2:Index of the third vertex of the hit element in the hit object instance.

Retrieves the number of the hit element in the hit object.

The returned number is either the number of the triangle, line segment, line strip or point in the hit shape instance.

If the hit primitive is a custom primitive, the returned hit element number is -1.

Returns:

The hit Object element number.
public virtual void RED::ISoftRayContext::GetObjectElementUVs(double &oU,
double &oV
)const = 0

Retrieves the hit element mesh intersection UVs in the hit object.

This method returns the hit element intersection UVs in the hit object. For a triangle, this means that these UVs can be used to reconstruct the hit point, using P0 + oU*P0P1 + oV*P0P2. For a line element, the reconstruction is P0 + oU*P0P1; oV is undefined. For a point, oU and oV are undefined. In the case of a custom primitve, the returned values are undefined.

Parameters:

oU:Intersection UVs of the hit element in the hit object.
oV:Intersection UVs of the hit element in the hit object.
public virtual void RED::ISoftRayContext::GetObjectElementWCS(doubleoP0[4],
doubleoP1[4],
doubleoP2[4]
)const = 0

Retrieves the WCS vertices of the hit element in the hit object.

This method directly returns the WCS positions of the vertices that define the hit element in the hit object. The third vertex is set to [ 0.0 ] for a line and the second and third vertices are set to [ 0.0 ] for a point.

In the case of a custom primitive hit, all element hit coordinates are set to 0.0.

Parameters:

oP0:First vertex of the hit element in the hit object instance.
oP1:Second vertex of the hit element in the hit object instance.
oP2:Third vertex of the hit element in the hit object instance.

Retrieves the shape RED::LayerSet for this instance of the hit object.

The returned layerset is the last layerset found on the path from the root of the scene down to the hit object instance, according to the inheritance rules in use for the scene graph.

In the case of a custom primitive hit, the returned layerset is NULL.

Returns:

The RED::LayerSet to apply for this object. NULL if there's no layerset.

Retrieves the shape material for this instance of the hit object.

Retrieve the material to use to display the hit object. The material being returned is calculated based on the DAG hierarchy in the scene and material inheritance rules. The last material on the path from the root of the scene down to the object instance is returned.

In the case of a custom primitive hit, the returned material address is the one that was returned by the SOFT_RAY_PROCESSING_SHADING_CALLBACK.

Returns:

The material address.

Retrieves the shape matrix for this instance of the hit object.

The returned matrix is the cumulated matrix on the path from the root of the scene down to the hit object instance.

In the case of a custom primitive hit, the returned matrix is NULL.

Returns:

The matrix to apply for this object. NULL if there's no transform.

Retrieves the shape object of the hit object.

In the case of a custom primitive hit, the returned shape address is NULL.

Returns:

The address of the shape of the hit object.
public virtual const RED::ShapePath & RED::ISoftRayContext::GetObjectShapePath() const = 0

Retrieves the shape path of the hit object.

In the case of a custom primitive hit, the returned shape path is empty.

Returns:

A reference on the internal shape path associated to the hit shape instance.
public virtual int RED::ISoftRayContext::GetObjectUID() const = 0

Gets the object unique ID (UID) of the hit object.

The UID is the unique identifier for the hit object. This means that two instances of the same shape object have different unique IDs assigned by the engine. If the hit primitive is a custom primitive, then there's no valid UID stored in the engine database for the hit object. In this case, the returned UID is -1.

Returns:

The object UID.
public virtual void RED::ISoftRayContext::GetPixelCoordinates(doubleoPixel[2]) const = 0

Gets the coordinates of the pixel through which the first ray of the stack has been sent.

Parameters:

oPixel:Returned 2D vector containing the pixel coordinates.
public virtual void RED::ISoftRayContext::GetPrimaryPixelFrustum(doubleoFrustumPlanes[24]) const = 0

Gets the geometrical frustum defined by a pixel.

This method returns the geometrical coordinates of a primary pixel frustum. The frustum is the truncated pyramid fired from the camera eye that cover the pixel screen. It's illustrated in the image below:

Definition of a primary pixel beam.

Parameters:

oFrustumPlanes:6 planes equations with 4 coefficients each [ a, b, c, d ], defining the plane equation: [ a*X + b*Y + c*Z + d = 0.0 ] are returned for a total of 24 values in the following order: far, bottom, top, right, left, near. Hence, the far frustum plane is defined by values 0-3, the bottom plane is defined by values 4-7 and so on.
public virtual void RED::ISoftRayContext::GetReflectionColor(doubleoColor[4]) const = 0

Gets the color of the reflection ray.

Parameters:

oColorcolor of the reflection ray.
public virtual void RED::ISoftRayContext::GetReflectionDistance(double &oDistance) const = 0

Gets the distance to the reflected surface.

The distance is returned in model units. If no surface is reflected DBL_MAX is returned.

Parameters:

oDistancedistance to the reflected surface.
public virtual void RED::ISoftRayContext::GetRefractionColor(doubleoColor[4]) const = 0

Gets the color of the refraction ray.

Parameters:

oColorcolor of the refraction ray.
public virtual void RED::ISoftRayContext::GetRefractionDistance(double &oDistance) const = 0

Gets the distance to the refracted surface.

The distance is returned in model units. If no surface is refracted DBL_MAX is returned.

Parameters:

oDistancedistance to the refracted surface.
public virtual RED_RC RED::ISoftRayContext::GetShadowColor(doubleoShadowColor[4],
const RED::ISoftLight *iLight,
const RED::ISoftRenderingContext &iRenderCtx,
const double *iSamplePos = NULL,
intiSampleTID = 0,
booliForceTwoSided = false
)const = 0

Casts a shadow ray from the hit point toward another point.

The ray is cast along the specified path (from the light source position or iSamplePos to the current hit position) until it gets fully blocked by a shadow caster or until it reaches its destination. The result color is in 4d.

Parameters:

oShadowColor:the returned shadow color (4d color).
iLight:The light source data record.
iRenderCtx:Global scene rendering context.
iSamplePos:Optional position on the light source (if the light has an area).
iSampleTID:Optional ID of the source triangle.
iForceTwoSided:Set to true if the shadow calculations have to force all materials to be two sided.
public virtual int RED::ISoftRayContext::GetThreadID() const = 0

Returns:

the ID of the thread owning the ray context.
public virtual void RED::ISoftRayContext::GetWCSDifferentials(doubleoWCSdPdX[4],
doubleoWCSdPdY[4]
)const = 0

Returns the ray differentials in x and y.

Parameters:

oWCSdPdX:ray differential in x in world space (dP/dX).
oWCSdPdY:ray differential in y in world space (dP/dY).
public virtual void RED::ISoftRayContext::GetWCSHit(doubleoWCSHit[4]) const = 0

Gets the WCS hit point.

Converts the ray hit point in WCS and return it. The result vector is in 4d.

Parameters:

oWCSHit:The hit point in WCS (a four floats array).
public virtual void RED::ISoftRayContext::GetWCSIncoming(doubleoWCSIncoming[4]) const = 0

Returns the incoming vector.

This is the vector from the ray origin to the ray intersection in World Coordinate Space (WCS).

Parameters:

oWCSIncoming:The vector from the ray origin to the intersection. The vector is not normalized and in WCS (4 floats).
public virtual void RED::ISoftRayContext::GetWCSNormal(doubleoWCSNormal[4],
const RED::RenderCode &iRenderCode,
RED_VSH_INPUTiChannel = RED_VSH_NORMAL
)const = 0

Gets the WCS normal at the hit point.

Interpolates the 'iChannel' channel at the hit point coordinates and turns it in WCS using the hit instance matrix. The result vector is in 4d.

Parameters:

iRenderCode:The binding specification.
oWCSNormal:The WCS normal at the hit point (a four floats array).
iChannel:The channel to use to lookup the normal.
public virtual void RED::ISoftRayContext::GetWCSTangent(doubleoWCSTangent[4],
const RED::RenderCode &iRenderCode,
RED_VSH_INPUTiChannel = RED_VSH_COLOR
)const = 0

Gets the WCS tangent at the hit point.

Interpolates the 'iChannel' channel at the hit point coordinates and turns it in WCS using the hit instance matrix.

Parameters:

iRenderCode:The binding specification.
oWCSTangent:The WCS tangent at the hit point (4 floats array).
iChannel:The channel to use to lookup the tangent.
public virtual bool RED::ISoftRayContext::HasDifferentials() const = 0

Returns:

true if the ray has differentials, false otherwise.
public virtual void RED::ISoftRayContext::Interpolate(doubleoInterpolated[4],
const RED::RenderCode &iRenderCode,
RED_VSH_INPUTiChannel
)const = 0

Calculates interpolated mesh parameters at the current hit point.

This method may renormalize resulting interpolated values based on the 'iRenderCode' specification.

If we're shading a custom geometry, then we have no mesh and the geometrical data input is sourced from the shading callback in use (see the RED::SOFT_RAY_PROCESSING_SHADING_CALLBACK). In this case, any channel renormalization can't be done by the interpolate method and it must be done beforehand in the shading callback.

Parameters:

iRenderCode:The binding specification.
iChannel:The channel to interpolate.
oInterpolated:The interpolated value.
public virtual void RED::ISoftRayContext::Interpolate(doubleoInterpolated[4],
RED::MESH_CHANNELiMeshChannel
)const = 0

Calculates interpolated mesh parameters at the current hit point.

This method does not renormalize resulting interpolated values.

If we're shading a custom geometry, then we have no mesh and the geometrical data input is sourced from the shading callback in use (see the RED::SOFT_RAY_PROCESSING_SHADING_CALLBACK). In this case, any channel renormalization can't be done by the interpolate method and it must be done beforehand in the shading callback.

Parameters:

iMeshChannel:The mesh channel source to interpolate.
oInterpolated:The interpolated value.
public virtual bool RED::ISoftRayContext::IsComputingGI() const = 0

Are we in a global illumination calculation phase?

Returns:

true if the caller's thread is actually performing a GI calculation, false otherwise.
public virtual bool RED::ISoftRayContext::IsGICache() const = 0

Returns:

true if a GI cache is available, false otherwise.
public virtual bool RED::ISoftRayContext::IsGlossinessAnglesOnly() const = 0

Queries for the ray reflection shader to return glossiness values only.

If this method returns true, then the shader must return the glossiness angles to be used.

Returns:

true if the shader needs to retrive glossiness angles.
public virtual bool RED::ISoftRayContext::IsIOROnly() const = 0

Queries for the ray direction shader to return the IOR.

Calling this method disables the IOR only flag automatically.

Returns:

true if the shader can only return the IOR.
public virtual bool RED::ISoftRayContext::IsNoBumpNormalOnly() const = 0

Queries for normal direction composites to return a non bumpy normal only.

If this method returns true, then the next normal calculation must ignore any bump mapping contribution.

Calling this method disables the 'no bump normal' flag automatically.

Returns:

true if the shader needs to compute a non bumpy normal.
public virtual bool RED::ISoftRayContext::IsShadingNormalOnly() const = 0

Queries for the ray direction shader to return the shading normal.

The shading normal is the interpolated normal at the current intersection point after having applied bump or displacement transformations.

Calling this method disables the shading normal only flag automatically.

Returns:

true if the shader can only return the support vector.
public virtual bool RED::ISoftRayContext::IsTangentOnly() const = 0

Queries for normal direction composites to return a tangent vector.

If this method returns true, then the next normal calculation must return the tangent vector at the calculated point.

Calling this method disables the 'tangent only' flag automatically.

Returns:

true if the shader needs to compute a tangent vector instead of a normal.
public virtual RED_RC RED::ISoftRayContext::PrepareLights(const double *iPoint,
const double *iNormal,
booliIncludeBakedLights,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Prepares lights for the rendering at a given point in space by precomputing some values and discarding meaningless lights.

This call is mandatory before calling RED::ISoftRayContext::GetLights. It setups all lights, lighting parameters and culling functions needed to shade the point defined by 'iPoint' and 'iNormal'.

Parameters:

iPoint:Current point being shaded, WCS.
iNormal:Current normal at the shaded point (optional).
iIncludeBakedLights:If true, baked lights are returned in the list. If false, baked lights are discarded and won't appear in the list of lights.
iRenderContext:The rendering context.

Returns:

RED_OK if the operation has succeeded,
RED_ALLOC_FAILURE if a memory allocation has failed,
RED_FAIL otherwise.
public virtual double RED::ISoftRayContext::RandF() const = 0

Returns:

A random double in [0,1).
public virtual unsigned int RED::ISoftRayContext::RandI() const = 0

Returns:

A random unsigned integer in [0,2^32-1].
public virtual void RED::ISoftRayContext::SampleBackgroundImage(doubleoColor[4],
const doubleiE[4],
const doubleiP[4],
booliDirect,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Background image texture sampling.

See RED::IViewpointRenderList::SetBackgroundImages for the detail on all sampling configurations. The source pixel coordinates used to sample the 2D background image are directly sourced from RED::ISoftRayContext::GetPixelCoordinates, that are set on the ray launch.

Parameters:

oColor:Resulting texture color.
iE:Ray starting position.
iP:Ray ending position.
iDirect:If true, we consider the ray as a direct ray and we may use a screen space sampling if we have a 2D background image. If false, the cube image will be used.
iRenderContext:Rendering context.
public virtual void RED::ISoftRayContext::SampleFontGlyphTexture(doubleoColor[4],
RED_VSH_INPUTiUVChannel,
const RED::ISoftShaderContext &iShaderContext,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Samples a text glyph texture.

This method can be used to sample a text's font glyph texture. The current hit primitive must be a text using the RED::FNT_TEXTURE rendering mode.

Parameters:

oColor:The resulting color.
iUVChannel:Channel holding text string glyph UVs.
iShaderContext:The shader parameters with our source information.
iRenderContext:Global rendering context.
public virtual void RED::ISoftRayContext::SampleNormalMap(doubleoBumpNormalWCS[4],
doubleoNormalWCS[4],
doubleoTangentWCS[4],
intiTextureBind,
RED_VSH_INPUTiUVChannel,
RED_VSH_INPUTiNormalChannel,
RED_VSH_INPUTiTangentChannel,
intiUVMatrixBind,
const RED::ISoftShaderContext &iShaderContext,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Samples a normal map or a displacement map. Returns the WCS normal vector.

If there's no normal map texture or if there's no displacement map, the method will return the interpolated world space normal.

Parameters:

oBumpNormalWCS:The perturbed normal direction in world space.
oNormalWCS:The normal before perturbation in world space.
oTangentWCS:The tangent in world space.
iTextureBind:Normal map binding channel.
iUVChannel:RED::Rendercode channel bound for this texture.
iNormalChannel:RED::Rendercode channel for accessing vertex normals.
iTangentChannel:RED::Rendercode channel for accessing vertex tangents.
iUVMatrixBind:Binding position of the UV transform matrix.
iShaderContext:The shader parameters with our source information.
iRenderContext:Global rendering context.
public virtual void RED::ISoftRayContext::SampleTexture(doubleoColor[4],
const RED::Object *iTexture,
RED::MESH_CHANNELiUVChannel,
const RED::Matrix &iUVMatrix,
const RED::ISoftShaderContext &iShaderContext,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Samples a texture.

Parameters:

oColor:The resulting color.
iTexture:The texture to sample.
iUVChannel:RED::Rendercode channel bound for this texture.
iUVMatrix:Texture matrix.
iShaderContext:The shader parameters with our source information.
iRenderContext:Global rendering context.
public virtual void RED::ISoftRayContext::SampleTexture(doubleoColor[4],
intiTextureBind,
RED_VSH_INPUTiUVChannel,
intiUVMatrixBind,
const doubleiColor[4],
const RED::ISoftShaderContext &iShaderContext,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Samples a color or a texture.

If the texture is valid, the method will sample it using the provided interpolation channel. Otherwise, the color is returned. The method handles composite textures as well.

Parameters:

oColor:The color to use.
iColor:Color that is returned if we have no valid texture.
iTextureBind:Texture binding channel.
iUVChannel:RED::Rendercode channel bound for this texture.
iUVMatrixBind:Binding position of the UV transform matrix.
iShaderContext:The shader parameters with our source information.
iRenderContext:Global rendering context.
public virtual void RED::ISoftRayContext::SampleTexture(doubleoColor[4],
intiColorBind,
intiTextureBind,
RED_VSH_INPUTiUVChannel,
intiUVMatrixBind,
const RED::ISoftShaderContext &iShaderContext,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Samples a color or a texture.

If the texture is valid, the method will sample it using the provided interpolation channel. Otherwise, the color is returned. The method handles composite textures as well.

Parameters:

iColorBind:Color parameter binding position. If there's no valid binding position (<0), the method returns the black color.
iTextureBind:Texture binding channel.
iUVChannel:RED::Rendercode channel bound for this texture.
iUVMatrixBind:Binding position of the UV transform matrix.
iShaderContext:The shader parameters with our source information.
iRenderContext:Global rendering context.
oColor:The color to use.
public virtual void RED::ISoftRayContext::SampleTexture(doubleoColor[4],
intiColorBind,
intiTextureBind,
const doubleiUV[4],
const RED::Matrix &iUVMatrix,
const RED::ISoftShaderContext &iShaderContext,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Samples a color or a texture.

If the texture is valid, the method will sample it using the provided uv coordinates. Otherwise, the color is returned. The method handles composite textures as well.

Parameters:

oColor:The resulting color.
iColorBind:Color parameter binding position. If there's no valid binding position (<0), the method returns the black color.
iTextureBind:Texture binding channel.
iUV:UV coordinates of the texel.
iUVMatrix:UV transform matrix.
iShaderContext:The shader parameters with our source information.
iRenderContext:Global rendering context.
public virtual void RED::ISoftRayContext::SampleTexture(doubleoColor[4],
const RED::Object *iTexture,
const doubleiUV[4],
const RED::ISoftShaderContext &iShaderContext,
const RED::ISoftRenderingContext &iRenderContext
)const = 0

Samples a texture.

Parameters:

oColor:The resulting color.
iTexture:The texture to sample.
iUV:UV coordinates of the texel.
iShaderContext:The shader parameters with our source information.
iRenderContext:Global rendering context.