class RED::VolumetricEffectLightVolume

This class defines light volume volumetric effects in a scene. More...

#include <REDVolumetricEffectLightVolume.h>

Inherits: VolumetricEffect.

Public functions:

VolumetricEffectLightVolume ( )
virtual ~VolumetricEffectLightVolume ( )
virtual void *As ( const RED::CID & iCID )
virtual const void *As ( const RED::CID & iCID ) const
template< class T_As > const T_As *As ( ) const
template< class T_As > T_As *As ( )
virtual doubleGetDensity ( const double iPosition[3] ) const
virtual voidGetEmission ( double oEmission[3], const double iPosition[3] ) const
virtual voidGetPhase ( double oPhase[3], const double iPosition[3], const double iDirection1[3], const double iDirection2[3] ) const
virtual voidGetSigmaA ( double oSigmaA[3], const double iPosition[3] ) const
virtual voidGetSigmaSIn ( double oSigmaS[3], const double iPosition[3] ) const
virtual voidGetSigmaSOut ( double oSigmaS[3], const double iPosition[3] ) const
virtual RED_RCGetVolumeIntervals ( RED::Vector< double > & oIntervals, const double iE[3], const double iP[3], const RED::ISoftRenderingContext & iRenderCtx ) const
IMPLEMENT_CHUNKINTERPRETER ( )
virtual boolIsHomogeneous ( ) const
virtual RED_RCSave ( RED::IStream * iStream, RED::StreamingPolicy & iPolicy, int iState = -1 ) const
voidSetEmission ( const double iEmission[3] )
voidSetEmission ( const RED::Vector3 & iEmission )
voidSetSigmaA ( const RED::Vector3 & iSigmaA )
voidSetSigmaA ( const double iSigmaA[3] )
voidSetSigmaS ( const double iSigmaS[3] )
voidSetSigmaS ( const RED::Vector3 & iSigmaS )
voidSetSigmaSIn ( const double iSigmaS[3] )
voidSetSigmaSIn ( const RED::Vector3 & iSigmaS )
voidSetSigmaSOut ( const double iSigmaS[3] )
voidSetSigmaSOut ( const RED::Vector3 & iSigmaS )

Public static functions:

static RED::CIDGetClassID ( )

Protected variables:

double_emission [3]
double_sigma_a [3]
double_sigma_s_in [3]
double_sigma_s_out [3]

Detailed description:

This class defines light volume volumetric effects in a scene.

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

Using this volumetric effect creates an homogeneous medium contained inside each light volume in the scene.

It works with all the lights which define a volume:

The definition of volume by light for this effect can be independently enabled or disabled by setting the RED::RM_DEFINE_VOLUME render mode. By default, all compatible lights define volume.

It does not add the medium under infinite lights like ambient lights, directionnal lights, area lights, sun and sky lights.

By default, this class defines the following medium properties:

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

Here are some examples of the same scene rendered with different sigma coefficients and with global illumination activated. Volume rendering is taken into account in the global illumination thanks to the option RED::OPTIONS_RAY_GI_ENABLE_VOLUME. The scene is a room of size 300cm x 400cm x 250cm containing a sphere of radius 30cm and a spot light of intensity 20. The model unit is centimeter. Hence, the sigma coefficients vary from 0 to 0.01m-1.

In order to be physically correct, the sigma s coefficient is the same for in and out-scattering.

Changing sigma properties

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

Functions documentation

Construction method.

This volumetric effect implements the light volume.

Destruction method.

public virtual void * RED::VolumetricEffectLightVolume::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.

Reimplements: RED::VolumetricEffect::As.

public virtual const void * RED::VolumetricEffectLightVolume::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.

Reimplements: RED::VolumetricEffect::As.

template< class T_As > public const T_As * RED::VolumetricEffectLightVolume::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::VolumetricEffect::As.

template< class T_As > public T_As * RED::VolumetricEffectLightVolume::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::VolumetricEffect::As.

public virtual double RED::VolumetricEffectLightVolume::GetDensity(const doubleiPosition[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.

Implements: RED::VolumetricEffect::GetDensity.

public virtual void RED::VolumetricEffectLightVolume::GetEmission(doubleoEmission[3],
const doubleiPosition[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.

Implements: RED::VolumetricEffect::GetEmission.

public virtual void RED::VolumetricEffectLightVolume::GetPhase(doubleoPhase[3],
const doubleiPosition[3],
const doubleiDirection1[3],
const doubleiDirection2[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.

Implements: RED::VolumetricEffect::GetPhase.

public virtual void RED::VolumetricEffectLightVolume::GetSigmaA(doubleoSigmaA[3],
const doubleiPosition[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.

Implements: RED::VolumetricEffect::GetSigmaA.

public virtual void RED::VolumetricEffectLightVolume::GetSigmaSIn(doubleoSigmaS[3],
const doubleiPosition[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.

Implements: RED::VolumetricEffect::GetSigmaSIn.

public virtual void RED::VolumetricEffectLightVolume::GetSigmaSOut(doubleoSigmaS[3],
const doubleiPosition[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.

Implements: RED::VolumetricEffect::GetSigmaSOut.

public virtual RED_RC RED::VolumetricEffectLightVolume::GetVolumeIntervals(RED::Vector< double > &oIntervals,
const doubleiE[3],
const doubleiP[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.

Implements: RED::VolumetricEffect::GetVolumeIntervals.

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.

Implements: RED::VolumetricEffect::IsHomogeneous.

public virtual RED_RC RED::VolumetricEffectLightVolume::Save(RED::IStream *iStream,
RED::StreamingPolicy &iPolicy,
intiState = -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.

Implements: RED::IChunkSaver::Save.

public void RED::VolumetricEffectLightVolume::SetEmission(const doubleiEmission[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.

Sets the emission coefficient.

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

Parameters:

iEmission:emission coefficient.

Sets the absorption coefficient.

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

Parameters:

iSigmaA:absorption coefficient.
public void RED::VolumetricEffectLightVolume::SetSigmaA(const doubleiSigmaA[3])

Sets the absorption coefficient.

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

Parameters:

iSigmaA:absorption coefficient.
public void RED::VolumetricEffectLightVolume::SetSigmaS(const doubleiSigmaS[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.

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.
public void RED::VolumetricEffectLightVolume::SetSigmaSIn(const doubleiSigmaS[3])

Sets the scattering coefficient.

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

Parameters:

iSigmaS:scattering coefficient.

Sets the scattering coefficient.

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

Parameters:

iSigmaS:scattering coefficient.
public void RED::VolumetricEffectLightVolume::SetSigmaSOut(const doubleiSigmaS[3])

Sets the scattering coefficient.

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

Parameters:

iSigmaS:scattering coefficient.

Sets the scattering coefficient.

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

Parameters:

iSigmaS:scattering coefficient.

Variables documentation

Emission coefficient.

Absorption coefficient.

In-scattering coefficient.

Out-scattering coefficient.