Missing sqrtf in beckman's sample function (issue196043)


aco...@...
 

Reviewers: osl-dev_googlegroups.com,

Description:
There was a problem with the sample function in beckman closure. A
missing sqrt for sampling the tangent of theta. It was preventing
reflections from getting the right blur. This patch fixes the problem.

Please review this at http://codereview.appspot.com/196043/show

Affected files:
src/liboslexec/bsdf_microfacet.cpp


Index: src/liboslexec/bsdf_microfacet.cpp
===================================================================
--- src/liboslexec/bsdf_microfacet.cpp (revision 551)
+++ src/liboslexec/bsdf_microfacet.cpp (working copy)
@@ -374,7 +374,7 @@ public:
// we take advantage of cos(atan(x)) == 1/sqrt(1+x^2)
// and sin(atan(x)) == x/sqrt(1+x^2)
float alpha2 = m_ab * m_ab;
- float tanThetaM = -alpha2 * logf(1 - randu);
+ float tanThetaM = sqrtf(-alpha2 * logf(1 - randu));
float cosThetaM = 1 / sqrtf(1 + tanThetaM * tanThetaM);
float sinThetaM = cosThetaM * tanThetaM;
float phiM = 2 * float(M_PI) * randv;

Join osl-dev@lists.aswf.io to automatically receive all group messages.