Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
aggregatebsdf< CONF, NAME > Class Template Reference

A BSDF that is the aggregate of different BSDFs. More...

#include <aggregatebsdf.h>

Inherits bsdf_base< CONF >.

Public Member Functions

 BBM_IMPORT_CONFIG (CONF)
 
template<typename... BSDFS>
requires concepts::matching_config<Config, BSDFS...> && (concepts::bsdf_ptr<BSDFS> && ...)
 aggregatebsdf (const BSDFS &... src)
 Construct an aggregate bsdf from a list of bsdf_ptrs.
 
template<typename ITR >
requires std::input_or_output_iterator<ITR> && concepts::bsdf< std::iter_reference_t<ITR> > && concepts::matching_config< std::iter_reference_t<ITR> > && concepts::bsdf_ptr< std::iter_value_t<ITR> >
 aggregatebsdf (const ITR &begin, const ITR &end)
 Construct an aggregate bsdf from iterators to list of 'bsdf_ptrs'.
 
 aggregatebsdf (const aggregatebsdf< Config > &src)
 Copy Constructor.
 
aggregatebsdf< Config > & operator= (const aggregatebsdf< Config > &src)
 Assignment Operator.
 
virtual Spectrum eval (const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const override final
 Sum the BSDF evaluations for a given in out direction.
 
virtual BsdfSample sample (const Vec3d &out, const Vec2d &xi, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const override final
 Sample the aggregate BSDF given a direction and two random variables.
 
virtual Value pdf (const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const override final
 Compute the pdf given an in and out direction.
 
virtual Spectrum reflectance (const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const override final
 Return the (approximate) hemispherical reflectance of the BSDF.
 
virtual std::string toString (void) const override final
 Convert the aggregatebsdf to string.
 
Parameter Enumeration
virtual bbm::vector< Value & > parameter_values (bsdf_attr flags=bsdf_attr::All) override final
 
virtual bbm::vector< const Value & > parameter_values (bsdf_attr flags=bsdf_attr::All) const override final
 
virtual bbm::vector< Value > parameter_default_values (bsdf_attr flags=bsdf_attr::All) const override final
 
virtual bbm::vector< Value > parameter_lower_bound (bsdf_attr flags=bsdf_attr::All) const override final
 
virtual bbm::vector< Value > parameter_upper_bound (bsdf_attr flags=bsdf_attr::All) const override final
 
- Public Member Functions inherited from bsdf_base< CONF >
 BBM_IMPORT_CONFIG (CONF)
 
virtual ~bsdf_base (void)
 empty virtual destructor
 
virtual Spectrum eval (const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const =0
 Evaluate the BSDF given an in and out direction.
 
virtual BsdfSample sample (const Vec3d &out, const Vec2d &xi, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const =0
 Samples the BSDF given an out direction and 2 random variables.
 
virtual Value pdf (const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const =0
 The pdf of the in-out direction combination.
 
virtual Spectrum reflectance (const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const =0
 the (approximate) hemispherical reflectance of the BSDF
 
virtual std::string toString (void) const =0
 Fancy print the BSDF to a string.
 

Static Public Member Functions

static aggregatebsdf fromString (const std::string &str)
 Construct the aggregate bsdf from a string.
 

Public Attributes

 BBM_BSDF_FORWARD
 
- Public Attributes inherited from bsdf_base< CONF >
 BBM_BSDF_FORWARD
 

Static Public Attributes

static constexpr string_literal name = NAME
 
- Static Public Attributes inherited from bsdf_base< CONF >
static constexpr string_literal name = "bsdf_base"
 

Private Attributes

std::vector< bsdf_ptr< Config > > _bsdfs
 

Detailed Description

template<typename CONF, string_literal NAME = "Aggregate">
requires concepts::config<CONF>
class bbm::aggregatebsdf< CONF, NAME >

A BSDF that is the aggregate of different BSDFs.

Note: the aggregatebsdf does not own the BSDFs, instead it takes bsdf_ptrs as input.

Constructor & Destructor Documentation

◆ aggregatebsdf() [1/3]

aggregatebsdf ( const BSDFS &...  src)
inline

Construct an aggregate bsdf from a list of bsdf_ptrs.

◆ aggregatebsdf() [2/3]

aggregatebsdf ( const ITR &  begin,
const ITR &  end 
)
inline

Construct an aggregate bsdf from iterators to list of 'bsdf_ptrs'.

◆ aggregatebsdf() [3/3]

aggregatebsdf ( const aggregatebsdf< Config > &  src)
inline

Copy Constructor.

Member Function Documentation

◆ BBM_IMPORT_CONFIG()

BBM_IMPORT_CONFIG ( CONF  )

◆ eval()

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

Sum the BSDF evaluations 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 BSDF in _bsdfs, and adding the results.

Implements bsdf_base< CONF >.

◆ fromString()

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

Construct the aggregate bsdf from a string.

◆ operator=()

aggregatebsdf< Config > & operator= ( const aggregatebsdf< Config > &  src)
inline

Assignment Operator.

◆ parameter_default_values()

virtual bbm::vector< Value > parameter_default_values ( bsdf_attr  flags = bsdf_attr::All) const
inlinefinaloverridevirtual

Implements bsdf_base< CONF >.

◆ parameter_lower_bound()

virtual bbm::vector< Value > parameter_lower_bound ( bsdf_attr  flags = bsdf_attr::All) const
inlinefinaloverridevirtual

Implements bsdf_base< CONF >.

◆ parameter_upper_bound()

virtual bbm::vector< Value > parameter_upper_bound ( bsdf_attr  flags = bsdf_attr::All) const
inlinefinaloverridevirtual

Implements bsdf_base< CONF >.

◆ parameter_values() [1/2]

virtual bbm::vector< const Value & > parameter_values ( bsdf_attr  flags = bsdf_attr::All) const
inlinefinaloverridevirtual

Implements bsdf_base< CONF >.

◆ parameter_values() [2/2]

virtual bbm::vector< Value & > parameter_values ( bsdf_attr  flags = bsdf_attr::All)
inlinefinaloverridevirtual

Implements bsdf_base< CONF >.

◆ pdf()

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

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 hemispherical reflectance weighted sum of all PDFs.

Implements bsdf_base< CONF >.

◆ reflectance()

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

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 hemispherical reflectance of the BSDF for a given outgoing direction

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

Implements bsdf_base< CONF >.

◆ sample()

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

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 in direction and the corresponding pdf.

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

Implements bsdf_base< CONF >.

◆ toString()

virtual std::string toString ( void  ) const
inlinefinaloverridevirtual

Convert the aggregatebsdf to string.

Implements bsdf_base< CONF >.

Member Data Documentation

◆ _bsdfs

std::vector<bsdf_ptr<Config> > _bsdfs
private

◆ BBM_BSDF_FORWARD

BBM_BSDF_FORWARD

◆ name

constexpr string_literal name = NAME
staticconstexpr

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