Commit a8c3616c authored by Matt Pharr's avatar Matt Pharr

Fix masking-shadowing term in Disney BSDF

parent b8801291
......@@ -55,7 +55,7 @@ class MicrofacetDistribution {
// if (Dot(w, wh) * CosTheta(w) < 0.) return 0.;
return 1 / (1 + Lambda(w));
}
Float G(const Vector3f &wo, const Vector3f &wi) const {
virtual Float G(const Vector3f &wo, const Vector3f &wi) const {
return 1 / (1 + Lambda(wo) + Lambda(wi));
}
virtual Vector3f Sample_wh(const Vector3f &wo, const Point2f &u) const = 0;
......
......@@ -345,6 +345,20 @@ class DisneyFresnel : public Fresnel {
const Float metallic, eta;
};
///////////////////////////////////////////////////////////////////////////
// DisneyMicrofacetDistribution
class DisneyMicrofacetDistribution : public TrowbridgeReitzDistribution {
public:
DisneyMicrofacetDistribution(Float alphax, Float alphay)
: TrowbridgeReitzDistribution(alphax, alphay) {}
Float G(const Vector3f &wo, const Vector3f &wi) const {
// Disney uses the separable masking-shadowing model.
return G1(wo) * G1(wo);
}
};
///////////////////////////////////////////////////////////////////////////
// DisneyBSSRDF
......@@ -529,7 +543,7 @@ void DisneyMaterial::ComputeScatteringFunctions(SurfaceInteraction *si,
Float ax = std::max(Float(.001), sqr(rough) / aspect);
Float ay = std::max(Float(.001), sqr(rough) * aspect);
MicrofacetDistribution *distrib =
ARENA_ALLOC(arena, TrowbridgeReitzDistribution)(ax, ay);
ARENA_ALLOC(arena, DisneyMicrofacetDistribution)(ax, ay);
// Specular is Trowbridge-Reitz with a modified Fresnel function.
Float specTint = specularTint->Evaluate(*si);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment