19 #include <nori/bsdf.h>
20 #include <nori/frame.h>
21 #include <nori/warp.h>
29 m_alpha = propList.
getFloat(
"alpha", 0.1f);
32 m_intIOR = propList.
getFloat(
"intIOR", 1.5046f);
35 m_extIOR = propList.
getFloat(
"extIOR", 1.000277f);
48 m_ks = 1 - m_kd.maxCoeff();
56 return std::exp(-temp*temp)
57 / (M_PI * m_alpha * m_alpha * ct2 * ct2);
72 float a = 1.0f / (m_alpha * tanTheta);
79 return (3.535f * a + 2.181f * a2)
80 / (1.0f + 2.276f * a + 2.577f * a2);
85 throw NoriException(
"MicrofacetBRDF::eval(): not implemented!");
90 throw NoriException(
"MicrofacetBRDF::pdf(): not implemented!");
95 throw NoriException(
"MicrofacetBRDF::sample(): not implemented!");
98 virtual std::string
toString()
const override {
116 float m_intIOR, m_extIOR;
121 NORI_REGISTER_CLASS(
Microfacet,
"microfacet");
Superclass of all bidirectional scattering distribution functions.
virtual Color3f eval(const BSDFQueryRecord &bRec) const override
Evaluate the BRDF for the given pair of directions.
virtual std::string toString() const override
Return a brief string summary of the instance (for debugging purposes)
float evalBeckmann(const Normal3f &m) const
Evaluate the microfacet normal distribution D.
float smithBeckmannG1(const Vector3f &v, const Normal3f &m) const
Evaluate Smith's shadowing-masking function G1.
virtual float pdf(const BSDFQueryRecord &bRec) const override
Evaluate the sampling density of sample() wrt. solid angles.
virtual Color3f sample(BSDFQueryRecord &bRec, const Point2f &_sample) const override
Sample the BRDF.
Simple exception class, which stores a human-readable error description.
This is an associative container used to supply the constructors of NoriObject subclasses with parame...
float getFloat(const std::string &name) const
Get a float property, and throw an exception if it does not exist.
Color3f getColor(const std::string &name) const
Get a color property, and throw an exception if it does not exist.
Convenience data structure used to pass multiple parameters to the evaluation and sampling routines i...
Represents a linear RGB color value.
std::string toString() const
Return a human-readable string summary.
static float tanTheta(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the tangent of the angle ...
static float cosTheta(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the cosine of the angle b...
3-dimensional surface normal representation