Loading...
Searching...
No Matches
lowmicrofacet.h
Go to the documentation of this file.
1#ifndef _BBM_LOW_MICROFACET_H_
2#define _BBM_LOW_MICROFACET_H_
3
4#include "bbm/bsdfmodel.h"
6#include "ndf/low.h"
8
9/************************************************************************/
10/*! \file lowmicrofacet.h
11
12 \brief The Low et al.'s microfacet BRDF model from "BRDF models for accurate
13 and efficient rendering of glossy surfaces" [Low 2012]:
14 https://doi.org/10.1145/2077341.2077350
15
16*************************************************************************/
17namespace bbm {
18
19 /**********************************************************************/
20 /*! \brief The Low et al. Microfacet BRDF model.
21
22 \tparam CONF = bbm configuration
23 \tparam NormalizationFactor = see below (Default: normalization_v::Cook)
24 \tparam NAME= model name (default = LowMicrofacet)
25
26 The Low et al. Microfacet BSDF model is a specialization microfacet that uses
27 an unnormalized scale 'A'.
28
29 Both Low et al's supplemental document as well as the paper (Eq. 15) do
30 not list any normalization factor, which makes sense since 'A' is not
31 normalized. This is the default behavior of this implementation. However,
32 the MERL-MIT BRDF fits listed in Low et al.'s supplemental document
33 includes an additional (incorrect) normalization factor of 'Pi'
34
35 Implements: concepts::bsdfmodel
36 ***********************************************************************/
37
38 template<typename CONF, auto NormalizationFactor = microfacet_n::Cook, string_literal NAME = "LowMicrofacet"> requires concepts::config<CONF>
39 class lowmicrofacet : public microfacet<ndf::low<CONF>,
40 maskingshadowing::vgroove<CONF>,
41 fresnel::cook<CONF>,
42 NormalizationFactor,
43 NAME>
44 {
47 public:
49 static constexpr string_literal name = NAME;
50
51 // copy sample and pdf methods unchanged from microfacet
52 using base::sample;
53 using base::pdf;
54
55 /********************************************************************/
56 /*! \brief Evaluate the A*base::eval
57
58 \param in = incident direction
59 \param out = outgoing direction
60 \param component = which reflectance component to eval
61 \param unit = unit of computation (ignored)
62 \param mask = masking of lanes (e.g., for Packet eval)
63 \returns Evaluation of the BSDF per spectrum.
64 *********************************************************************/
65 Spectrum eval(const Vec3d& in, const Vec3d& out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
66 {
67 return base::eval(in, out, component, unit, mask) * A;
68 }
69
70 /*******************************************************************/
71 /*! \brief Return albedo*base::reflectance
72
73 \param out = the outgoing direction
74 \param component = which reflectance component to eval
75 \param unit = unit of computation (ignored)
76 \param mask = masking of lanes
77 \returns the approximate hemispherical reflectance of the BSDF for a given direction
78 ********************************************************************/
79 Spectrum reflectance(const Vec3d& out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
80 {
81 return base::reflectance(out, component, unit, mask) * A;
82 }
83
84
85 /////////////////////////
86 //! @{ Class Attributes
87 /////////////////////////
89
91 //! @}
92
93 //! \brief Default constructor
95 };
96
97 BBM_CHECK_CONCEPT(concepts::bsdfmodel, lowmicrofacet<config>);
98
99} // end bbm namespace
100
101#endif /* _BBM_LOW_MICROFACET_H_ */
102
104
All includes and helpers needed for declaring new bsdfmodels.
#define BBM_EXPORT_BSDFMODEL(BsdfModel)
Definition: bbm_fromstring.h:49
The Low et al. Microfacet BRDF model.
Definition: lowmicrofacet.h:44
bsdf_parameter< Spectrum, bsdf_attr::SpecularParameter > A
Class Attributes.
Definition: lowmicrofacet.h:88
BBM_DEFAULT_CONSTRUCTOR(lowmicrofacet)
Default constructor.
Definition: lowmicrofacet.h:94
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 A*baseeval.
Definition: lowmicrofacet.h:65
Spectrum reflectance(const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
Return albedo*basereflectance.
Definition: lowmicrofacet.h:79
static constexpr string_literal name
Definition: lowmicrofacet.h:49
#define BBM_CHECK_CONCEPT(CONCEPTNAME, CLASSNAME,...)
Check a class for a concept with bbm::concepts::archetypes in the namespace.
Definition: macro.h:35
Microfacet BSDF model following "Microfacet Models for Refraction through Rough Surfaces" [Walter et ...
Definition: aggregatebsdf.h:29
unit_t
Light Unit.
Definition: unit.h:21
Base declaration of attribute; further specialized below.
Definition: attribute.h:26
Implements Low et al.'s Microfacet Normal Distribution from "BRDF models for accurate and efficient r...
Implements the Fresnel reflectance equation as proposed by Cook and Torrance [SIGGRAPH'82]: https://d...
Definition: fresnel_cook.h:21
Vgroove shadowing and masking.
Definition: vgroove.h:26
static constexpr literal Cook
Definition: microfacet.h:35
General microfacet BRDF model.
Definition: microfacet.h:58
Spectrum eval(const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t=unit_t::Radiance, Mask mask=true) const
Evaluate the BSDF for a given in-out direction pair.
Definition: microfacet.h:74
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 microfacet BSDF given a direction and two random variables.
Definition: microfacet.h:115
Spectrum reflectance(const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t=unit_t::Radiance, Mask mask=true) const
Return the (approximate) hemispherical reflectance of the BSDF.
Definition: microfacet.h:186
Value pdf(const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t=unit_t::Radiance, Mask mask=true) const
Compute the pdf given an in and out direction.
Definition: microfacet.h:154
Definition: string_literal.h:16
Vgroove shadowing and masking. Based on Torrance and Sparrow, 19967, "Theory for off-specular reflect...