ptracer: better handling of unscattered emission -> camera paths

metadata
Wenzel Jakob 2013-02-11 22:07:00 -05:00
parent f374df4680
commit 979e0fa7a0
2 changed files with 8 additions and 3 deletions

View File

@ -88,8 +88,13 @@ void CaptureParticleWorker::handleEmission(const PositionSamplingRecord &pRec,
DirectSamplingRecord dRec(pRec.p, pRec.time); DirectSamplingRecord dRec(pRec.p, pRec.time);
int maxInteractions = m_maxPathDepth - 1; int maxInteractions = m_maxPathDepth - 1;
/* Create a dummy intersection to ensure that sampleAttenuatedSensorDirect()
treats the light source vertex as being located on a surface */
Intersection its;
its.p = pRec.p;
Spectrum value = weight * m_scene->sampleAttenuatedSensorDirect( Spectrum value = weight * m_scene->sampleAttenuatedSensorDirect(
dRec, medium, maxInteractions, m_sampler->next2D(), m_sampler); dRec, its, medium, maxInteractions, m_sampler->next2D(), m_sampler);
if (value.isZero()) if (value.isZero())
return; return;

View File

@ -881,7 +881,7 @@ Spectrum Scene::sampleAttenuatedEmitterDirect(DirectSamplingRecord &dRec,
Spectrum value = emitter->sampleDirect(dRec, sample); Spectrum value = emitter->sampleDirect(dRec, sample);
if (dRec.pdf != 0) { if (dRec.pdf != 0) {
if (its.isMediumTransition()) if (its.shape && its.isMediumTransition())
medium = its.getTargetMedium(dRec.d); medium = its.getTargetMedium(dRec.d);
value *= evalTransmittance(its.p, true, dRec.p, emitter->isOnSurface(), value *= evalTransmittance(its.p, true, dRec.p, emitter->isOnSurface(),
dRec.time, medium, interactions, sampler) / emPdf; dRec.time, medium, interactions, sampler) / emPdf;
@ -931,7 +931,7 @@ Spectrum Scene::sampleAttenuatedSensorDirect(DirectSamplingRecord &dRec,
Spectrum value = m_sensor->sampleDirect(dRec, sample); Spectrum value = m_sensor->sampleDirect(dRec, sample);
if (dRec.pdf != 0) { if (dRec.pdf != 0) {
if (its.isMediumTransition()) if (its.shape && its.isMediumTransition())
medium = its.getTargetMedium(dRec.d); medium = its.getTargetMedium(dRec.d);
value *= evalTransmittance(its.p, true, dRec.p, m_sensor->isOnSurface(), value *= evalTransmittance(its.p, true, dRec.p, m_sensor->isOnSurface(),
dRec.time, medium, interactions, sampler); dRec.time, medium, interactions, sampler);