fixed a photonmapper regression involving environment maps
parent
7bd2d3ecae
commit
feb303d639
|
@ -197,9 +197,9 @@ public:
|
||||||
SamplingIntegrator::configureSampler(scene, sampler);
|
SamplingIntegrator::configureSampler(scene, sampler);
|
||||||
if (m_directSamples > 1)
|
if (m_directSamples > 1)
|
||||||
sampler->request2DArray(m_directSamples);
|
sampler->request2DArray(m_directSamples);
|
||||||
int glossySamples = std::max(m_directSamples, m_glossySamples);
|
int bsdfSamples = std::max(m_directSamples, m_glossySamples);
|
||||||
if (glossySamples > 1)
|
if (bsdfSamples > 1)
|
||||||
sampler->request2DArray(glossySamples);
|
sampler->request2DArray(bsdfSamples);
|
||||||
|
|
||||||
if (scene->getMedia().size() == 0)
|
if (scene->getMedia().size() == 0)
|
||||||
m_volumePhotons = 0;
|
m_volumePhotons = 0;
|
||||||
|
@ -442,7 +442,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bsdfType & BSDF::EDelta) && (bsdfType & ~BSDF::EDelta) == 0 && rRec.depth < m_maxSpecularDepth && !cacheQuery) {
|
if ((bsdfType & BSDF::EDelta) && (bsdfType & ~BSDF::EDelta) == 0 && rRec.depth < m_maxSpecularDepth && !cacheQuery) {
|
||||||
if (RadianceQueryRecord::EIndirectSurfaceRadiance) {
|
if (rRec.type & RadianceQueryRecord::EIndirectSurfaceRadiance) {
|
||||||
int compCount = bsdf->getComponentCount();
|
int compCount = bsdf->getComponentCount();
|
||||||
RadianceQueryRecord rRec2;
|
RadianceQueryRecord rRec2;
|
||||||
for (int i=0; i<compCount; i++) {
|
for (int i=0; i<compCount; i++) {
|
||||||
|
@ -493,6 +493,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectSamplingRecord dRec(its);
|
DirectSamplingRecord dRec(its);
|
||||||
|
if (bsdf->getType() & BSDF::ESmooth) {
|
||||||
for (int i=0; i<numEmitterSamples; ++i) {
|
for (int i=0; i<numEmitterSamples; ++i) {
|
||||||
int interactions = m_maxDepth - rRec.depth - 1;
|
int interactions = m_maxDepth - rRec.depth - 1;
|
||||||
Spectrum value = scene->sampleAttenuatedEmitterDirect(
|
Spectrum value = scene->sampleAttenuatedEmitterDirect(
|
||||||
|
@ -524,6 +525,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ==================================================================== */
|
/* ==================================================================== */
|
||||||
/* BSDF sampling */
|
/* BSDF sampling */
|
||||||
|
@ -550,9 +552,6 @@ public:
|
||||||
/* Trace a ray in this direction */
|
/* Trace a ray in this direction */
|
||||||
RayDifferential bsdfRay(its.p, its.toWorld(bRec.wo), ray.time);
|
RayDifferential bsdfRay(its.p, its.toWorld(bRec.wo), ray.time);
|
||||||
|
|
||||||
rRec2.recursiveQuery(rRec,
|
|
||||||
RadianceQueryRecord::ERadianceNoEmission);
|
|
||||||
|
|
||||||
Spectrum value;
|
Spectrum value;
|
||||||
bool hitEmitter = false;
|
bool hitEmitter = false;
|
||||||
if (scene->rayIntersect(bsdfRay, bsdfIts)) {
|
if (scene->rayIntersect(bsdfRay, bsdfIts)) {
|
||||||
|
@ -567,17 +566,12 @@ public:
|
||||||
const Emitter *env = scene->getEnvironmentEmitter();
|
const Emitter *env = scene->getEnvironmentEmitter();
|
||||||
|
|
||||||
if (env) {
|
if (env) {
|
||||||
value = env->evalEnvironment(ray);
|
value = env->evalEnvironment(bsdfRay);
|
||||||
if (env->fillDirectSamplingRecord(dRec, ray))
|
if (env->fillDirectSamplingRecord(dRec, bsdfRay))
|
||||||
hitEmitter = true;
|
hitEmitter = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (its.isMediumTransition())
|
|
||||||
rRec2.medium = its.getTargetMedium(bsdfRay.d);
|
|
||||||
|
|
||||||
rRec2.type ^= RadianceQueryRecord::EIntersection;
|
|
||||||
|
|
||||||
if (hitEmitter) {
|
if (hitEmitter) {
|
||||||
const Float emitterPdf = (!(bRec.sampledType & BSDF::EDelta)) ?
|
const Float emitterPdf = (!(bRec.sampledType & BSDF::EDelta)) ?
|
||||||
scene->pdfEmitterDirect(dRec) : 0;
|
scene->pdfEmitterDirect(dRec) : 0;
|
||||||
|
@ -592,9 +586,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recurse */
|
/* Recurse */
|
||||||
if (!isDiffuse && (rRec.type & RadianceQueryRecord::EIndirectSurfaceRadiance) && !cacheQuery)
|
if (!isDiffuse && (rRec.type & RadianceQueryRecord::EIndirectSurfaceRadiance) && !cacheQuery) {
|
||||||
|
rRec2.recursiveQuery(rRec,
|
||||||
|
RadianceQueryRecord::ERadianceNoEmission);
|
||||||
|
rRec2.type ^= RadianceQueryRecord::EIntersection;
|
||||||
|
|
||||||
|
if (its.isMediumTransition())
|
||||||
|
rRec2.medium = its.getTargetMedium(bsdfRay.d);
|
||||||
|
|
||||||
LiSurf += bsdfVal * m_parentIntegrator->Li(bsdfRay, rRec2) * weightBSDF;
|
LiSurf += bsdfVal * m_parentIntegrator->Li(bsdfRay, rRec2) * weightBSDF;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (true)
|
||||||
|
return LiSurf;
|
||||||
} else if (!isDiffuse && (rRec.type & RadianceQueryRecord::EIndirectSurfaceRadiance) && !cacheQuery) {
|
} else if (!isDiffuse && (rRec.type & RadianceQueryRecord::EIndirectSurfaceRadiance) && !cacheQuery) {
|
||||||
int numBSDFSamples = (rRec.depth > 1 || adaptiveQuery) ? 1 : m_glossySamples;
|
int numBSDFSamples = (rRec.depth > 1 || adaptiveQuery) ? 1 : m_glossySamples;
|
||||||
Float weightBSDF;
|
Float weightBSDF;
|
||||||
|
|
Loading…
Reference in New Issue