dielectric sampling bugfix
parent
6895a556ec
commit
7ab003c306
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue