提交 44739874 编写于 作者: M Matt Pharr

Fix rare NaN case in T-R microfacet D() method

上级 8f688d1c
......@@ -155,8 +155,10 @@ class TrowbridgeReitzDistribution {
PBRT_CPU_GPU inline Float D(const Vector3f &wm) const {
Float tan2Theta = Tan2Theta(wm);
if (std::isinf(tan2Theta))
return 0.;
return 0;
Float cos4Theta = Cos2Theta(wm) * Cos2Theta(wm);
if (cos4Theta == 0)
return 0;
Float e = (Cos2Phi(wm) / Sqr(alpha_x) + Sin2Phi(wm) / Sqr(alpha_y)) * tan2Theta;
return 1 / (Pi * alpha_x * alpha_y * cos4Theta * Sqr(1 + e));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册