Fix: ensure cycles mist pass stays in range 0..1, it could have values out of

this range due to sampling noise.

Side note: I looked into the mist pass because it was apparently not calculating
mist correctly on characters with transparent hair. Turns out this is just
sampling noise that goes away with more samples.

This noise is because the ray will randomly go to the next transparency layer or
get reflected, the path tracing integrator will not branch the path and only pick
one of the two directions each time.

Branched path tracing however will shade all transparent layers for each AA
sample, which means this source of noise is eliminated.
This commit is contained in:
Brecht Van Lommel 2013-10-18 23:44:25 +00:00
parent 3887d33374
commit 4ecfb215e2

@ -184,6 +184,12 @@ bool RenderBuffers::get_pass_rect(PassType type, float exposure, int sample, int
pixels[0] = (f == 0.0f)? 1e10f: f*scale_exposure;
}
}
else if(type == PASS_MIST) {
for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
float f = *in;
pixels[0] = clamp(f*scale_exposure, 0.0f, 1.0f);
}
}
else {
for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
float f = *in;