dielectric bugfixes

metadata
Wenzel Jakob 2011-04-10 22:09:52 +02:00
parent c5669acde3
commit 227a95c76f
1 changed files with 5 additions and 5 deletions

View File

@ -135,8 +135,8 @@ public:
inline Spectrum sample(BSDFQueryRecord &bRec, const Point2 &sample) const {
Float pdf=1;
Spectrum spec = Dielectric::sample(bRec, pdf, sample);
if (pdf == 0)
return spec;
if (pdf == 0 || spec.isZero())
return Spectrum(0.0f);
return spec/pdf;
}
@ -175,17 +175,17 @@ public:
bRec.sampledComponent = 0;
bRec.sampledType = EDeltaReflection;
pdf = std::abs(Frame::cosTheta(bRec.wo));
return m_reflectance * (fr * std::abs(1.0f/Frame::cosTheta(bRec.wo)));
return m_reflectance * fr;
} else if (sampleTransmission) {
bRec.sampledComponent = 1;
bRec.sampledType = EDeltaTransmission;
pdf = std::abs(Frame::cosTheta(bRec.wo));
Float result = refract(m_intIOR, m_extIOR, bRec.wi, bRec.wo, bRec.quantity);
pdf = std::abs(Frame::cosTheta(bRec.wo));
if (result == 0)
return Spectrum(0.0f);
return m_transmittance * (result * (1-fr) * std::abs(1.0f/Frame::cosTheta(bRec.wo)));
return m_transmittance * result * (1-fr);
}
return Spectrum(0.0f);
}