Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::BsdfSampleOutput Class Referencefinal

Output for BsdfSampleQuery. More...

#include <BsdfSampleQuery.h>

Public Member Functions

void setL (const math::Vector3R &L)
 
void setPdfAppliedBsdfCos (const math::Spectrum &pdfAppliedBsdfCos, real cos, bool inferMeasurability=true)
 
const math::Vector3RgetL () const
 
real getCos () const
 
math::Spectrum getPdfAppliedBsdf () const
 
const math::SpectrumgetPdfAppliedBsdfCos () const
 
real getRelativeIor () const
 
real getRelativeIor2 () const
 
bool isMeasurable () const
 Tells whether this sample has potential to contribute. All sampled data should be usable if true is returned; otherwise, zero contribution is implied, and sampled data is undefined. This method is also an efficient way to decide whether the BSDF sample has sane value (compared to manually testing its value).
 
void setMeasurability (bool measurability)
 Set measurability directly.
 
void setMeasurability (const math::Spectrum &reference)
 Set measurability based on a reference spectrum.
 
void setRelativeIor (real relativeIor)
 
 operator bool () const
 Convenient method for isMeasurable().
 

Detailed Description

Output for BsdfSampleQuery.

Note
It is an error to get output data if isMeasurable() returns false.

Member Function Documentation

◆ getCos()

real ph::BsdfSampleOutput::getCos ( ) const
inline
Returns
Lambert's cosine term. Guaranteed to be > 0. This is the absolute value of \( N \cdot L \), where \( N \) is the normal vector and \( L \) is the sampled direction.
Note
This cosine term is an absolute value. You may need to consult the corresponding SurfaceHit if its sign is needed.

◆ getL()

const math::Vector3R & ph::BsdfSampleOutput::getL ( ) const
inline
Returns
Sampled direction (normalized) of the incident ray.

◆ getPdfAppliedBsdf()

math::Spectrum ph::BsdfSampleOutput::getPdfAppliedBsdf ( ) const
inline
Returns
Sampled BSDF with PDF (on the same domain) applied. Guaranteed to be finite. Specifically, it is equivalent to \( BSDF / PDF_{\omega} \).

◆ getPdfAppliedBsdfCos()

const math::Spectrum & ph::BsdfSampleOutput::getPdfAppliedBsdfCos ( ) const
inline

Prefer using this method when applicable instead of applying the cosine term manually. The coupled form often results in less computation and potentially offers better numerical stability as some terms can often be canceled out.

Returns
Sampled BSDF with Lambert's cosine law and PDF (on the same domain) applied. Guaranteed to be finite. Specifically, it is equivalent to \( BSDF * \lvert\cos\theta\rvert / PDF_{\omega} \).
Note
This cosine term is an absolute value. You may need to consult the corresponding SurfaceHit if its sign is needed.

◆ getRelativeIor()

real ph::BsdfSampleOutput::getRelativeIor ( ) const
inline
Returns
Relative index of refraction of the sampled interface. The value is calculated as \( \eta_V / \eta_L \), with \( V \) on the exiting side and \( L \) on the incident side. If the ray does not cross an interface, 1 is returned.

◆ getRelativeIor2()

real ph::BsdfSampleOutput::getRelativeIor2 ( ) const
inline
Returns
Squared value of getRelativeIor().

◆ isMeasurable()

bool ph::BsdfSampleOutput::isMeasurable ( ) const
inline

Tells whether this sample has potential to contribute. All sampled data should be usable if true is returned; otherwise, zero contribution is implied, and sampled data is undefined. This method is also an efficient way to decide whether the BSDF sample has sane value (compared to manually testing its value).

Note
Measurability has nothing to do with whether the sampled value is 0 or not.

◆ operator bool()

ph::BsdfSampleOutput::operator bool ( ) const
inline

Convenient method for isMeasurable().

◆ setL()

void ph::BsdfSampleOutput::setL ( const math::Vector3R & L)
inline

◆ setMeasurability() [1/2]

void ph::BsdfSampleOutput::setMeasurability ( bool measurability)
inline

Set measurability directly.

◆ setMeasurability() [2/2]

void ph::BsdfSampleOutput::setMeasurability ( const math::Spectrum & reference)
inline

Set measurability based on a reference spectrum.

◆ setPdfAppliedBsdfCos()

void ph::BsdfSampleOutput::setPdfAppliedBsdfCos ( const math::Spectrum & pdfAppliedBsdfCos,
real cos,
bool inferMeasurability = true )
inline
Parameters
pdfAppliedBsdfCosThe sampled BSDF in a coupled form. See getPdfAppliedBsdfCos() for more information.
cosThe contained Lambert's cosine term (absolute value). See getCos() for more information.
inferMeasurabilityWhether to determine measurability from the supplied data. All supplied data must be sane for the sample to be measurable.

◆ setRelativeIor()

void ph::BsdfSampleOutput::setRelativeIor ( real relativeIor)
inline
Parameters
relativeIorSee getRelativeIor() for more information.

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