volpath: correct attenuation for area lights surrounded by a medium

Previously, volpath did not correctly compute the attenuation to
an area light source when it was embedded inside a participating medium
(i.e. referencing it directly). volpath_simple was unaffected.

It is unlikely that anybody ran into this problem, since it was in fact
not possible to construct such a scene due to an assertion in shape.cpp.
metadata
Wenzel Jakob 2014-06-29 20:25:45 +02:00
parent f395e4c201
commit c81b015cea
2 changed files with 9 additions and 7 deletions

View File

@ -378,14 +378,16 @@ public:
while (true) {
surface = scene->rayIntersect(ray, *its);
if (surface && (interactions == maxInteractions ||
!(its->getBSDF()->getType() & BSDF::ENull)))
/* Encountered an occluder -- zero transmittance. */
break;
if (medium)
transmittance *= medium->evalTransmittance(Ray(ray, 0, its->t), sampler);
if (surface && (interactions == maxInteractions ||
!(its->getBSDF()->getType() & BSDF::ENull) ||
its->isEmitter())) {
/* Encountered an occluder / light source */
break;
}
if (!surface)
break;

View File

@ -156,13 +156,13 @@ void Shape::addChild(const std::string &name, ConfigurableObject *child) {
m_subsurface = static_cast<Subsurface *>(child);
} else if (cClass->derivesFrom(MTS_CLASS(Medium))) {
if (name == "interior") {
Assert(m_interiorMedium == NULL);
Assert(m_interiorMedium == NULL || m_interiorMedium == child);
if (m_subsurface != NULL)
Log(EError, "Shape \"%s\" has both an interior medium "
"and a subsurface scattering model -- please choose one or the other!", getName().c_str());
m_interiorMedium = static_cast<Medium *>(child);
} else if (name == "exterior") {
Assert(m_exteriorMedium == NULL);
Assert(m_exteriorMedium == NULL || m_exteriorMedium == child);
m_exteriorMedium = static_cast<Medium *>(child);
if (m_emitter)
m_emitter->setMedium(m_exteriorMedium);