Implement Beckmann microfacet distribution model
abusch opened this issue · 1 comments
abusch commented
I think I've got this one in rustracer too.
wahn commented
In C++ (that's what we need in the Rust counterpart):
class BeckmannDistribution : public MicrofacetDistribution {
public:
// BeckmannDistribution Public Methods
static Float RoughnessToAlpha(Float roughness) {
roughness = std::max(roughness, (Float)1e-3);
Float x = std::log(roughness);
return 1.62142f + 0.819955f * x + 0.1734f * x * x +
0.0171201f * x * x * x + 0.000640711f * x * x * x * x;
}
BeckmannDistribution(Float alphax, Float alphay, bool samplevis = true)
: MicrofacetDistribution(samplevis), alphax(alphax), alphay(alphay) {}
Float D(const Vector3f &wh) const;
Vector3f Sample_wh(const Vector3f &wo, const Point2f &u) const;
std::string ToString() const;
private:
// BeckmannDistribution Private Methods
Float Lambda(const Vector3f &w) const;
// BeckmannDistribution Private Data
const Float alphax, alphay;
};