fixed suboptimal sampling when using roughdielectric with the phong microfacet distribution (reported by Benedikt Bitterli)
parent
4763f7016a
commit
3b1f6dc257
|
@ -384,10 +384,8 @@ public:
|
||||||
H *= math::signum(Frame::cosTheta(H));
|
H *= math::signum(Frame::cosTheta(H));
|
||||||
|
|
||||||
/* Evaluate the roughness */
|
/* Evaluate the roughness */
|
||||||
Float alphaU = m_distribution.transformRoughness(
|
Float alphaU = m_alphaU->eval(bRec.its).average(),
|
||||||
m_alphaU->eval(bRec.its).average()),
|
alphaV = m_alphaV->eval(bRec.its).average();
|
||||||
alphaV = m_distribution.transformRoughness(
|
|
||||||
m_alphaV->eval(bRec.its).average());
|
|
||||||
|
|
||||||
#if ENLARGE_LOBE_TRICK == 1
|
#if ENLARGE_LOBE_TRICK == 1
|
||||||
Float factor = (1.2f - 0.2f * std::sqrt(
|
Float factor = (1.2f - 0.2f * std::sqrt(
|
||||||
|
@ -395,6 +393,9 @@ public:
|
||||||
alphaU *= factor; alphaV *= factor;
|
alphaU *= factor; alphaV *= factor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
alphaU = m_distribution.transformRoughness(alphaU);
|
||||||
|
alphaV = m_distribution.transformRoughness(alphaV);
|
||||||
|
|
||||||
/* Evaluate the microsurface normal sampling density */
|
/* Evaluate the microsurface normal sampling density */
|
||||||
Float prob = m_distribution.pdf(H, alphaU, alphaV);
|
Float prob = m_distribution.pdf(H, alphaU, alphaV);
|
||||||
|
|
||||||
|
@ -419,21 +420,22 @@ public:
|
||||||
return Spectrum(0.0f);
|
return Spectrum(0.0f);
|
||||||
|
|
||||||
/* Evaluate the roughness */
|
/* Evaluate the roughness */
|
||||||
Float alphaU = m_distribution.transformRoughness(
|
Float alphaU = m_alphaU->eval(bRec.its).average(),
|
||||||
m_alphaU->eval(bRec.its).average()),
|
alphaV = m_alphaV->eval(bRec.its).average(),
|
||||||
alphaV = m_distribution.transformRoughness(
|
sampleAlphaU = alphaU,
|
||||||
m_alphaV->eval(bRec.its).average());
|
sampleAlphaV = alphaV;
|
||||||
|
|
||||||
#if ENLARGE_LOBE_TRICK == 1
|
#if ENLARGE_LOBE_TRICK == 1
|
||||||
Float factor = (1.2f - 0.2f * std::sqrt(
|
Float factor = (1.2f - 0.2f * std::sqrt(
|
||||||
std::abs(Frame::cosTheta(bRec.wi))));
|
std::abs(Frame::cosTheta(bRec.wi))));
|
||||||
Float sampleAlphaU = alphaU * factor,
|
sampleAlphaU *= factor; sampleAlphaV *= factor;
|
||||||
sampleAlphaV = alphaV * factor;
|
|
||||||
#else
|
|
||||||
Float sampleAlphaU = alphaU,
|
|
||||||
sampleAlphaV = alphaV;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
alphaU = m_distribution.transformRoughness(alphaU);
|
||||||
|
alphaV = m_distribution.transformRoughness(alphaV);
|
||||||
|
sampleAlphaU = m_distribution.transformRoughness(sampleAlphaU);
|
||||||
|
sampleAlphaV = m_distribution.transformRoughness(sampleAlphaV);
|
||||||
|
|
||||||
/* Sample M, the microsurface normal */
|
/* Sample M, the microsurface normal */
|
||||||
Float microfacetPDF;
|
Float microfacetPDF;
|
||||||
const Normal m = m_distribution.sample(sample,
|
const Normal m = m_distribution.sample(sample,
|
||||||
|
@ -510,21 +512,22 @@ public:
|
||||||
return Spectrum(0.0f);
|
return Spectrum(0.0f);
|
||||||
|
|
||||||
/* Evaluate the roughness */
|
/* Evaluate the roughness */
|
||||||
Float alphaU = m_distribution.transformRoughness(
|
Float alphaU = m_alphaU->eval(bRec.its).average(),
|
||||||
m_alphaU->eval(bRec.its).average()),
|
alphaV = m_alphaV->eval(bRec.its).average(),
|
||||||
alphaV = m_distribution.transformRoughness(
|
sampleAlphaU = alphaU,
|
||||||
m_alphaV->eval(bRec.its).average());
|
sampleAlphaV = alphaV;
|
||||||
|
|
||||||
#if ENLARGE_LOBE_TRICK == 1
|
#if ENLARGE_LOBE_TRICK == 1
|
||||||
Float factor = (1.2f - 0.2f * std::sqrt(
|
Float factor = (1.2f - 0.2f * std::sqrt(
|
||||||
std::abs(Frame::cosTheta(bRec.wi))));
|
std::abs(Frame::cosTheta(bRec.wi))));
|
||||||
Float sampleAlphaU = alphaU * factor,
|
sampleAlphaU *= factor; sampleAlphaV *= factor;
|
||||||
sampleAlphaV = alphaV * factor;
|
|
||||||
#else
|
|
||||||
Float sampleAlphaU = alphaU,
|
|
||||||
sampleAlphaV = alphaV;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
alphaU = m_distribution.transformRoughness(alphaU);
|
||||||
|
alphaV = m_distribution.transformRoughness(alphaV);
|
||||||
|
sampleAlphaU = m_distribution.transformRoughness(sampleAlphaU);
|
||||||
|
sampleAlphaV = m_distribution.transformRoughness(sampleAlphaV);
|
||||||
|
|
||||||
/* Sample M, the microsurface normal */
|
/* Sample M, the microsurface normal */
|
||||||
Float microfacetPDF;
|
Float microfacetPDF;
|
||||||
const Normal m = m_distribution.sample(sample,
|
const Normal m = m_distribution.sample(sample,
|
||||||
|
|
Loading…
Reference in New Issue