提交 83d4c269 编写于 作者: M Matt Pharr

Fix rare NaN case in PowerHeuristic()

If the first PDF was too large, it would become infinity when it was
squared, which in turn would lead to a NaN being returned.
上级 fe1d2fe4
......@@ -70,6 +70,8 @@ PBRT_CPU_GPU inline Float BalanceHeuristic(int nf, Float fPdf, int ng, Float gPd
PBRT_CPU_GPU inline Float PowerHeuristic(int nf, Float fPdf, int ng, Float gPdf) {
Float f = nf * fPdf, g = ng * gPdf;
if (IsInf(Sqr(f)))
return 1;
return Sqr(f) / (Sqr(f) + Sqr(g));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册