RenderMan API  23.0
RixBxdfFactory Class Referenceabstract

#include <RixBxdf.h>

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, k_ComputesSubsurface = 0x100,
  k_ComputesOpacityForAllRays = 0x200, k_BlocksVolumes = 0x400, k_ComputesPostLighting = 0x800
}
 
- Public Types inherited from RixShadingPlugin
enum  SynchronizeHints { k_None = 0x00000000, k_All = 0xFFFFFFFF }
 

Public Member Functions

virtual int GetInterface () const override
 
virtual int GetInstanceHints (RtPointer instanceData) const =0
 
virtual void RegisterTemporalVolumeParams (RtPointer instanceData, std::vector< int > &paramId) const =0
 
virtual RixBxdfBeginScatter (RixShadingContext const *, RixBXLobeTraits const &hints, RixSCShadingMode, RtPointer instanceData)=0
 
virtual void EndScatter (class RixBxdf *bxdf)=0
 
virtual RixOpacityBeginOpacity (RixShadingContext const *, RixSCShadingMode, RtPointer instanceData)=0
 
virtual void EndOpacity (class RixOpacity *)=0
 
virtual class RixVolumeIntegratorBeginInterior (RixShadingContext const *, RixSCShadingMode, RtPointer instanceData)=0
 
virtual void EndInterior (RixVolumeIntegrator *)=0
 
virtual class RixVolumeIntegratorBeginSubsurface (RixShadingContext const *, RixSCShadingMode, RtPointer instanceData)=0
 
virtual void EndSubsurface (RixVolumeIntegrator *)=0
 
virtual float GetIndexOfRefraction (RtPointer instanceData) const =0
 
virtual RixPostLightingBeginPostLighting (RixShadingContext const *, RixSCShadingMode, RtPointer instanceData)
 
virtual void EndPostLighting (class RixPostLighting *)
 
- Public Member Functions inherited from RixShadingPlugin
virtual int GetVersion () const
 
virtual int Init (RixContext &ctx, RtUString const pluginPath)=0
 
virtual void Finalize (RixContext &ctx)=0
 
virtual RixSCParamInfo const * GetParamTable ()=0
 
virtual void Synchronize (RixContext &ctx, RixSCSyncMsg syncMsg, RixParameterList const *syncParams)=0
 
virtual void CreateInstanceData (RixContext &rixCtx, RtUString const handle, RixParameterList const *parameterList, InstanceData *instanceData)
 
virtual void SynchronizeInstanceData (RixContext &rixCtx, RtUString const handle, RixParameterList const *instanceParams, uint32_t const editHints, InstanceData *instanceData)
 

Protected Member Functions

 RixBxdfFactory ()
 
virtual ~RixBxdfFactory ()
 
- Protected Member Functions inherited from RixShadingPlugin
 RixShadingPlugin (int version)
 
virtual ~RixShadingPlugin ()
 

Additional Inherited Members

- Protected Attributes inherited from RixShadingPlugin
int m_version
 

Detailed Description

Definition at line 264 of file RixBxdf.h.

Member Enumeration Documentation

◆ InstanceHints

Most Bxdfs do not require special opacity handling or support interior shading. These Bxdfs should implement a trivial implementation of GetInstanceHints which simply returns k_TriviallyOpaque. 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_TriviallyOpaque 
k_ComputesOpacity 
k_OpacityCanBeCached 
k_ComputesPresence 
k_PresenceCanBeCached 
k_OpacityMask 
k_ComputesInterior 
k_InteriorTransmission 
k_InteriorHeterogeneous 
k_InteriorOverlapping 
k_InteriorMask 
k_ComputesSubsurface 
k_ComputesOpacityForAllRays 
k_BlocksVolumes 
k_ComputesPostLighting 

Definition at line 298 of file RixBxdf.h.

Constructor & Destructor Documentation

◆ RixBxdfFactory()

RixBxdfFactory::RixBxdfFactory ( )
inlineprotected

Definition at line 485 of file RixBxdf.h.

◆ ~RixBxdfFactory()

virtual RixBxdfFactory::~RixBxdfFactory ( )
inlineprotectedvirtual

Definition at line 487 of file RixBxdf.h.

Member Function Documentation

◆ BeginInterior()

virtual class RixVolumeIntegrator* RixBxdfFactory::BeginInterior ( RixShadingContext const *  ,
RixSCShadingMode  ,
RtPointer  instanceData 
)
pure virtual

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 should be returned by a trivial 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.

◆ BeginOpacity()

virtual RixOpacity* RixBxdfFactory::BeginOpacity ( RixShadingContext const *  ,
RixSCShadingMode  ,
RtPointer  instanceData 
)
pure virtual

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 should be returned by a trivial 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.

◆ BeginPostLighting()

virtual RixPostLighting* RixBxdfFactory::BeginPostLighting ( RixShadingContext const *  ,
RixSCShadingMode  ,
RtPointer  instanceData 
)
inlinevirtual

Definition at line 473 of file RixBxdf.h.

◆ BeginScatter()

virtual RixBxdf* RixBxdfFactory::BeginScatter ( RixShadingContext const *  ,
RixBXLobeTraits const &  hints,
RixSCShadingMode  ,
RtPointer  instanceData 
)
pure virtual

BeginScatter is expected to return a RixBxdf for the current ShadingContext. The shading mode allows the factory to construct different Bxdfs for different scattering regimes (currently: surface vs volume interior). In constructing a bxdf, the factory plugin typically "samples" its bxdf input parameters via EvalParam method calls on the ShadingContext. A single factory plugin can have several RixBxdf 'sessions' opened simultaneously and in different threads. Caller of BeginScatter is expected to call RixBxdf'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 Bxdf for scattering on the surface.

k_RixSCVolumeScatterQuery: the factory should construct a Bxdf (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.

◆ BeginSubsurface()

virtual class RixVolumeIntegrator* RixBxdfFactory::BeginSubsurface ( RixShadingContext const *  ,
RixSCShadingMode  ,
RtPointer  instanceData 
)
pure virtual

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

A non-NULL result indicates that for the specified shading mode, the Bxdf desires to express non-trivial subsurface behavior for interior region associated with the bound surface. A NULL result (as should be returned by a trivial 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 there is no subsurface scattering (even across all varying inputs).

BeginSubsurface 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.

◆ EndInterior()

virtual void RixBxdfFactory::EndInterior ( RixVolumeIntegrator )
pure virtual

◆ EndOpacity()

virtual void RixBxdfFactory::EndOpacity ( class RixOpacity )
pure virtual

◆ EndPostLighting()

virtual void RixBxdfFactory::EndPostLighting ( class RixPostLighting )
inlinevirtual

Definition at line 481 of file RixBxdf.h.

◆ EndScatter()

virtual void RixBxdfFactory::EndScatter ( class RixBxdf bxdf)
pure virtual

◆ EndSubsurface()

virtual void RixBxdfFactory::EndSubsurface ( RixVolumeIntegrator )
pure virtual

◆ GetIndexOfRefraction()

virtual float RixBxdfFactory::GetIndexOfRefraction ( RtPointer  instanceData) const
pure virtual

Returns the index of refraction of the material. Most materials should simply return an IOR of 1.0f.

◆ GetInstanceHints()

virtual int RixBxdfFactory::GetInstanceHints ( RtPointer  instanceData) const
pure virtual

◆ GetInterface()

virtual int RixBxdfFactory::GetInterface ( ) const
inlineoverridevirtual

Reimplemented from RixShadingPlugin.

Definition at line 267 of file RixBxdf.h.

◆ RegisterTemporalVolumeParams()

virtual void RixBxdfFactory::RegisterTemporalVolumeParams ( RtPointer  instanceData,
std::vector< int > &  paramId 
) const
pure virtual

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