bugfixes to the coating material
parent
1adfc11099
commit
0175931ed3
|
@ -2,15 +2,6 @@
|
||||||
to be tested for consistency. This is done
|
to be tested for consistency. This is done
|
||||||
using the testcase 'test_chisquare' -->
|
using the testcase 'test_chisquare' -->
|
||||||
<scene version="0.3.0">
|
<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 -->
|
<!-- Test the coating model with the Hanrahan-Krueger model -->
|
||||||
<bsdf type="coating">
|
<bsdf type="coating">
|
||||||
<bsdf type="hk">
|
<bsdf type="hk">
|
||||||
|
@ -201,4 +192,12 @@
|
||||||
</bsdf>
|
</bsdf>
|
||||||
</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>
|
</scene>
|
||||||
|
|
|
@ -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.
|
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.
|
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.
|
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.
|
it uses is courtesy of Bernhard Vogl.
|
||||||
|
|
||||||
The included index of refraction data files for conductors are copied from
|
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
|
X-Ray Optics (CXRO) at Berkeley and the Lawrence Livermore National
|
||||||
Laboratory (LLNL).
|
Laboratory (LLNL).
|
||||||
|
|
||||||
The following people have contributed code or bugfixes:
|
The following people have kindly contributed code or bugfixes:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item Milo\^{s} Ha\^{s}an
|
\item Milo\^{s} Ha\^{s}an
|
||||||
\item Tom Kazimiers
|
\item Tom Kazimiers
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
MTS_NAMESPACE_BEGIN
|
MTS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
/*! \plugin{bump}{Bump map}
|
/*! \plugin{bump}{Bump map modifier}
|
||||||
* \icon{bsdf_bump}
|
* \icon{bsdf_bump}
|
||||||
*
|
*
|
||||||
* \parameters{
|
* \parameters{
|
||||||
|
|
|
@ -236,9 +236,8 @@ public:
|
||||||
if (R12 == 1 || R21 == 1) /* Total internal reflection */
|
if (R12 == 1 || R21 == 1) /* Total internal reflection */
|
||||||
return Spectrum(0.0f);
|
return Spectrum(0.0f);
|
||||||
|
|
||||||
Float eta = m_extIOR / m_intIOR;
|
|
||||||
Spectrum result = m_nested->eval(bRecInt, measure)
|
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;
|
Spectrum sigmaA = m_sigmaA->getValue(bRec.its) * m_thickness;
|
||||||
if (!sigmaA.isZero())
|
if (!sigmaA.isZero())
|
||||||
|
@ -246,9 +245,11 @@ public:
|
||||||
(1/std::abs(Frame::cosTheta(bRecInt.wi)) +
|
(1/std::abs(Frame::cosTheta(bRecInt.wi)) +
|
||||||
1/std::abs(Frame::cosTheta(bRecInt.wo)))).exp();
|
1/std::abs(Frame::cosTheta(bRecInt.wo)))).exp();
|
||||||
|
|
||||||
if (measure == ESolidAngle)
|
if (measure == ESolidAngle) {
|
||||||
result *= std::abs(Frame::cosTheta(bRec.wo)
|
Float eta = m_extIOR / m_intIOR;
|
||||||
|
result *= eta * eta * std::abs(Frame::cosTheta(bRec.wo)
|
||||||
/ Frame::cosTheta(bRecInt.wo));
|
/ Frame::cosTheta(bRecInt.wo));
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -284,12 +285,12 @@ public:
|
||||||
|
|
||||||
Float pdf = m_nested->pdf(bRecInt, measure);
|
Float pdf = m_nested->pdf(bRecInt, measure);
|
||||||
|
|
||||||
if (measure == ESolidAngle)
|
if (measure == ESolidAngle) {
|
||||||
pdf *= std::abs(Frame::cosTheta(bRec.wo)
|
|
||||||
/ Frame::cosTheta(bRecInt.wo));
|
|
||||||
|
|
||||||
Float eta = m_extIOR / m_intIOR;
|
Float eta = m_extIOR / m_intIOR;
|
||||||
pdf *= eta * eta;
|
pdf *= eta * eta * std::abs(Frame::cosTheta(bRec.wo)
|
||||||
|
/ Frame::cosTheta(bRecInt.wo));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return sampleSpecular ? (pdf * (1 - probSpecular)) : pdf;
|
return sampleSpecular ? (pdf * (1 - probSpecular)) : pdf;
|
||||||
} else {
|
} else {
|
||||||
|
@ -340,11 +341,11 @@ public:
|
||||||
bRec.wi = wiPrime;
|
bRec.wi = wiPrime;
|
||||||
Spectrum result = m_nested->sample(bRec, pdf, sample);
|
Spectrum result = m_nested->sample(bRec, pdf, sample);
|
||||||
bRec.wi = wiBackup;
|
bRec.wi = wiBackup;
|
||||||
Vector woPrime = bRec.wo;
|
|
||||||
|
|
||||||
if (result.isZero())
|
if (result.isZero())
|
||||||
return Spectrum(0.0f);
|
return Spectrum(0.0f);
|
||||||
|
|
||||||
|
Vector woPrime = bRec.wo;
|
||||||
|
|
||||||
Spectrum sigmaA = m_sigmaA->getValue(bRec.its) * m_thickness;
|
Spectrum sigmaA = m_sigmaA->getValue(bRec.its) * m_thickness;
|
||||||
if (!sigmaA.isZero())
|
if (!sigmaA.isZero())
|
||||||
result *= (-sigmaA *
|
result *= (-sigmaA *
|
||||||
|
@ -353,14 +354,16 @@ public:
|
||||||
|
|
||||||
Float R21;
|
Float R21;
|
||||||
bRec.wo = refractTo(EExterior, woPrime, R21);
|
bRec.wo = refractTo(EExterior, woPrime, R21);
|
||||||
|
|
||||||
if (R21 == 1.0f) /* Total internal reflection */
|
if (R21 == 1.0f) /* Total internal reflection */
|
||||||
return Spectrum(0.0f);
|
return Spectrum(0.0f);
|
||||||
|
|
||||||
|
Float commonTerms = 1.0f;
|
||||||
|
|
||||||
|
if (BSDF::getMeasure(bRec.sampledType) == ESolidAngle) {
|
||||||
Float eta = m_extIOR / m_intIOR;
|
Float eta = m_extIOR / m_intIOR;
|
||||||
bool sampledSA = (BSDF::getMeasure(bRec.sampledType) == ESolidAngle);
|
commonTerms = eta*eta *
|
||||||
Float cosRatio = std::abs(Frame::cosTheta(bRec.wo) / Frame::cosTheta(woPrime)),
|
std::abs(Frame::cosTheta(bRec.wo) / Frame::cosTheta(woPrime));
|
||||||
commonTerms = (sampledSA ? cosRatio : 1.0f) * eta * eta;
|
}
|
||||||
|
|
||||||
pdf *= (sampleSpecular ? (1 - probSpecular) : 1.0f) * commonTerms;
|
pdf *= (sampleSpecular ? (1 - probSpecular) : 1.0f) * commonTerms;
|
||||||
result *= (1 - R12) * (1 - R21) * commonTerms;
|
result *= (1 - R12) * (1 - R21) * commonTerms;
|
||||||
|
|
|
@ -132,8 +132,8 @@ public:
|
||||||
|
|
||||||
if (f.isZero() || pdfVal == 0 || pdfVal2 == 0) {
|
if (f.isZero() || pdfVal == 0 || pdfVal2 == 0) {
|
||||||
if (!sampled.isZero())
|
if (!sampled.isZero())
|
||||||
Log(EWarn, "Inconsistency (1): f=%s, f2=%s, pdf=%f, pdf2=%f, sampled f/pdf=%s, bRec=%s",
|
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());
|
f.toString().c_str(), f2.toString().c_str(), pdfVal, pdfVal2, sampled.toString().c_str(), bRec.toString().c_str(), measure);
|
||||||
#if defined(MTS_DEBUG_FP)
|
#if defined(MTS_DEBUG_FP)
|
||||||
disableFPExceptions();
|
disableFPExceptions();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue