RixBxdfFactory Class Reference

RixBxdfFactory Class Referenceabstract
Inheritance diagram for RixBxdfFactory:
RixShadingPlugin

Public Types

enum  InstanceHints {
  k_TriviallyOpaque =0, k_ComputesOpacity =1, k_OpacityCanBeCached =2, k_ComputesPresence =4,
  k_PresenceCanBeCached =8, k_OpacityMask =0x0F, k_ComputesInterior =0x10, k_InteriorTransmission =0x20,
  k_InteriorHeterogeneous =0x40, k_InteriorOverlapping =0x80, k_InteriorMask =0xF0
}
 

Public Member Functions

virtual int GetInterface () const
 
virtual int Init (RixContext &ctx, char const *pluginPath)=0
 
virtual RixSCParamInfo const * GetParamTable ()=0
 
virtual void Finalize (RixContext &ctx)=0
 
virtual int GetInstanceHints (RtConstPointer) const
 
virtual RixBsdfBeginScatter (RixShadingContext const *, RixBXLobeTraits const &hints, RixSCShadingMode, RtConstPointer instancedata)=0
 
virtual void EndScatter (class RixBsdf *bsdf)=0
 
virtual RixOpacityBeginOpacity (RixShadingContext const *, RixSCShadingMode, RtConstPointer)
 usually called by RixBsdf::Release More...
 
virtual void EndOpacity (class RixOpacity *)
 
virtual class RixVolumeIntegratorBeginInterior (RixShadingContext const *, RixSCShadingMode, RtConstPointer)
 
virtual void EndInterior (RixVolumeIntegrator *)
 
- Public Member Functions inherited from RixShadingPlugin
virtual int GetVersion () const
 
virtual void Synchronize (RixContext &, RixSCSyncMsg, RixParameterList const *)
 
virtual int CreateInstanceData (RixContext &, char const *, RixParameterList const *, InstanceData *)
 

Additional Inherited Members

- Protected Member Functions inherited from RixShadingPlugin
 RixShadingPlugin (int version)
 
- Protected Attributes inherited from RixShadingPlugin
int m_version
 

Member Enumeration Documentation

Most Bxdfs do not require special opacity handling or support interior shading. These Bxdfs should just inherit the default implementation of GetInstanceHints, which indicates the Bxdf is trivially opaque. Bxdfs that do modulate opacity and/or require interior shading are required to override the GetInstanceHints method and return InstanceHints to the renderer in order to trigger calls to BeginOpacity and BeginInterior. Values are in the form of a bitfield for compact representation and evaluation.

As a further optimization, Bxdfs that deal with opacity or interiors may choose to change their behavior based upon their instance parameters. For example, they may opt out of opacity entirely if they can prove via inspection of the parameters that the intended result is equivalent to opaque. Bxdfs that choose to do so should "bake" this awareness into their instance data at the time of CreateInstanceData and inspect this instance data within the GetInstanceHints implementation.

Note that at the time of CreateInstanceData, Bxdfs are unable to inspect the values of pattern network inputs, therefore in cases with such inputs (i.e: RixParameterList::GetParamInfo returns k_RixSCNetworkValue) the Bxdf may have no choice but to defer inspection of the inputs until BeginOpacity or BeginInterior. At that time, the Bxdf may then choose to return NULL instead.

Enumerator
k_OpacityCanBeCached 

returns RixOpacity for opacity

k_ComputesPresence 

do not set unless k_ComputesOpacity is set

k_PresenceCanBeCached 

returns RixOpacity for presence

k_OpacityMask 

do not set unless k_ComputesPresence is set

k_InteriorTransmission 

has interior integration requirements.

k_InteriorHeterogeneous 

supports transmission

k_InteriorOverlapping 

requires volume, not surface, primvars

k_InteriorMask 

supports overlapping of interiors

Member Function Documentation

virtual class RixVolumeIntegrator* RixBxdfFactory::BeginInterior ( RixShadingContext const *  ,
RixSCShadingMode  ,
RtConstPointer   
)
inlinevirtual

BeginInterior creates a RixVolumeIntegrator for the current shading context. BeginInterior will only be called by the renderer if GetInstanceHints returns k_ComputesInterior.

A non-NULL result indicates that for the specified shading mode, the Bxdf desires to express non-trivial volume behavior for the presumed volume interior region associated with the bound surface. A NULL result (as returned by the default implementation) supports the common case where a material has no special volume integrator. As an optimization, a Bxdf might choose to return NULL if inspection of the inputs proves that the volume is provably non-existent everywhere (even across all varying inputs).

BeginInterior may be called with one of two shading modes:

k_RixSCVolumeTransmissionQuery: this is a hint that only the GetTransmission method will be called on the RixVolumeIntegrator object created. Bxdf implementations may use this as a hint that any pattern inputs not required by the RixVolumeIntegrator::GetTransmission method can be skipped.

k_RixSCScatterQuery: this is a hint that that only the GetNearestHits method will be called on the RixVolumeIntegrator object created. Bxdf implementations should evaluate any pattern inputs relevant to the RixVolumeIntegrator::GetNearestHits method.

virtual RixOpacity* RixBxdfFactory::BeginOpacity ( RixShadingContext const *  ,
RixSCShadingMode  ,
RtConstPointer   
)
inlinevirtual

usually called by RixBsdf::Release

BeginOpacity creates a RixOpacity for the current shading context. BeginOpacity will not be called by the renderer unless GetInstanceHints returns k_ComputesOpacity or k_ComputesPresence.

A non-NULL result indicates that for the Bxdf wishes to implement non-trivial opacity behavior, where a NULL result (as returned by the default implementation) implies that the material is fully present and fully opaque. As an optimization, a Bxdf may also choose to return NULL if inspection of the inputs proves that the surface is provably opaque everywhere (even across all varying inputs). For more details on opacity, refer to RixOpacity class comments.

BeginOpacity may be called with one of two shading modes:

k_RixSCPresenceQuery: this is a hint that only the GetPresence method will be called on the RixOpacity object created. Bxdf implementations may use this as a hint that any pattern inputs not required by the RixOpacity::GetPresence method can be skipped.

k_RixSCOpacityQuery: this is a hint that both the GetPresence or GetOpacity methods will be called on the RixOpacity object created. Bxdf implementations should evaluate all pattern inputs relevant to both GetPresence and GetOpacity in this shading mode.

virtual RixBsdf* RixBxdfFactory::BeginScatter ( RixShadingContext const *  ,
RixBXLobeTraits const &  hints,
RixSCShadingMode  ,
RtConstPointer  instancedata 
)
pure virtual

BeginScatter is expected to return a RixBsdf for the current ShadingContext. The shading mode allows the factory to construct different Bsdfs for different scattering regimes (currently: surface vs volume interior). In constructing a bsdf, the factory plugin typically "samples" its bsdf input parameters via EvalParam method calls on the ShadingContext. A single factory plugin can have several RixBsdf 'sessions' opened simultaneously and in different threads. Caller of BeginScatter is expected to call RixBsdf's Release method which, in turn, should call RixBxdfFactory::EndScatter. RixBxdfFactory's subclasses should use 'placement new' atop RixShadingContext::Allocated memory for best performance.

BeginScatter may be called with one of two shading modes:

k_RixSCScatterQuery: the factory should construct a Bsdf for scattering on the surface.

k_RixSCVolumeScatterQuery: the factory should construct a Bsdf (typically a phase function) for scattering on the inside of a volume. This mode will only be used if the Bxdf also implements an interior integrator.

virtual int RixBxdfFactory::Init ( RixContext &  ctx,
char const *  pluginPath 
)
pure virtual

Per-plugin-instance scope is enclosed in Init/Finalize block. Plugin can report errors during init and return non-zero status.

Implements RixShadingPlugin.


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