better computation of the alpha channel when rendering index-matched media

metadata
Wenzel Jakob 2013-01-24 20:06:58 -05:00
parent 6021ee09f9
commit a721b18740
1 changed files with 16 additions and 5 deletions

View File

@ -101,12 +101,23 @@ inline bool RadianceQueryRecord::rayIntersect(const RayDifferential &ray) {
if (type & EIntersection) {
scene->rayIntersect(ray, its);
if (type & EOpacity) {
if (its.isValid())
alpha = 1.0f;
else if (medium == NULL)
int unused = INT_MAX;
if (its.isValid()) {
if (EXPECT_TAKEN(!its.isMediumTransition()))
alpha = 1.0f;
else
alpha = 1-scene->evalTransmittance(its.p, true,
ray(scene->getBSphere().radius*2), false,
ray.time, its.getTargetMedium(ray.d), unused).average();
} else if (medium) {
alpha = 1-scene->evalTransmittance(ray.o, false,
ray(scene->getBSphere().radius*2), false,
ray.time, medium, unused).average();
} else {
alpha = 0.0f;
else
alpha = 1-medium->evalTransmittance(ray).average();
}
}
if (type & EDistance)
dist = its.t;