34 template<
typename CONF, string_literal NAME=
"SGD_base">
requires concepts::config<CONF>
54 if(bbm::none(mask))
return 0;
58 Spectrum denum = bbm::pow(temp,
p);
59 Spectrum P22 =
bbm::select(denum > Constants::Epsilon(), bbm::exp( -temp ) / denum, 0);
73 Vec3d
sample(
const Vec3d& view,
const Vec2d& xi, Mask mask=
true)
const
76 Value avg_alpha = bbm::hsum(
alpha) / bbm::hsum(Spectrum(1));
88 Value
pdf(
const Vec3d& view,
const Vec3d& m, Mask mask=
true)
const
91 Value avg_alpha = bbm::hsum(
alpha) / bbm::hsum(Spectrum(1));
107 Value
G1(
const Vec3d& ,
const Vec3d& , Mask =
true)
const
163 if(bbm::none(mask))
return 0;
177 Spectrum
G1(
const Vec3d& v,
const Vec3d& m, Mask mask=
true)
const
180 mask &= (
vec::z(v) > 0) && (bbm::dot(v, m) > 0);
183 if(bbm::none(mask))
return 0;
All includes and helpers needed for declaring new ndfs.
The GGX Microfacet distribution.
Definition: ggx.h:38
Value pdf(const Vec3d &view, const Vec3d &m, Mask mask=true) const
PDF of sampling the NDF.
Definition: ggx.h:142
Vec3d sample(const Vec3d &view, const Vec2d &xi, Mask mask=true) const
Sample the NDF.
Definition: ggx.h:75
The unnormalized SGD microfacet distribution and without shadowing and masking.
Definition: sgd.h:36
Value pdf(const Vec3d &view, const Vec3d &m, Mask mask=true) const
PDF of sampling the NDF.
Definition: sgd.h:88
Vec3d sample(const Vec3d &view, const Vec2d &xi, Mask mask=true) const
Sample the NDF.
Definition: sgd.h:73
Value G1(const Vec3d &, const Vec3d &, Mask=true) const
Monodirectional shadowing and masking factor.
Definition: sgd.h:107
bsdf_parameter< Spectrum, bsdf_attr::SpecularParameter, 0.64 > p
Definition: sgd.h:116
specular_roughness< Spectrum > alpha
Definition: sgd.h:115
static constexpr string_literal name
Definition: sgd.h:39
BBM_DEFAULT_CONSTRUCTOR(sgd_base)
Default Constructor.
Definition: sgd.h:122
Spectrum eval(const Vec3d &halfway, Mask mask=true) const
Evaluate the NDF.
Definition: sgd.h:48
The SGD microfacet distribution with fitted shadowing and masking.
Definition: sgd.h:138
bsdf_parameter< Spectrum, bsdf_attr::Dependent, constants< Scalar >::Pi(0.5)> theta0
Definition: sgd.h:202
bsdf_parameter< Spectrum, bsdf_attr::Dependent > Lambda
Definition: sgd.h:199
Spectrum G1(const Vec3d &v, const Vec3d &m, Mask mask=true) const
Monodirectional shadowing and masking term.
Definition: sgd.h:177
bsdf_parameter< Spectrum, bsdf_attr::Dependent > c
Definition: sgd.h:200
bsdf_parameter< Spectrum, bsdf_attr::Dependent, 7.5 > K
Definition: sgd.h:198
BBM_DEFAULT_CONSTRUCTOR(sgd)
Default Constructor.
Definition: sgd.h:208
static constexpr string_literal name
Definition: sgd.h:143
Spectrum eval(const Vec3d &halfway, Mask mask=true) const
Evaluate the NDF.
Definition: sgd.h:157
BBM_ATTRIBUTES(K, Lambda, c, theta0, k)
bsdf_parameter< Spectrum, bsdf_attr::Dependent > k
Definition: sgd.h:201
config concept
Definition: config.h:31
ndf concept
Definition: ndf.h:29
#define BBM_CHECK_CONCEPT(CONCEPTNAME, CLASSNAME,...)
Check a class for a concept with bbm::concepts::archetypes in the namespace.
Definition: macro.h:35
T tanTheta2(const vec2d< T > &v)
Definition: spherical.h:183
T cosTheta(const vec2d< T > &v)
Definition: spherical.h:109
T & theta(vec2d< T > &v)
Definition: spherical.h:23
constexpr decltype(auto) z(bbm::vec3d< T > &v)
Definition: vec.h:26
Definition: aggregatebsdf.h:29
constexpr auto select(MASK &&mask, const A &a, const A &b)
Definition: backbone.h:255
vec3d< T > halfway(const vec3d< T > &a, const vec3d< T > &b)
Halfway vector (3D)
Definition: vec_transform.h:77
Base declaration of attribute; further specialized below.
Definition: attribute.h:26
Implements the GGX Microfacet Normal Distribution from: "Microfacet Models for Refraction through Rou...
Definition: string_literal.h:16