dielectric bugfixes
parent
c5669acde3
commit
227a95c76f
|
@ -135,8 +135,8 @@ public:
|
||||||
inline Spectrum sample(BSDFQueryRecord &bRec, const Point2 &sample) const {
|
inline Spectrum sample(BSDFQueryRecord &bRec, const Point2 &sample) const {
|
||||||
Float pdf=1;
|
Float pdf=1;
|
||||||
Spectrum spec = Dielectric::sample(bRec, pdf, sample);
|
Spectrum spec = Dielectric::sample(bRec, pdf, sample);
|
||||||
if (pdf == 0)
|
if (pdf == 0 || spec.isZero())
|
||||||
return spec;
|
return Spectrum(0.0f);
|
||||||
return spec/pdf;
|
return spec/pdf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,17 +175,17 @@ public:
|
||||||
bRec.sampledComponent = 0;
|
bRec.sampledComponent = 0;
|
||||||
bRec.sampledType = EDeltaReflection;
|
bRec.sampledType = EDeltaReflection;
|
||||||
pdf = std::abs(Frame::cosTheta(bRec.wo));
|
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) {
|
} else if (sampleTransmission) {
|
||||||
bRec.sampledComponent = 1;
|
bRec.sampledComponent = 1;
|
||||||
bRec.sampledType = EDeltaTransmission;
|
bRec.sampledType = EDeltaTransmission;
|
||||||
pdf = std::abs(Frame::cosTheta(bRec.wo));
|
|
||||||
|
|
||||||
Float result = refract(m_intIOR, m_extIOR, bRec.wi, bRec.wo, bRec.quantity);
|
Float result = refract(m_intIOR, m_extIOR, bRec.wi, bRec.wo, bRec.quantity);
|
||||||
|
pdf = std::abs(Frame::cosTheta(bRec.wo));
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
return Spectrum(0.0f);
|
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);
|
return Spectrum(0.0f);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue