RixVolumeIntegrator Class Reference

RixVolumeIntegrator Class Referenceabstract

#include <RixBxdf.h>

Inheritance diagram for RixVolumeIntegrator:
RixSSDiffusion

Classes

class  IntegratorDelegate
 

Public Types

enum  VolumeProperty { k_DensityType, k_DensityFloat, k_DensityColor, k_MaxDensity }
 

Public Member Functions

 RixVolumeIntegrator (RixShadingContext const *sCtx, RixBxdfFactory *f)
 
RixShadingContext const * GetShadingCtx ()
 
void SetShadingCtx (const RixShadingContext *ctx)
 
RixBxdfFactoryGetBxdfFactory ()
 
virtual void SetParameters (void const *subclassParams)
 
virtual void Release ()
 
virtual RixSCDetail GetProperty (VolumeProperty, void const **) const
 
virtual void GetNearestHits (RtInt numRays, RtRayGeometry const *rays, RixRNG *rng, RixBXLobeTraits const &lobesWanted, RixIntegratorContext &iCtx, RixLightingServices *lightingServices, IntegratorDelegate *lcb, RtInt *numGrps, RixShadingContext const **shadeGrps, char const *subset=NULL, bool isLightPath=false, RtHitSides hitSides=k_SidesBoth, bool isPrimary=false)=0
 
virtual void GetTransmission (RtInt, RtRayGeometry const *, RixRNG *, RixIntegratorContext &iCtx, RtColorRGB *, char const *=NULL)
 
virtual void GetNearestHitsAndPdfs (RtInt numRays, RtRayGeometry const *rays, RixRNG *rng, RixBXLobeTraits const &lobesWanted, RixIntegratorContext &iCtx, bool, bool, bool *, RtInt *numGrps, RixShadingContext const **shadeGrps, RtFloat *forwardPdf, RtFloat *reversePdf, RtFloat *crossPdf, RtFloat *forwardBoundaryPdf, RtFloat *reverseBoundaryPdf, RtColorRGB *densityCoefficient)
 
virtual void GetTransmissionAndPdfs (RtInt numRays, RtRayGeometry const *rays, RixRNG *rng, RixIntegratorContext &iCtx, RixBXRayFlags const *, RtColorRGB *trans, RtFloat *forwardPdf, RtFloat *reversePdf, RtFloat *crossPdf, RtColorRGB *=NULL)
 
virtual RixBsdfCreateBSDF (RixShadingContext const *, RixShadingContext::Allocator &)
 
virtual bool IsMultiScatter () const
 Is volume multi-scattering? – needed by upbp.
 

Protected Attributes

RixShadingContext const * shadingCtx
 
RixBxdfFactorybxdfFactory
 
void const * params
 

Detailed Description

RixVolumeIntegrators can be obtained from the BxdfFactory at the hit point where a ray enters an interior region. A VolumeIntegrator can be seen as a delegate for the real IntegratorCtx that implements special behavior behind the GetNearestHits and GetTransmission methods. The idea is that the integration complexity in a volume region can be hidden from the outside world by reducing more complex light-paths into a single measurement of energy throughput, transmission, coupled with potentially distinct shading contexts to capture light transfer into the volume region. VolumeIntegrators can either be built-in or compiled-in to a bxdf. In the former case, a reference to an instance of a VolumeIntegrator should be obtained from the RixShadingContext. To support pre-constructed builtin VolumeIntegrators we offer a generic method to pass instance parameters to the integrator. Typically builtin VolumeIntegrators define a struct comprised of the parameters it requires from the enclosing bxdf factory. The memory for (and evaluation of) the parameters is the responsibility of the enclosing bxdf. This extra dance is required to diminish the likelihood of disruption caused by the addition of new parameters by plugin/builtin volume integrators. In the direct-linked case clients can bypass the SetParameters convenience routines in favor of direct constructor.

Member Enumeration Documentation

Volumes can be queried for general material properties to facilitate integration tasks. Volumes should return k_RixSCInvalidDetail if a particular property is unsupported. If a property is supported the volume should return k_RixSCUniform or k_RixSCVarying according to the detail of the result.

Enumerator
k_DensityFloat 

RtInt - value should be one of k_DensityFloat/k_DensityColor.

k_DensityColor 

RtFloat.

k_MaxDensity 

RtColorRGB.

Member Function Documentation

virtual RixBsdf* RixVolumeIntegrator::CreateBSDF ( RixShadingContext const *  ,
RixShadingContext::Allocator  
)
inlinevirtual

Allocate bsdf for given context Needed for upbp. TO DO: DELETE THIS – DO THIS A DIFFERENT WAY, for example using bxdfFactory->BeginScatter() !!

virtual void RixVolumeIntegrator::GetNearestHits ( RtInt  numRays,
RtRayGeometry const *  rays,
RixRNG *  rng,
RixBXLobeTraits const &  lobesWanted,
RixIntegratorContext &  iCtx,
RixLightingServices *  lightingServices,
IntegratorDelegate lcb,
RtInt *  numGrps,
RixShadingContext const **  shadeGrps,
char const *  subset = NULL,
bool  isLightPath = false,
RtHitSides  hitSides = k_SidesBoth,
bool  isPrimary = false 
)
pure virtual
Parameters
lcbresults: (per-ray transmission deposited on resulting ShadingContexts' transmission field). Inscattered radiance can be splatted directly to the screen.
subsetoptional inputs:
virtual void RixVolumeIntegrator::GetNearestHitsAndPdfs ( RtInt  numRays,
RtRayGeometry const *  rays,
RixRNG *  rng,
RixBXLobeTraits const &  lobesWanted,
RixIntegratorContext &  iCtx,
bool  ,
bool  ,
bool *  ,
RtInt *  numGrps,
RixShadingContext const **  shadeGrps,
RtFloat *  forwardPdf,
RtFloat *  reversePdf,
RtFloat *  crossPdf,
RtFloat *  forwardBoundaryPdf,
RtFloat *  reverseBoundaryPdf,
RtColorRGB *  densityCoefficient 
)
inlinevirtual

We provide a default implementation of the following methods, since they are only useful in some volume integrators Samples volume and returns corresponding shading groups. The first returned group corresponds to volume shading group (it is required by UPBP integrator !!!) insideVolume indicates whether rays start from inside volume. If generateLongBeams is set to true, it will return for each ray both boundary hit and if value-scattering occured also its scattered hit. scatterRay can be used to set for each ray whether it can scatter in volume. For each ray it also returns several probabilities: 1)forwardPdf - pdf of sampling distance from ray origin to scatter pos. 2)reversePdf - pdf of sampling distance from scatter pos. to ray origin forwardPdf and reversePdf will differ if either ray origin or scatter position lies on surface or volume boundary 3)crossPdf - pdf of sampling any distance greater than the sampled one 4)forwardBoundaryPdf - pdf of sampling dist. from ray origin to boundary 5)reverseBoundaryPdf - pdf of sampling dist. from boundary to ray origin forwardBoundaryPdf and reverseBoundaryPdf will differ if ray origin lies on surface or volume boundary. densityCoefficient is also returned for every scatter position. Transmission returned via shading context does not include density coefficient at scattering position (unlike in the other GetNearestHits method).

Parameters
numGrpsOutput
virtual RixSCDetail RixVolumeIntegrator::GetProperty ( VolumeProperty  ,
void const **   
) const
inlinevirtual

Note: currently we offer a default implementation. We may choose to enforce implementing this in the future so we encourage you to implement this method.

virtual void RixVolumeIntegrator::GetTransmission ( RtInt  ,
RtRayGeometry const *  ,
RixRNG *  ,
RixIntegratorContext &  iCtx,
RtColorRGB *  ,
char const *  = NULL 
)
inlinevirtual

We provide a default implementation of GetTransmission because some volume integrators may be opaque to transmission rays. This occurs when the only supported light transport mode is indirect. In this case, the volume integrator's associated bxdffactory may select to return a NULL volume integrator for transmission queries.

virtual void RixVolumeIntegrator::GetTransmissionAndPdfs ( RtInt  numRays,
RtRayGeometry const *  rays,
RixRNG *  rng,
RixIntegratorContext &  iCtx,
RixBXRayFlags const *  ,
RtColorRGB *  trans,
RtFloat *  forwardPdf,
RtFloat *  reversePdf,
RtFloat *  crossPdf,
RtColorRGB *  = NULL 
)
inlinevirtual

For each ray it returns transmission and several probabilities: 1)forwardPdf - pdf of sampling distance from ray origin to scatter pos. 2)reversePdf - pdf of sampling distance from scatter pos. to ray origin forwardPdf and reversePdf will differ if either ray origin or scatter position lies on surface or volume boundary 3)crossPdf - pdf of sampling any distance greater than the sampled one densityCoefficient at ray end is optionally returned.

Parameters
transOutput

The documentation for this class was generated from the following file: