Abstract BSDF base-class. More...
#include <mitsuba/render/bsdf.h>
Public Types | |
enum | EBSDFType { ENull = 0x00001, EDiffuseReflection = 0x00002, EDiffuseTransmission = 0x00004, EGlossyReflection = 0x00008, EGlossyTransmission = 0x00010, EDeltaReflection = 0x00020, EDeltaTransmission = 0x00040, EDelta1DReflection = 0x00080, EDelta1DTransmission = 0x00100, EAnisotropic = 0x01000, ESpatiallyVarying = 0x02000, ENonSymmetric = 0x04000, EFrontSide = 0x08000, EBackSide = 0x10000, EUsesSampler = 0x20000 } |
This list of flags is used to classify the different types of lobes that are implemented in a BSDF instance. More... | |
enum | ETypeCombinations { EReflection, ETransmission, EDiffuse = EDiffuseReflection | EDiffuseTransmission, EGlossy = EGlossyReflection | EGlossyTransmission, ESmooth = EDiffuse | EGlossy, EDelta = ENull | EDeltaReflection | EDeltaTransmission, EDelta1D = EDelta1DReflection | EDelta1DTransmission, EAll = EDiffuse | EGlossy | EDelta | EDelta1D } |
Convenient combinations of flags from EBSDFType. More... | |
Public Member Functions | |
int | getComponentCount () const |
Return the number of components of this BSDF. More... | |
unsigned int | getType () const |
Return a listing of this BSDF's component types and properties, combined using binary OR. More... | |
unsigned int | getType (int component) const |
bool | hasComponent (unsigned int type) const |
Test whether this BSDF contains a certain type of component. More... | |
bool | usesRayDifferentials () const |
Return whether this BSDF makes use of ray differentials. More... | |
virtual Spectrum | getDiffuseReflectance (const Intersection &its) const |
Return the diffuse reflectance value (if any) More... | |
virtual Spectrum | getSpecularReflectance (const Intersection &its) const |
Return the specular reflectance value (if any) More... | |
virtual Spectrum | sample (BSDFSamplingRecord &bRec, const Point2 &sample) const =0 |
Sample the BSDF and return the importance weight (i.e. the value of the BSDF divided by the probability density of the sample). More... | |
virtual Spectrum | sample (BSDFSamplingRecord &bRec, Float &pdf, const Point2 &sample) const =0 |
Sample the BSDF and return the probability density and the importance weight of the sample (i.e. the value of the BSDF divided by the probability density) More... | |
virtual Spectrum | eval (const BSDFSamplingRecord &bRec, EMeasure measure=ESolidAngle) const =0 |
Evaluate the BSDF f(wi, wo) or its adjoint version f^{*}(wi, wo) More... | |
virtual Float | pdf (const BSDFSamplingRecord &bRec, EMeasure measure=ESolidAngle) const =0 |
Compute the probability of sampling bRec.wo (given bRec.wi ). More... | |
virtual Float | getEta () const |
For transmissive BSDFs: return the material's relative index of refraction. More... | |
virtual Float | getRoughness (const Intersection &its, int index) const |
For rough BSDFs: return the root mean square surface roughness of the given BSDF component. More... | |
virtual Frame | getFrame (const Intersection &its) const |
Sometimes, BSDF models make use of a perturbed frame for internal shading computations (e.g. bump maps). This function exposes this internal frame. More... | |
virtual void | getFrameDerivative (const Intersection &its, Frame &du, Frame &dv) const |
Sometimes, BSDF models make use of a perturbed frame for internal shading computations (e.g. bump maps). This function computes the derivative of this frame with respect to the UV parameterization of the underlying shape. More... | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
ConfigurableObject interface | |
virtual void | configure () |
Configure the material (called after construction by the XML parser) More... | |
virtual void | addChild (const std::string &string, ConfigurableObject *obj) |
Add a child object. More... | |
void | addChild (ConfigurableObject *child) |
Add an unnamed child. More... | |
virtual void | serialize (Stream *stream, InstanceManager *manager) const |
Serialize this object to a stream. More... | |
virtual void | setParent (ConfigurableObject *parent) |
Set the parent object. More... | |
Public Member Functions inherited from mitsuba::ConfigurableObject | |
void | addChild (ConfigurableObject *child) |
Add an unnamed child. More... | |
const std::string & | getID () const |
Return the identifier associated with this instance (or "unnamed") More... | |
void | setID (const std::string &name) |
Set the identifier associated with this instance. More... | |
const Properties & | getProperties () const |
Return the properties object that was originally used to create this instance. More... | |
Public Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject (Stream *stream, InstanceManager *manager) | |
Unserialize a serializable object. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
virtual std::string | toString () const |
Return a human-readable string representation of the object's contents. More... | |
Public Member Functions inherited from mitsuba::HWResource | |
virtual Shader * | createShader (Renderer *renderer) const |
virtual | ~HWResource () |
Static Public Member Functions | |
static EMeasure | getMeasure (unsigned int componentType) |
Return the measure corresponding to a particular component type. More... | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Static Public Attributes | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::ConfigurableObject | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::SerializableObject | |
static Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
BSDF (const Properties &props) | |
Create a new BSDF instance. More... | |
BSDF (Stream *stream, InstanceManager *manager) | |
Unserialize a BSDF instance. More... | |
Texture * | ensureEnergyConservation (Texture *tex, const std::string ¶mName, Float max) const |
Convenience function to ensure energy conservation. More... | |
std::pair< Texture *, Texture * > | ensureEnergyConservation (Texture *tex1, Texture *tex2, const std::string ¶mName1, const std::string ¶mName2, Float max) const |
Convenience function to ensure energy conservation. More... | |
virtual | ~BSDF () |
Virtual destructor. More... | |
Protected Member Functions inherited from mitsuba::ConfigurableObject | |
virtual | ~ConfigurableObject () |
Virtual destructor. More... | |
ConfigurableObject (const Properties &props) | |
Construct a configurable object. More... | |
ConfigurableObject (Stream *stream, InstanceManager *manager) | |
Unserialize a configurable object. More... | |
Protected Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject () | |
Construct a serializable object. More... | |
virtual | ~SerializableObject () |
Virtual deconstructor. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
Protected Attributes | |
std::vector< unsigned int > | m_components |
unsigned int | m_combinedType |
bool | m_usesRayDifferentials |
bool | m_ensureEnergyConservation |
Protected Attributes inherited from mitsuba::ConfigurableObject | |
Properties | m_properties |
Abstract BSDF base-class.
This class implements an abstract interface to all BSDF plugins in Mitsuba. It exposes functions for evaluating and sampling the model, and it allows querying the probability density of the sampling method. Smooth two-dimensional density functions, as well as degenerate one-dimensional and discrete densities are all handled within the same framework.
For improved flexibility with respect to the various rendering algorithms, this class can sample and evaluate a complete BSDF, but it also allows to pick and choose individual components of multi-lobed BSDFs based on their properties and component indices. This selection is specified using a special record that is provided along with every query.
This list of flags is used to classify the different types of lobes that are implemented in a BSDF instance.
They are also useful for picking out individual components by setting combinations in BSDFSamplingRecord::typeMask.
Enumerator | |
---|---|
ENull |
'null' scattering event, i.e. particles do not undergo deflection |
EDiffuseReflection |
Ideally diffuse reflection. |
EDiffuseTransmission |
Ideally diffuse transmission. |
EGlossyReflection |
Glossy reflection. |
EGlossyTransmission |
Glossy transmission. |
EDeltaReflection |
Reflection into a discrete set of directions. |
EDeltaTransmission |
Transmission into a discrete set of directions. |
EDelta1DReflection |
Reflection into a 1D space of directions. |
EDelta1DTransmission |
Transmission into a 1D space of directions. |
EAnisotropic |
Other lobe attributes. The lobe is not invariant to rotation around the normal |
ESpatiallyVarying |
The BSDF depends on the UV coordinates. |
ENonSymmetric |
Flags non-symmetry (e.g. transmission in dielectric materials) |
EFrontSide |
Supports interactions on the front-facing side. |
EBackSide |
Supports interactions on the back-facing side. |
EUsesSampler |
Uses extra random numbers from the supplied sampler instance. |
Convenient combinations of flags from EBSDFType.
|
protected |
Create a new BSDF instance.
|
protected |
Unserialize a BSDF instance.
|
protectedvirtual |
Virtual destructor.
|
virtual |
Add a child object.
Reimplemented from mitsuba::ConfigurableObject.
|
inline |
Add an unnamed child.
|
virtual |
Configure the material (called after construction by the XML parser)
Reimplemented from mitsuba::ConfigurableObject.
|
protected |
Convenience function to ensure energy conservation.
This function determines the component-wise maximum of the texture tex
and checks if it is below max
. If yes, it returns the texture unmodified. Otherwise, it wraps the texture into a ScaleTexture instance (with a scaling factor chosen so that the desired maximum max
is abided) and prints a warning.
|
protected |
Convenience function to ensure energy conservation.
This function determines the component-wise maximum of the sum tex1
+ tex2
and checks if it is below max
. If yes, it returns the texture unmodified. Otherwise, it wraps each the texture into a ScaleTexture instance (with a scaling factor chosen so that the desired maximum max
is abided) and prints a warning.
|
pure virtual |
Evaluate the BSDF f(wi, wo) or its adjoint version f^{*}(wi, wo)
This method allows to query the BSDF as a whole or pick out individual components. When querying a smooth (i.e. non-degenerate) component, it already multiplies the result by the cosine foreshortening factor with respect to the outgoing direction.
bRec | A record with detailed information on the BSDF query |
measure | Specifies the measure of the component. This is necessary to handle BSDFs, whose components live on spaces with different measures. (E.g. a diffuse material with an ideally smooth dielectric coating). |
|
virtual |
Retrieve this object's class.
Reimplemented from mitsuba::ConfigurableObject.
|
inline |
Return the number of components of this BSDF.
|
virtual |
Return the diffuse reflectance value (if any)
|
virtual |
For transmissive BSDFs: return the material's relative index of refraction.
The default implementation returns 1.0
.
|
virtual |
Sometimes, BSDF models make use of a perturbed frame for internal shading computations (e.g. bump maps). This function exposes this internal frame.
By default, it returns its.shFrame
|
virtual |
Sometimes, BSDF models make use of a perturbed frame for internal shading computations (e.g. bump maps). This function computes the derivative of this frame with respect to the UV parameterization of the underlying shape.
|
inlinestatic |
Return the measure corresponding to a particular component type.
|
virtual |
For rough BSDFs: return the root mean square surface roughness of the given BSDF component.
An infinite value indicates a component that is ideally diffuse
|
inlinevirtual |
Return the specular reflectance value (if any)
|
inline |
|
inline |
Returns the classification flags of a specific component
|
inline |
Test whether this BSDF contains a certain type of component.
|
pure virtual |
Compute the probability of sampling bRec.wo
(given bRec.wi
).
This method provides access to the probability density that would result when supplying the same BSDF query record to the sample() method. It correctly handles changes in probability when only a subset of the components is chosen for sampling (this can be done using the BSDFSamplingRecord::component and BSDFSamplingRecord::typeMask fields).
bRec | A record with detailed information on the BSDF query |
measure | Specifies the measure of the component. This is necessary to handle BSDFs, whose components live on spaces with different measures. (E.g. a diffuse material with an ideally smooth dielectric coating). |
|
pure virtual |
Sample the BSDF and return the importance weight (i.e. the value of the BSDF divided by the probability density of the sample).
When the probability density is not explicitly required, this function should be preferred, since it is potentially faster by making use of cancellations during the division.
If a component mask or a specific component index is specified, the sample is drawn from the matching component, if it exists. Depending on the provided transport type, either the BSDF or its adjoint version is used.
bRec | A BSDF query record |
sample | A uniformly distributed sample on \([0,1]^2\) |
|
pure virtual |
Sample the BSDF and return the probability density and the importance weight of the sample (i.e. the value of the BSDF divided by the probability density)
If a component mask or a specific component index is specified, the sample is drawn from the matching component, if it exists. Depending on the provided transport type, either the BSDF or its adjoint version is used.
When sampling a continuous/non-delta component, this method also multiplies by the cosine foreshorening factor with respect to the sampled direction.
bRec | A BSDF query record |
sample | A uniformly distributed sample on \([0,1]^2\) |
Will record the probability with respect to solid angles (or the discrete probability when a delta component is sampled) |
value, pdf = bsdf.sample(bRec, sample)
|
virtual |
Serialize this object to a stream.
Reimplemented from mitsuba::ConfigurableObject.
|
virtual |
Set the parent object.
Reimplemented from mitsuba::ConfigurableObject.
|
inline |
Return whether this BSDF makes use of ray differentials.
|
protected |
|
protected |
|
protected |
|
static |
|
protected |