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
This commit is contained in:

committed by
Lukas Stockner

parent
7711231838
commit
4659fa5471
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user