better computation of the alpha channel when rendering index-matched media
parent
6021ee09f9
commit
a721b18740
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue