Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
aggregatemodel_base< NAME, MODELS > Struct Template Reference

The sum of different BSDF models. More...

#include <aggregatemodel.h>

Inherits MODELS.

Public Member Functions

 BBM_BASETYPES (MODELS...)
 
 BBM_IMPORT_CONFIG (std::tuple_element_t< 0, std::tuple< MODELS... > >)
 
 aggregatemodel_base (void)
 Default constructor.
 
 aggregatemodel_base (const MODELS &... models)
 Construction from each model.
 
 aggregatemodel_base (const aggregatemodel_base &src)
 Copy constructor.
 
aggregatemodel_baseoperator= (const aggregatemodel_base &src)
 Assignment operator.
 
Spectrum eval (const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
 Evaluate the BSDF for a given in out direction.
 
BsdfSample sample (const Vec3d &out, const Vec2d &xi, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
 Sample the aggregate BSDF given a direction and two random variables.
 
Value pdf (const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
 Compute the pdf given an in and out direction.
 
Spectrum reflectance (const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
 Return the (approximate) hemispherical reflectance of the BSDF.
 
std::string toString (void) const
 toString to overwrite default printing behavior
 

Static Public Member Functions

static aggregatemodel_base fromString (const std::string &str)
 construct an aggregate model from a string
 

Public Attributes

 BBM_BSDF_FORWARD
 

Static Public Attributes

static constexpr string_literal name = NAME
 

Detailed Description

template<string_literal NAME, typename... MODELS>
requires (sizeof...(MODELS) >= 2) && concepts::matching_config<MODELS...> && (concepts::bsdfmodel<MODELS> && ...)
struct bbm::aggregatemodel_base< NAME, MODELS >

The sum of different BSDF models.

Template Parameters
NAME= model name
MODELS= list of BSDF models over which this model aggregates

Constructor & Destructor Documentation

◆ aggregatemodel_base() [1/3]

aggregatemodel_base ( void  )
inline

Default constructor.

◆ aggregatemodel_base() [2/3]

aggregatemodel_base ( const MODELS &...  models)
inline

Construction from each model.

◆ aggregatemodel_base() [3/3]

aggregatemodel_base ( const aggregatemodel_base< NAME, MODELS > &  src)
inline

Copy constructor.

Member Function Documentation

◆ BBM_BASETYPES()

BBM_BASETYPES ( MODELS...  )

◆ BBM_IMPORT_CONFIG()

BBM_IMPORT_CONFIG ( std::tuple_element_t< 0, std::tuple< MODELS... > >  )

◆ eval()

Spectrum eval ( const Vec3d &  in,
const Vec3d &  out,
BsdfFlag  component = bsdf_flag::All,
unit_t  unit = unit_t::Radiance,
Mask  mask = true 
) const
inline

Evaluate the BSDF for a given in out direction.

Parameters
in= incident direction
out= outgoing direction
component= which reflectance component to eval
unit= unit of computation
mask= masking of lanes (e.g., for Packet eval)
Returns
Evaluation of the BSDF per spectrum.

Evaluation is performed by evaluating each child model, and adding the results.

◆ fromString()

static aggregatemodel_base fromString ( const std::string &  str)
inlinestatic

construct an aggregate model from a string

◆ operator=()

aggregatemodel_base & operator= ( const aggregatemodel_base< NAME, MODELS > &  src)
inline

Assignment operator.

◆ pdf()

Value pdf ( const Vec3d &  in,
const Vec3d &  out,
BsdfFlag  component = bsdf_flag::All,
unit_t  unit = unit_t::Radiance,
Mask  mask = true 
) const
inline

Compute the pdf given an in and out direction.

Parameters
in= the incoming (sampled) direction
out= the outgoing (given) direction
component= which reflectance component was sampled
unit= unit of computation
mask= masking of lanes
Returns
the PDF that the incoming direction would be sampled given the outgoing direction.

The PDF is computed as the reflectance weighted sum of all PDFs.

◆ reflectance()

Spectrum reflectance ( const Vec3d &  out,
BsdfFlag  component = bsdf_flag::All,
unit_t  unit = unit_t::Radiance,
Mask  mask = true 
) const
inline

Return the (approximate) hemispherical reflectance of the BSDF.

Parameters
out= the outgoing direction
component= which reflectance component to eval
unit= unit of computation
mask= masking of lanes
Returns
the approximate reflectance of the BSDF for a given direction

The hemispherical reflectance is computed as the sum of the underlying BSDF models.

◆ sample()

BsdfSample sample ( const Vec3d &  out,
const Vec2d &  xi,
BsdfFlag  component = bsdf_flag::All,
unit_t  unit = unit_t::Radiance,
Mask  mask = true 
) const
inline

Sample the aggregate BSDF given a direction and two random variables.

Parameters
out= outgoing direction
xi= two random variables stored in a Vec2d
component= which reflectance component to sample
unit= unit of computation
mask= masking of lanes.
Returns
A bsdfSample containing the sampled direction and the corresponding pdf.

Selects one BSDF model to sample based with a probability propertional to the hemispherical reflectances of each BSDF. The selected BSDF model is then sampled, and its sampled direction is returned. The PDF is computed as the weighted sum of each BSDF model's PDF and the reflectance weights.

◆ toString()

std::string toString ( void  ) const
inline

toString to overwrite default printing behavior

Member Data Documentation

◆ BBM_BSDF_FORWARD

BBM_BSDF_FORWARD

◆ name

constexpr string_literal name = NAME
staticconstexpr

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