Loading...
Searching...
No Matches
bagher.h
Go to the documentation of this file.
1#ifndef _BBM_BAGHER_H_
2#define _BBM_BAGHER_H_
3
6#include "ndf/sgd.h"
8
9/************************************************************************/
10/*! \file bagher.h
11
12 \brief Implements the microfacet BSDF with Shifted Gamma Distribution:
13
14 M. M. Bagher, C. Soler, and N. Holzschuch "Accurate fitting of measured
15 reflectances using a Shifted Gamma micro-facet distribution", Computer
16 Graphics Forum 31, 4, 2012: https://doi.org/10.1111/j.1467-8659.2012.03147.x
17
18*************************************************************************/
19
20namespace bbm {
21
22 namespace ior {
23 //! @{ \name Specialized 2d reflectance type for Bagher et al.'s modified Schlick's approxiation.
24 template<typename T> struct bagher_reflectance_tag { using type = vec2d<T>; };
26 //! @}
27 } // end ior namespace
28
29 /**********************************************************************/
30 /*! \brief Define a specialized bsdf_parameter for the 2d Bagher et al.'s reflectance.
31 **********************************************************************/
32 template<typename T, bsdf_attr Flag> struct bsdf_fresnel_properties<ior::bagher_reflectance<T>, Flag> : bsdf_properties<ior::bagher_reflectance<T>, Flag, std::array{1.0,0.0}, 1.0, std::array{0.0, -1.0}> {};
33
34 namespace fresnel {
35 /********************************************************************/
36 /*! \brief Bagher at al.'s modified Schlick's Fresnel approximation
37 ********************************************************************/
38 template<typename CONF> requires concepts::config<CONF>
39 struct bagher
40 {
42
43 //! \brief uses specialized bagher_reflectance
45
46 //! \brief Evaluate Bagher's modified Schlick Fresnel
47 static constexpr Spectrum eval(const parameter_type& F, const Value& cosTheta, Mask mask=true)
48 {
49 return bbm::select(mask, fresnel::schlick<Config,ior::reflectance<Spectrum>>::eval(F[0], cosTheta, mask) - (F[1] * cosTheta), 0);
50 }
51 };
52
54 } // end fresnel namespace
55
56 /**********************************************************************/
57 /*! \brief Bagher et al.'s Microfacet BSDF with Shifted Gamma Distribution
58
59 \tparam CONF = bbm configuration
60 \tparam NAME = model name (default = Bagher)
61 **********************************************************************/
62 template<typename CONF, string_literal NAME = "Bagher"> requires concepts::config<CONF>
67 NAME>,
69
71
72} // end bbm namespace
73
74#endif /* _BBM_BAGHER_H_ */
75
#define BBM_EXPORT_BSDFMODEL(BsdfModel)
Definition: bbm_fromstring.h:49
bsdfmodel concept
Definition: bsdfmodel.h:33
config concept
Definition: config.h:31
fresnel concept
Definition: fresnel.h:27
#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 ...
vec2d< T > type
Definition: bagher.h:24
Definition: bagher.h:24
Definition: aggregatebsdf.h:29
constexpr auto select(MASK &&mask, const A &a, const A &b)
Definition: backbone.h:255
Base declaration of attribute; further specialized below.
Definition: attribute.h:26
Definition: bsdf_attribute.h:88
Add an 'albedo' parameter to an existing bsdfmodel and scale the albedo and eval respectively.
Implements the Shifted Gamma Distribution:
bsdf_parameter property
Definition: bsdf_attribute.h:59
Bagher at al.'s modified Schlick's Fresnel approximation.
Definition: bagher.h:40
static constexpr Spectrum eval(const parameter_type &F, const Value &cosTheta, Mask mask=true)
Evaluate Bagher's modified Schlick Fresnel.
Definition: bagher.h:47
Implements the Fresnel reflectance equation as proposed by Schlick [Comp. Graph. Forum '94]: https://...
Definition: fresnel_schlick.h:21
Uncorrelated joint masking and shadowing.
Definition: uncorrelated.h:26
static constexpr literal Cook
Definition: microfacet.h:35
Scaled BSDF model.
Definition: scaledmodel.h:30
Definition: string_literal.h:16
Uncorrelated joint masking and shadowing. Follows Eq. 98 from "Understanding the Masking-Shadowing Fu...