diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2019-05-31 23:38:50 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2019-06-01 01:45:03 +0300 |
commit | cc600de6695a241dd9b0de275656b5a7459552dc (patch) | |
tree | 6111f7469b75ae24a4a93a8109af3c3d233db722 /intern/cycles/render/buffers.cpp | |
parent | d5b813301a81a7ec13996dfcb3a9bc88f56e4018 (diff) |
Cycles Denoising: Get rid of halos around bright edges
Previously, bright edges (e.g. caused by rim lighting) would sometimes get
halos around them after denoising.
This change introduces a log(1+x) highlight compression step that is performed
before denoising and reversed afterwards. That way, the denoising algorithm
itself operates in the compressed space and therefore bright edges cause less
numerical issues.
Diffstat (limited to 'intern/cycles/render/buffers.cpp')
-rw-r--r-- | intern/cycles/render/buffers.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index 5405aaefc1d..ad3827df7e3 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -217,9 +217,14 @@ bool RenderBuffers::get_denoising_pass_rect( float *in_combined = buffer.data(); for (int i = 0; i < size; i++, in += pass_stride, in_combined += pass_stride, pixels += 4) { - pixels[0] = in[0] * scale; - pixels[1] = in[1] * scale; - pixels[2] = in[2] * scale; + float3 val = make_float3(in[0], in[1], in[2]); + if (type == DENOISING_PASS_PREFILTERED_COLOR && params.denoising_prefiltered_pass) { + /* Remove highlight compression from the image. */ + val = color_highlight_uncompress(val); + } + pixels[0] = val.x * scale; + pixels[1] = val.y * scale; + pixels[2] = val.z * scale; pixels[3] = saturate(in_combined[3] * alpha_scale); } } |