1#ifndef _BBM_FRESNEL_COOK_H_
2#define _BBM_FRESNEL_COOK_H_
19 template<
typename CONF,
typename PARAM=ior::ior<Value_t<CONF>>>
requires concepts::config<CONF>
41 static constexpr typename std::decay_t<parameter_type>::type
eval(
const parameter_type& param,
const Value& cosTheta, Mask mask=
true)
44 if(bbm::none(mask))
return 0;
50 auto g = bbm::safe_sqrt( eta*eta + cosTheta*cosTheta - Scalar(1.0) );
51 auto a = (g - cosTheta) / (g + cosTheta);
52 auto b = (cosTheta*(g+cosTheta) - Scalar(1.0)) / (cosTheta*(g-cosTheta) + Scalar(1.0));
55 return bbm::select(mask, bbm::max(Scalar(0.5) * (a*a) * (Scalar(1.0) + b*b), 0.0), 0.0);
All BBM methods are defined to operate on a variety of value types and spectrum types....
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
void fresnel(py::module &m, const std::string &prefix="")
Define a python interface for ior::ior and ior::reflectance given a value type T.
Definition: py_fresnel.h:22
Definition: aggregatebsdf.h:29
constexpr auto select(MASK &&mask, const A &a, const A &b)
Definition: backbone.h:255
typename get_config< T >::Value Value_t
Definition: config.h:67
typename get_config< T >::Spectrum Spectrum_t
Definition: config.h:68
Base declaration of attribute; further specialized below.
Definition: attribute.h:26
Implements the Fresnel reflectance equation as proposed by Cook and Torrance [SIGGRAPH'82]: https://d...
Definition: fresnel_cook.h:21
PARAM parameter_type
Fresnel Parameter Type.
Definition: fresnel_cook.h:25
static constexpr std::decay_t< parameter_type >::type eval(const parameter_type ¶m, const Value &cosTheta, Mask mask=true)
Evaluate Fresnel reflectance.
Definition: fresnel_cook.h:41