diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-28 16:18:12 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-28 16:18:12 +0400 |
commit | e12adeb8c98d0ef211aba2cb5c0e87ff775fe217 (patch) | |
tree | 3a4381971596645f55401490e19a3672b28745ec /intern/cycles/render/buffers.cpp | |
parent | ed61bfc9a6580360805a3daae1003df43a7f2c11 (diff) |
Fix #30551: cycles passes combining did not always give identical result combined
with antialiasing/defocus, now divide out color at the very end instead of for each
sample.
Diffstat (limited to 'intern/cycles/render/buffers.cpp')
-rw-r--r-- | intern/cycles/render/buffers.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index da0453e5822..62a322b3a0f 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -173,13 +173,37 @@ bool RenderBuffers::get_pass(PassType type, float exposure, int sample, int comp else if(components == 3) { assert(pass.components == 4); - /* RGB/vector */ - for(int i = 0; i < size; i++, in += pass_stride, pixels += 3) { - float3 f = make_float3(in[0], in[1], in[2]); + if(pass.divide_type != PASS_NONE) { + /* RGB lighting passes that need to divide out color */ + pass_offset = 0; + foreach(Pass& color_pass, params.passes) { + if(color_pass.type == pass.divide_type) + break; + pass_offset += color_pass.components; + } + + float *in_divide = (float*)buffer.data_pointer + pass_offset; + + for(int i = 0; i < size; i++, in += pass_stride, in_divide += pass_stride, pixels += 3) { + float3 f = make_float3(in[0], in[1], in[2]); + float3 f_divide = make_float3(in_divide[0], in_divide[1], in_divide[2]); + + f = safe_divide_color(f*exposure, f_divide); + + pixels[0] = f.x; + pixels[1] = f.y; + pixels[2] = f.z; + } + } + else { + /* RGB/vector */ + for(int i = 0; i < size; i++, in += pass_stride, pixels += 3) { + float3 f = make_float3(in[0], in[1], in[2]); - pixels[0] = f.x*scale_exposure; - pixels[1] = f.y*scale_exposure; - pixels[2] = f.z*scale_exposure; + pixels[0] = f.x*scale_exposure; + pixels[1] = f.y*scale_exposure; + pixels[2] = f.z*scale_exposure; + } } } else if(components == 4) { |