mtsgui: handle problematic scenes more gracefully where Mitsuba cannot generate any VPLs

metadata
Wenzel Jakob 2014-07-22 22:45:00 +02:00
parent bb7e922511
commit 455b239c15
2 changed files with 22 additions and 0 deletions

View File

@ -93,10 +93,16 @@ size_t generateVPLs(const Scene *scene, Random *random,
+ sensor->getShutterOpenTime() * sampler->next1D(); + sensor->getShutterOpenTime() * sampler->next1D();
const Frame stdFrame(Vector(1,0,0), Vector(0,1,0), Vector(0,0,1)); const Frame stdFrame(Vector(1,0,0), Vector(0,1,0), Vector(0,0,1));
int retries = 0;
while (vpls.size() < count) { while (vpls.size() < count) {
sampler->setSampleIndex(++offset); sampler->setSampleIndex(++offset);
if (vpls.empty() && ++retries > 10000) {
/* Unable to generate VPLs in this scene -- give up. */
return 0;
}
PositionSamplingRecord pRec(time); PositionSamplingRecord pRec(time);
DirectionSamplingRecord dRec; DirectionSamplingRecord dRec;
Spectrum weight = scene->sampleEmitterPosition(pRec, Spectrum weight = scene->sampleEmitterPosition(pRec,

View File

@ -397,6 +397,22 @@ void PreviewThread::run() {
m_backgroundScaleFactor = m_vplSampleOffset - oldOffset; m_backgroundScaleFactor = m_vplSampleOffset - oldOffset;
} }
if (m_vpls.empty()) {
/* Unable to generate any VPLs for this scene. Give up. */
lock.lock();
target.buffer->activateTarget();
target.buffer->clear();
target.buffer->releaseTarget();
m_accumBuffer = target.buffer;
m_readyQueue.push_back(target);
if (m_useSync)
target.sync->init();
m_queueCV->signal();
lock.unlock();
sleep(100);
continue;
}
VPL vpl = m_vpls.front(); VPL vpl = m_vpls.front();
m_vpls.pop_front(); m_vpls.pop_front();