More numerical robustness for microfacet
parent
ce80ddcb6d
commit
8390e5ff5a
|
@ -460,6 +460,8 @@ public:
|
|||
|
||||
/// Implements the probability density of the function \ref sampleVisible()
|
||||
Float pdfVisible(const Vector &wi, const Vector &m) const {
|
||||
if(Frame::cosTheta(wi) == 0)
|
||||
return 0.0f;
|
||||
return smithG1(wi, m) * absDot(wi, m) * eval(m) / std::abs(Frame::cosTheta(wi));
|
||||
}
|
||||
|
||||
|
@ -501,7 +503,7 @@ public:
|
|||
|
||||
case EGGX: {
|
||||
Float root = alpha * tanTheta;
|
||||
return 2.0f / (1.0f + std::sqrt(1.0f + root*root));
|
||||
return 2.0f / (1.0f + math::hypot2((Float) 1.0f, root));
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ public:
|
|||
}
|
||||
|
||||
Spectrum eval(const BSDFSamplingRecord &bRec, EMeasure measure) const {
|
||||
if (measure != ESolidAngle)
|
||||
if (measure != ESolidAngle || Frame::cosTheta(bRec.wi) == 0)
|
||||
return Spectrum(0.0f);
|
||||
|
||||
/* Determine the type of interaction */
|
||||
|
|
Loading…
Reference in New Issue