mtsgui: handle problematic scenes more gracefully where Mitsuba cannot generate any VPLs
parent
bb7e922511
commit
455b239c15
|
@ -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,
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue