VolumetricEffectBoxVolume

Functions

CID

GetClassID

unsigned int

GetChunkSignature

RED_RC

Interpret

void *

As

const void *

As

class T_As

As

class T_As

As

VolumetricEffectBoxVolume

~VolumetricEffectBoxVolume

bool

IsHomogeneous

void

GetSigmaA

void

GetSigmaSIn

void

GetSigmaSOut

void

SetSigmaA

void

SetSigmaA

void

SetSigmaSIn

void

SetSigmaSIn

void

SetSigmaSOut

void

SetSigmaSOut

void

SetSigmaS

void

SetSigmaS

void

GetEmission

void

SetEmission

void

SetEmission

void

SetBox

void

SetBox

void

GetBox

double

GetDensity

void

GetPhase

RED_RC

GetVolumeIntervals

RED_RC

Save

Detailed Description

class VolumetricEffectBoxVolume : public RED::VolumetricEffect

This class defines box volume volumetric effects in a scene.

@related Volumetric Effects, Rendering Volumetric Effects, class RED::IVolumeShape

Stores all the parameters defining a box volumetric effect. See RED::VolumetricEffect for all the parameters details.

Using this volumetric effect creates an homogeneous medium contained inside an axis aligned box in the scene.

By default, this class defines the following medium properties:

  • Homogeneous medium

  • Sigma a = 0

  • Sigma s = 0

  • Isotropic phase function

  • Density = 1

By default, the box is of size 1 and is centered on the scene origin.

In order to see the volumetric effect inside the scene, make sure the correct sigma coefficients are set with RED::VolumetricEffectBoxVolume::SetSigmaA, RED::VolumetricEffectBoxVolume::SetSigmaSIn and RED::VolumetricEffectBoxVolume::SetSigmaSOut.

To activate the rendering of volumetric effects in a scene, the RED::OPTIONS_RAY_VOLUME option must be set to 1 at least.

Public Functions

virtual void *As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters

iCID – Requested class.

Returns

An object pointer of the given class on success, NULL otherwise.

virtual const void *As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters

iCID – Requested class.

Returns

An object pointer of the given class on success, NULL otherwise.

template<class T_As>
inline T_As *As()
template<class T_As>
inline const T_As *As() const
VolumetricEffectBoxVolume()

Construction method.

This volumetric effect implements the box volume.

virtual ~VolumetricEffectBoxVolume()

Destruction method.

virtual bool IsHomogeneous() const

Indicates if the medium is homogeneous.

This method returns true is the medium has the same properties (sigma, density and phase function) for all positions inside its volume.

Returns

True if the medium is homogeneous.

virtual void GetSigmaA(double oSigmaA[3], const double iPosition[3]) const

Returns the absorption coefficient at a given position.

See RED::VolumetricEffect::GetSigmaA to have details about this coefficient.

Parameters
  • oSigmaA – returned absorption coefficient at the volume position.

  • iPosition – position in the volume.

virtual void GetSigmaSIn(double oSigmaS[3], const double iPosition[3]) const

Returns the scattering coefficient at a given position.

See RED::VolumetricEffect::GetSigmaSIn to have details about this coefficient.

Parameters
  • oSigmaS – returned scattering coefficient at the volume position.

  • iPosition – position in the volume.

virtual void GetSigmaSOut(double oSigmaS[3], const double iPosition[3]) const

Returns the scattering coefficient at a given position.

See RED::VolumetricEffect::GetSigmaSOut to have details about this coefficient.

Parameters
  • oSigmaS – returned scattering coefficient at the volume position.

  • iPosition – position in the volume.

void SetSigmaA(const RED::Vector3 &iSigmaA)

Sets the absorption coefficient.

See RED::VolumetricEffect::GetSigmaA to have details about this coefficient.

Parameters

iSigmaA – absorption coefficient.

void SetSigmaA(const double iSigmaA[3])

Sets the absorption coefficient.

See RED::VolumetricEffect::GetSigmaA to have details about this coefficient.

Parameters

iSigmaA – absorption coefficient.

void SetSigmaSIn(const RED::Vector3 &iSigmaS)

Sets the scattering coefficient.

See RED::VolumetricEffect::GetSigmaSIn to have details about this coefficient.

Parameters

iSigmaS – scattering coefficient.

void SetSigmaSIn(const double iSigmaS[3])

Sets the scattering coefficient.

See RED::VolumetricEffect::GetSigmaSIn to have details about this coefficient.

Parameters

iSigmaS – scattering coefficient.

void SetSigmaSOut(const RED::Vector3 &iSigmaS)

Sets the scattering coefficient.

See RED::VolumetricEffect::GetSigmaSOut to have details about this coefficient.

Parameters

iSigmaS – scattering coefficient.

void SetSigmaSOut(const double iSigmaS[3])

Sets the scattering coefficient.

See RED::VolumetricEffect::GetSigmaSOut to have details about this coefficient.

Parameters

iSigmaS – scattering coefficient.

void SetSigmaS(const RED::Vector3 &iSigmaS)

Sets the scattering coefficients.

This function set the in-scattering and out-scattering coefficients. Both coefficients are set to iSigmaS. See RED::VolumetricEffect::GetSigmaSIn and RED::VolumetricEffect::GetSigmaSOut to have details about these coefficients.

Parameters

iSigmaS – scattering coefficient.

void SetSigmaS(const double iSigmaS[3])

Sets the scattering coefficients.

This function set the in-scattering and out-scattering coefficients. Both coefficients are set to iSigmaS. See RED::VolumetricEffect::GetSigmaSIn and RED::VolumetricEffect::GetSigmaSOut to have details about these coefficients.

Parameters

iSigmaS – scattering coefficient.

virtual void GetEmission(double oEmission[3], const double iPosition[3]) const

Returns the emission coefficient at a given position.

Emission is the property of the medium to emit light.

This coefficient can take any value greater than 0 and don’t have an upper limit. It can be different for each color channel.

Parameters
  • oEmission – returned emission coefficient at the volume position.

  • iPosition – position in the volume.

void SetEmission(const RED::Vector3 &iEmission)

Sets the emission coefficient.

This function set the emission coefficient. See RED::VolumetricEffect::GetEmission to have details about this coefficient.

Parameters

iEmission – emission coefficient.

void SetEmission(const double iEmission[3])

Sets the emission coefficient.

This function set the emission coefficient. See RED::VolumetricEffect::GetEmission to have details about this coefficient.

Parameters

iEmission – emission coefficient.

void SetBox(const double iMin[3], const double iMax[3])

Sets the box defining the volume.

Parameters
  • iMin – minimum box point.

  • iMax – maximum box point.

void SetBox(const RED::Vector3 &iMin, const RED::Vector3 &iMax)

Sets the box defining the volume.

Parameters
  • iMin – minimum box point.

  • iMax – maximum box point.

void GetBox(double oMin[3], double oMax[3]) const

Gets the box defining the volume.

Parameters
  • oMin – minimum box point.

  • oMax – maximum box point.

virtual double GetDensity(const double iPosition[3]) const

Returns the volume density at a given position.

See RED::VolumetricEffect::GetDensity to have details about the density.

Parameters

iPosition – position in the volume.

Returns

the volume density at a given position in the volume.

virtual void GetPhase(double oPhase[3], const double iPosition[3], const double iDirection1[3], const double iDirection2[3]) const

Returns the phase at a given position.

See RED::VolumetricEffect::GetPhase to have details about the phase.

Parameters
  • oPhase – returned phase value at the given position.

  • iPosition – position in the volume.

  • iDirection1 – first direction.

  • iDirection2 – second direction.

virtual RED_RC GetVolumeIntervals(RED::Vector<double> &oIntervals, const double iE[3], const double iP[3], const RED::ISoftRenderingContext &iRenderCtx) const

Returns the intervals of a ray intersecting the volume.

Given a ray, this method returns the parametric intervals along this ray where it intersects the volume.

The returned intervals are contained in a RED::Vector as a series of in and out parametric distances from the ray starting point: [in_1, out_1, in_2, out_2, …, in_n, out_n]. Therefore, the returned array is always of size 2n.

The returned intervals do not intersect each other and are not sorted in any way.

The method clears the intervals RED:Vector before filling it.

Parameters
  • oIntervals – returned intervals.

  • iE – ray starting point.

  • iP – ray end point.

  • iRenderCtx – Rendering context.

Returns

RED_OK if the operation has succeded.

RED_FAIL otherwise.

virtual RED_RC Save(RED::IStream *iStream, RED::StreamingPolicy &iPolicy, int iState = -1) const

Saves the object content as one or more chunks in the given stream.

Parameters
  • iStream – Pointer to the stream where the data must be saved.

  • iPolicy – Reference to the streaming policy to be used.

  • iState – Optional state number parameter at which the data to be saved must be retrieved. Default is set to 0 (for current state).

Returns

RED_OK on success,

RED_FILE_WRITE_ERROR on a file write error (if iStream is a file stream),

RED_ALLOC_FAILURE on a memory allocation error,

RED_FAIL otherwise.

Public Static Functions

static inline RED::CID GetClassID()
static inline unsigned int GetChunkSignature()
static RED_RC Interpret(RED::IReferenceManager *iReferenceManager, RED::IStream *iStream, const RED::StreamingPolicy &iPolicy, unsigned int iChunkSignature, RED::uint64 iChunkSize, RED::Object **oResult, const RED::State &iState)