Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2019-05-31 23:38:50 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2019-06-01 01:45:03 +0300
commitcc600de6695a241dd9b0de275656b5a7459552dc (patch)
tree6111f7469b75ae24a4a93a8109af3c3d233db722 /intern/cycles/render/denoising.cpp
parentd5b813301a81a7ec13996dfcb3a9bc88f56e4018 (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/denoising.cpp')
-rw-r--r--intern/cycles/render/denoising.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/intern/cycles/render/denoising.cpp b/intern/cycles/render/denoising.cpp
index 82bbfa5f823..39bd8ce00c2 100644
--- a/intern/cycles/render/denoising.cpp
+++ b/intern/cycles/render/denoising.cpp
@@ -491,6 +491,19 @@ bool DenoiseTask::load_input_pixels(int layer)
}
}
+ /* Highlight compression */
+ data = buffer_data + 8;
+ for (int y = 0; y < h; y++) {
+ for (int x = 0; x < w; x++) {
+ int idx = INPUT_NUM_CHANNELS * (y * w + x);
+ float3 color = make_float3(data[idx], data[idx + 1], data[idx + 2]);
+ color = color_highlight_compress(color, NULL);
+ data[idx] = color.x;
+ data[idx + 1] = color.y;
+ data[idx + 2] = color.z;
+ }
+ }
+
buffer_data += frame_stride;
}