bugfixes to the coating material

metadata
Wenzel Jakob 2011-07-22 18:43:11 +02:00
parent 1adfc11099
commit 0175931ed3
5 changed files with 34 additions and 32 deletions

View File

@ -2,15 +2,6 @@
to be tested for consistency. This is done
using the testcase 'test_chisquare' -->
<scene version="0.3.0">
<bsdf type="coating">
<bsdf type="mask">
<spectrum name="opacity" value="0.9"/>
<bsdf type="twosided">
<bsdf type="diffuse"/>
</bsdf>
</bsdf>
</bsdf>
<!-- Test the coating model with the Hanrahan-Krueger model -->
<bsdf type="coating">
<bsdf type="hk">
@ -201,4 +192,12 @@
</bsdf>
</bsdf>
<!-- Test the coating model with a material that has
a delta transmission component -->
<bsdf type="coating">
<bsdf type="mask">
<bsdf type="diffuse"/>
<spectrum name="opacity" value="0.5"/>
</bsdf>
</bsdf>
</scene>

View File

@ -3,7 +3,7 @@ The architecture of Mitsuba as well as some individual components are based on i
The architecture of the coherent path tracer traversal code was influenced by Radius from Thierry Berger-Perrin.
Many thanks go to my advisor Steve Marschner, who let me spend time on this project.
Some of the GUI icons were taken from the Humanity icon set by Canonical Ltd.
The material test scene was kindly contributed by Jonas Pilo, and the environment map
The material test scene was created by Jonas Pilo, and the environment map
it uses is courtesy of Bernhard Vogl.
The included index of refraction data files for conductors are copied from
@ -13,7 +13,7 @@ and measurements of atomic scattering factors made by the Center For
X-Ray Optics (CXRO) at Berkeley and the Lawrence Livermore National
Laboratory (LLNL).
The following people have contributed code or bugfixes:
The following people have kindly contributed code or bugfixes:
\begin{itemize}
\item Milo\^{s} Ha\^{s}an
\item Tom Kazimiers

View File

@ -21,7 +21,7 @@
MTS_NAMESPACE_BEGIN
/*! \plugin{bump}{Bump map}
/*! \plugin{bump}{Bump map modifier}
* \icon{bsdf_bump}
*
* \parameters{

View File

@ -236,9 +236,8 @@ public:
if (R12 == 1 || R21 == 1) /* Total internal reflection */
return Spectrum(0.0f);
Float eta = m_extIOR / m_intIOR;
Spectrum result = m_nested->eval(bRecInt, measure)
* ((1-R12) * (1-R21) * eta * eta);
* (1-R12) * (1-R21);
Spectrum sigmaA = m_sigmaA->getValue(bRec.its) * m_thickness;
if (!sigmaA.isZero())
@ -246,9 +245,11 @@ public:
(1/std::abs(Frame::cosTheta(bRecInt.wi)) +
1/std::abs(Frame::cosTheta(bRecInt.wo)))).exp();
if (measure == ESolidAngle)
result *= std::abs(Frame::cosTheta(bRec.wo)
if (measure == ESolidAngle) {
Float eta = m_extIOR / m_intIOR;
result *= eta * eta * std::abs(Frame::cosTheta(bRec.wo)
/ Frame::cosTheta(bRecInt.wo));
}
return result;
}
@ -281,15 +282,15 @@ public:
if (R12 == 1 || R21 == 1) /* Total internal reflection */
return 0.0f;
Float pdf = m_nested->pdf(bRecInt, measure);
if (measure == ESolidAngle)
pdf *= std::abs(Frame::cosTheta(bRec.wo)
/ Frame::cosTheta(bRecInt.wo));
if (measure == ESolidAngle) {
Float eta = m_extIOR / m_intIOR;
pdf *= eta * eta * std::abs(Frame::cosTheta(bRec.wo)
/ Frame::cosTheta(bRecInt.wo));
}
Float eta = m_extIOR / m_intIOR;
pdf *= eta * eta;
return sampleSpecular ? (pdf * (1 - probSpecular)) : pdf;
} else {
@ -340,11 +341,11 @@ public:
bRec.wi = wiPrime;
Spectrum result = m_nested->sample(bRec, pdf, sample);
bRec.wi = wiBackup;
Vector woPrime = bRec.wo;
if (result.isZero())
return Spectrum(0.0f);
Vector woPrime = bRec.wo;
Spectrum sigmaA = m_sigmaA->getValue(bRec.its) * m_thickness;
if (!sigmaA.isZero())
result *= (-sigmaA *
@ -353,14 +354,16 @@ public:
Float R21;
bRec.wo = refractTo(EExterior, woPrime, R21);
if (R21 == 1.0f) /* Total internal reflection */
return Spectrum(0.0f);
Float eta = m_extIOR / m_intIOR;
bool sampledSA = (BSDF::getMeasure(bRec.sampledType) == ESolidAngle);
Float cosRatio = std::abs(Frame::cosTheta(bRec.wo) / Frame::cosTheta(woPrime)),
commonTerms = (sampledSA ? cosRatio : 1.0f) * eta * eta;
Float commonTerms = 1.0f;
if (BSDF::getMeasure(bRec.sampledType) == ESolidAngle) {
Float eta = m_extIOR / m_intIOR;
commonTerms = eta*eta *
std::abs(Frame::cosTheta(bRec.wo) / Frame::cosTheta(woPrime));
}
pdf *= (sampleSpecular ? (1 - probSpecular) : 1.0f) * commonTerms;
result *= (1 - R12) * (1 - R21) * commonTerms;

View File

@ -117,7 +117,7 @@ public:
#endif
Float pdfVal, pdfVal2;
/* Check the various sampling routines for agreement
amongst each other */
m_fakeSampler->clear();
@ -132,8 +132,8 @@ public:
if (f.isZero() || pdfVal == 0 || pdfVal2 == 0) {
if (!sampled.isZero())
Log(EWarn, "Inconsistency (1): f=%s, f2=%s, pdf=%f, pdf2=%f, sampled f/pdf=%s, bRec=%s",
f.toString().c_str(), f2.toString().c_str(), pdfVal, pdfVal2, sampled.toString().c_str(), bRec.toString().c_str());
Log(EWarn, "Inconsistency (1): f=%s, f2=%s, pdf=%f, pdf2=%f, sampled f/pdf=%s, bRec=%s, measure=%i",
f.toString().c_str(), f2.toString().c_str(), pdfVal, pdfVal2, sampled.toString().c_str(), bRec.toString().c_str(), measure);
#if defined(MTS_DEBUG_FP)
disableFPExceptions();
#endif