volpath_simple: render images correctly matching maxDepth when delta bounces are involved

metadata
Wenzel Jakob 2010-11-25 16:01:48 +01:00
parent 80c0f932b3
commit e00a9477db
1 changed files with 10 additions and 4 deletions

View File

@ -53,9 +53,9 @@ public:
intersection has already been provided). */ intersection has already been provided). */
rRec.rayIntersect(ray); rRec.rayIntersect(ray);
Spectrum pathThroughput(1.0f); Spectrum pathThroughput(1.0f);
bool computeIntersection = false; bool computeIntersection = false, deltaBounce = false;
while (rRec.depth < m_maxDepth || m_maxDepth < 0) { while (rRec.depth < m_maxDepth || m_maxDepth < 0 || (rRec.depth == m_maxDepth && deltaBounce)) {
if (computeIntersection) if (computeIntersection)
scene->rayIntersect(ray, its); scene->rayIntersect(ray, its);
@ -114,8 +114,10 @@ public:
- the current query asks for single scattering - the current query asks for single scattering
*/ */
rRec.type = RadianceQueryRecord::ERadianceNoEmission; rRec.type = RadianceQueryRecord::ERadianceNoEmission;
deltaBounce = false;
} else { } else {
rRec.type = RadianceQueryRecord::ERadiance; rRec.type = RadianceQueryRecord::ERadiance;
deltaBounce = true;
} }
} }
@ -190,10 +192,12 @@ public:
if (!(rRec.type & RadianceQueryRecord::EIndirectRadiance)) { if (!(rRec.type & RadianceQueryRecord::EIndirectRadiance)) {
/* Stop if indirect illumination was not requested (except: sampled a delta BSDF /* Stop if indirect illumination was not requested (except: sampled a delta BSDF
- look for emitted radiance only) */ - look for emitted radiance only) */
if (bRec.sampledType & BSDF::EDelta) if (bRec.sampledType & BSDF::EDelta) {
deltaBounce = true;
rRec.type = RadianceQueryRecord::EEmittedRadiance; rRec.type = RadianceQueryRecord::EEmittedRadiance;
else } else {
break; break;
}
} else { } else {
if (!(bRec.sampledType & BSDF::EDelta) || !(rRec.type & RadianceQueryRecord::EDirectRadiance)) { if (!(bRec.sampledType & BSDF::EDelta) || !(rRec.type & RadianceQueryRecord::EDirectRadiance)) {
/* Emitted radiance is only included in the recursive query if: /* Emitted radiance is only included in the recursive query if:
@ -201,8 +205,10 @@ public:
- the current query asks for direct illumination - the current query asks for direct illumination
*/ */
rRec.type = RadianceQueryRecord::ERadianceNoEmission; rRec.type = RadianceQueryRecord::ERadianceNoEmission;
deltaBounce = false;
} else { } else {
rRec.type = RadianceQueryRecord::ERadiance; rRec.type = RadianceQueryRecord::ERadiance;
deltaBounce = true;
} }
} }