![]() |
RenderMan
26.0
|
The RixBxdf interface is a shading plugin responsible for creating a RixBxdf from the the ShadingContext and the set of connected patterns. More...
#include <RixBxdf.h>
Inherited by RixNullBxdf.
Public Types | |
enum | BxdfProperty { k_Albedo, k_MaterialIor } |
Public Member Functions | |
RixBxdf (RixShadingContext const *sCtx, RixBxdfFactory *factory) | |
virtual | ~RixBxdf () |
RixShadingContext const * | GetShadingCtx () |
RixBxdfFactory * | GetBxdfFactory () |
virtual RixBXEvaluateDomain | GetEvaluateDomain ()=0 |
The domain over which this Bxdf evaluates samples. More... | |
virtual void | GetAggregateLobeTraits (RixBXLobeTraits *t)=0 |
The types of samples this BxdfEvaluator can generate. More... | |
PRMAN_INLINE RixBXLobeTraits | GetAllLobeTraits () |
virtual RixSCDetail | GetProperty (BxdfProperty property, void const **result) const =0 |
Get material property Bxdfs can be queried for general material properties to facilitate integration tasks. More... | |
virtual bool | EmitLocal (RtColorRGB *result)=0 |
Used for baked, pre-integrated, indirect results. More... | |
virtual void | GenerateSample (RixBXTransportTrait transportTrait, RixBXLobeTraits const *lobesWanted, RixRNG *rng, RixBXLobeSampled *lobesSampled, RtVector3 *directions, RixBXLobeWeights &weights, float *forwardPdfs, float *reversePdfs, RtColorRGB *compTrans=NULL)=0 |
Generate sample data for each point. More... | |
virtual void | EvaluateSample (RixBXTransportTrait transportTrait, RixBXLobeTraits const *lobesWanted, RixRNG *rng, RixBXLobeTraits *lobesEvaluated, RtVector3 const *directions, RixBXLobeWeights &weights, float *forwardPdfs, float *reversePdfs)=0 |
Bxdf is expected to evaluate itself subject to the lobesWanted request. More... | |
virtual void | EvaluateSamplesAtIndex (RixBXTransportTrait transportTrait, RixBXLobeTraits const &lobesWanted, RixRNG *rng, int index, int numSamples, RixBXLobeTraits *lobesEvaluated, RtVector3 const *directions, RixBXLobeWeights &weights, float *forwardPdfs, float *reversePdfs)=0 |
Do multiple evals at a single shading point. More... | |
virtual void | Release () |
Release does any cleanup that might be needed (often none and the base implementation is fine) and then calls the base implementation. More... | |
Protected Attributes | |
RixShadingContext const * | shadingCtx |
RixBxdfFactory * | bxdfFactory |
The RixBxdf interface is a shading plugin responsible for creating a RixBxdf from the the ShadingContext and the set of connected patterns.
The RixBxdf interface characterizes the light-scattering behavior at positions in a material.
Integrators 'drive' Bxdf subclasses by:
To support several integrator-optimization strategies (diverse sampling frequencies, baking, etc.), we characterize a Bxdf as a collection of individually sampled lobes. Integrators may request samples from a subset of lobes and obtain insight into the general characteristics of each component.
Execution model:
Enumerator | |
---|---|
k_Albedo |
RtColorRGB. |
k_MaterialIor |
float |
|
inline |
|
inlinevirtual |
|
pure virtual |
Used for baked, pre-integrated, indirect results.
A trivial implementation with no local emission should simply return false, indicating to the integrator that 'result' is untouched and that the integrator should not do anything with the results. For bxdfs that do have local emission, they should return true and write shadingCtx->numPts colors to the 'result' array. The integrator will then include the returned colors in the direct lighting for the geometry.
[out] | result | Local emission color buffer |
|
pure virtual |
Bxdf is expected to evaluate itself subject to the lobesWanted request.
In addition to directions, the ShadingContext variables (primarily Vn, Nn, Tn) must be consulted.
The lobesEvaluated output can be set to indicate invalid conditions. If and only if the bxdf is unable to satisfy the request, then lobesEvaluated should be set to invalid using SetValid(false). For example, if the lobesWanted argument requests a specific lobe (e.g., diffuse reflection) that the Bxdf does not support (for instance, that Bxdf only supports glossy reflections), then lobesEvaluated should be marked invalid. However, if it is possible to evaluate the request, then lobesEvaluated should not be marked as invalid (and should instead be set to the evaluated lobe for each point in the ShadingContext). For valid samples, usually the pdf will be non-zero but the weight may be set to 0 if there is no surface response for the given directions. In some cases, it is appropriate to set the pdf to zero when a given sample could never have been generated (for example, if the sample direction is below the horizon of the surface for a purely reflective surface).
This function can assume that the input directions are normalized.
[in] | transportTrait | The subset of light transport to consider |
[in] | lobesWanted | Specify lobes for evaluation |
[in] | rng | Random number generator |
[out] | lobesEvaluated | Evaluated lobe for each point in the ShadingContext |
[out] | directions | Generated sample direction for each point (normalized) |
[out] | weights | Generated lobe weights for each point |
[out] | forwardPdfs | Generated forward PDF for each point |
[out] | reversePdfs | Generated reverse PDF for each point |
Implemented in RixNullBxdf.
|
pure virtual |
Do multiple evals at a single shading point.
Also see the documentation above for EvaluateSample().
[in] | transportTrait | The subset of light transport to consider |
[in] | lobesWanted | Specify lobes for evaluation |
[in] | rng | Random number generator |
[in] | index | Shading point index |
[in] | numSamples | Number of evaluations at this point |
[out] | lobesEvaluated | Evaluated lobe for each point in the ShadingContext |
[out] | directions | Generated sample direction for each point (normalized) |
[out] | weights | Generated lobe weights for each point |
[out] | forwardPdfs | Generated forward PDF for each point |
[out] | reversePdfs | Generated reverse PDF for each point |
Implemented in RixNullBxdf.
|
pure virtual |
Generate sample data for each point.
A Bxdf is expected to generate a sample direction and lobe weights for each point in the ShadingContext (shadingCtx). Bxdfs must respect the transportTrait and lobesWanted request and indicate which class of lobe is associated with each sample by setting lobesSampled for each generated sample. If and only if the bxdf is unable to generate a requested sample, then lobesSampled should be marked as invalid using SetValid(false). For example, if the lobesWanted argument requests a specific lobe (e.g., diffuse reflection) that the Bxdf does not support (e.g. because it only supports glossy reflection), then lobesSampled should be marked as invalid. However, if it is possible to generate the requested samples, then lobesSampled should instead be set to the sampled lobe for each point in the ShadingContext. Note that it is possible for the returned lobe weights to be set to zero for one or more of the points in the ShadingContext when there is no surface response for the sampled directions, although usually the returned pdfs will be non-zero. The pdf should be set to zero only if the probability of the Bxdf model generating a given sample is zero (see the documentation for EvaluateSample() for an example where setting the pdf to zero is appropriate).
The generated sample directions must be normalized.
Bxdf can (but not expected to) return a colored transmission value in "compTrans" which is used to generate "alpha" in the integrator. The main purpose of this "alpha" is compositing. Bxdf should check against null pointer before setting compTrans. If compTrans is non zero (caller of GenerateSample is responsible for memory allocation of compTrans) and bxdf does not set compTrans, the integrator is responsible for setting compTrans to (0,0,0) by default.
[in] | transportTrait | The subset of light transport to consider. |
[in] | lobesWanted | Specify lobes for evaluation. |
[in] | rng | Random number generator. |
[out] | lobesSampled | Sampled lobe for each point in the ShadingContext. |
[out] | directions | Generated sample direction for each point (normalized). |
[out] | weights | Generated lobe weights for each point. |
[out] | forwardPdfs | Generated forward PDF for each point. |
[out] | reversePdfs | Generated reverse PDF for each point. |
[out] | compTrans | Generated color transmission for compositing. |
Implemented in RixNullBxdf.
|
pure virtual |
The types of samples this BxdfEvaluator can generate.
Referenced by GetAllLobeTraits().
|
inline |
References GetAggregateLobeTraits().
|
inline |
References bxdfFactory.
|
pure virtual |
The domain over which this Bxdf evaluates samples.
Note that it may Generate discrete samples in any direction, this only tells where incoming samples could Evaluate to non-zero.
Implemented in RixNullBxdf.
|
pure virtual |
Get material property Bxdfs can be queried for general material properties to facilitate integration tasks.
Bxdfs should return k_RixSCInvalidDetail if a particular property is unsupported. If a property is supported Bxdf should return k_RixSCUniform or k_RixSCVarying according to the detail of the result. A trivial implementation that supports no properties of any sort should simply return k_RixSCInvalidDetail.
[in] | property | Property to query |
[out] | result | Results |
|
inline |
References shadingCtx.
|
inlinevirtual |
Release does any cleanup that might be needed (often none and the base implementation is fine) and then calls the base implementation.
A RixBxdf that contains another RixBxdf would need to call Release on its child as part of its own Release.
References bxdfFactory, and RixBxdfFactory::EndScatter().
|
protected |
Referenced by GetBxdfFactory(), and Release().
|
protected |
Referenced by GetShadingCtx().