pass direct illumination sampler in the MLT seeding process
parent
1af8453a58
commit
4689d4fb92
|
@ -161,11 +161,6 @@ public:
|
|||
return false;
|
||||
}
|
||||
Log(EInfo, "First MLT stage took %i ms", timer->getMilliseconds());
|
||||
|
||||
std::string debugFile = "mlt_stage1.exr";
|
||||
Log(EInfo, "Writing upsampled luminances to \"%s\"", debugFile.c_str());
|
||||
ref<FileStream> fs = new FileStream(debugFile, FileStream::ETruncReadWrite);
|
||||
m_config.importanceMap->write(Bitmap::EOpenEXR, fs);
|
||||
}
|
||||
|
||||
bool nested = m_config.twoStage && m_config.firstStage;
|
||||
|
@ -193,12 +188,17 @@ public:
|
|||
|
||||
ref<ReplayableSampler> rplSampler = new ReplayableSampler();
|
||||
ref<PathSampler> pathSampler = new PathSampler(PathSampler::EBidirectional, scene,
|
||||
rplSampler, rplSampler, NULL, m_config.maxDepth, 10,
|
||||
rplSampler, rplSampler, rplSampler, m_config.maxDepth, 10,
|
||||
m_config.separateDirect, true);
|
||||
|
||||
|
||||
std::vector<PathSeed> pathSeeds;
|
||||
ref<MLTProcess> process = new MLTProcess(job, queue,
|
||||
m_config, directImage, pathSeeds);
|
||||
|
||||
m_config.luminance = pathSampler->generateSeeds(m_config.luminanceSamples,
|
||||
m_config.workUnits, false, pathSeeds);
|
||||
|
||||
pathSeeds.clear();
|
||||
|
||||
m_config.luminance = pathSampler->generateSeeds(m_config.luminanceSamples,
|
||||
m_config.workUnits, true, pathSeeds);
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
static_cast<Sampler *>(getResource("rplSampler"))->clone().get());
|
||||
|
||||
m_pathSampler = new PathSampler(PathSampler::EBidirectional, m_scene,
|
||||
m_rplSampler, m_rplSampler, NULL, m_config.maxDepth, 10,
|
||||
m_rplSampler, m_rplSampler, m_rplSampler, m_config.maxDepth, 10,
|
||||
m_config.separateDirect, true);
|
||||
|
||||
m_pool = &m_pathSampler->getMemoryPool();
|
||||
|
|
|
@ -474,6 +474,14 @@ void PathSampler::samplePaths(const Point2i &offset, PathCallback &callback) {
|
|||
PathEdge connectionEdge;
|
||||
m_connectionSubpath.collapseTo(connectionEdge);
|
||||
|
||||
/* Account for the terms of the measurement contribution
|
||||
function that are coupled to the connection edge */
|
||||
if (!sampleDirect)
|
||||
value *= connectionEdge.evalCached(vs, vt, PathEdge::EGeneralizedGeometricTerm);
|
||||
else
|
||||
value *= connectionEdge.evalCached(vs, vt, PathEdge::ETransmittance |
|
||||
(s == 1 ? PathEdge::ECosineRad : PathEdge::ECosineImp));
|
||||
|
||||
if (sampleDirect) {
|
||||
/* A direct sampling strategy was used, which generated
|
||||
two new vertices at one of the path ends. Temporarily
|
||||
|
@ -488,14 +496,6 @@ void PathSampler::samplePaths(const Point2i &offset, PathCallback &callback) {
|
|||
value *= Path::miWeight(m_scene, m_emitterSubpath, &connectionEdge,
|
||||
m_sensorSubpath, s, t, m_sampleDirect, m_lightImage);
|
||||
|
||||
/* Account for the terms of the measurement contribution
|
||||
function that are coupled to the connection edge */
|
||||
if (!sampleDirect)
|
||||
value *= connectionEdge.evalCached(vs, vt, PathEdge::EGeneralizedGeometricTerm);
|
||||
else
|
||||
value *= connectionEdge.evalCached(vs, vt, PathEdge::ETransmittance |
|
||||
(s == 1 ? PathEdge::ECosineRad : PathEdge::ECosineImp));
|
||||
|
||||
if (!value.isZero()) {
|
||||
int k = (int) m_connectionSubpath.vertexCount();
|
||||
/* Construct the full path, make a temporary backup copy of the connection vertices */
|
||||
|
|
Loading…
Reference in New Issue