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 <lukasstockner97>2019-11-27 23:22:55 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2019-11-27 23:26:47 +0300
commit4659fa547166b589cc8e3aef4b8dc699d95547df (patch)
tree908e87f5a75b6a6a4ad9783861cf2fadc14dc55c /intern/cycles/kernel/kernel_passes.h
parent7711231838e726055c6690757f3799dff90bfd96 (diff)
Cycles: Scale denoising albedo contribution of Principled BSDFs according to average fresnel
The Principled BSDF uses Microfacet closures that include a fresnel term, which are a special case since their weight tends to be near white even if their average contribution is fairly low. The sample weight is scaled by the average fresnel weight to account for this, but the denoising albedo still used the unscaled weight. This was fine for the original denoiser, but apparently OIDN can't handle the resulting albedo pass well. Therefore, this commit adds the described scaling to the albedo pass contribution as well. This problem was described in T69770. Reviewed By: brecht Differential Revision: https://developer.blender.org/D6289
Diffstat (limited to 'intern/cycles/kernel/kernel_passes.h')
-rw-r--r--intern/cycles/kernel/kernel_passes.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index c1d74dddc2a..3e423e42573 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -145,7 +145,17 @@ ccl_device_inline void kernel_update_denoising_features(KernelGlobals *kg,
normal += sc->N * sc->sample_weight;
sum_weight += sc->sample_weight;
if (bsdf_get_specular_roughness_squared(sc) > sqr(0.075f)) {
- albedo += sc->weight;
+ float3 closure_albedo = sc->weight;
+ /* Closures that include a Fresnel term typically have weights close to 1 even though their
+ * actual contribution is significantly lower.
+ * To account for this, we scale their weight by the average fresnel factor (the same is also
+ * done for the sample weight in the BSDF setup, so we don't need to scale that here). */
+ if (CLOSURE_IS_BSDF_MICROFACET_FRESNEL(sc->type)) {
+ MicrofacetBsdf *bsdf = (MicrofacetBsdf *)sc;
+ closure_albedo *= bsdf->extra->fresnel_color;
+ }
+
+ albedo += closure_albedo;
sum_nonspecular_weight += sc->sample_weight;
}
}