dielectric sampling bugfix

metadata
Wenzel Jakob 2010-08-13 19:12:43 +02:00
parent 6895a556ec
commit 7ab003c306
1 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@
MTS_NAMESPACE_BEGIN MTS_NAMESPACE_BEGIN
const bool importanceSampleComponents = false; const bool importanceSampleComponents = true;
/** /**
* Models an interface between two materials with non-matched indices of refraction. * Models an interface between two materials with non-matched indices of refraction.
@ -171,7 +171,7 @@ public:
/* Calculate the refracted/reflected vectors+coefficients */ /* Calculate the refracted/reflected vectors+coefficients */
if (sampleTransmission && sampleReflection) { if (sampleTransmission && sampleReflection) {
/* Importance sample according to the reflectance/transmittance */ /* Importance sample according to the reflectance/transmittance */
if (bRec.sample.x < importanceSampleComponents ? fr : 0.5f) { if (bRec.sample.x < (importanceSampleComponents ? fr : 0.5f)) {
reflect(bRec.wi, bRec.wo); reflect(bRec.wi, bRec.wo);
bRec.sampledComponent = 0; bRec.sampledComponent = 0;
bRec.sampledType = EDeltaReflection; bRec.sampledType = EDeltaReflection;
@ -220,7 +220,7 @@ public:
Float result = 0.0f; Float result = 0.0f;
if (sampleTransmission && sampleReflection) { if (sampleTransmission && sampleReflection) {
if (!importanceSampleComponents) { if (!importanceSampleComponents) {
result = 0.f; result = 0.5f;
} else { } else {
Float fr = fresnel(Frame::cosTheta(bRec.wi), m_extIOR, m_intIOR); Float fr = fresnel(Frame::cosTheta(bRec.wi), m_extIOR, m_intIOR);
if (reflection) if (reflection)