Cycles: perform clamping per light contribution instead of whole path

With upcoming light group passes, for them to sum up correctly to the combined
pass the clamping must be more fine grained.

This also has the advantage that if one light is particularly noisy, it does
not diminish the contribution from other lights which do not need as much
clamping.

Clamp values on existing scenes will need to be tweaked to get similar results,
there is no automatic conversion possible which would give the same results as
before.

Implemented by Lukas, with tweaks by Brecht.

Part of D4837
This commit is contained in:
Lukas Stockner
2019-12-08 21:19:37 +01:00
committed by Brecht Van Lommel
parent 85b7d397f7
commit 3437c9c3bf
15 changed files with 119 additions and 115 deletions

View File

@@ -121,8 +121,14 @@ ccl_device_noinline_cpu void kernel_branched_path_surface_connect_light(
if (has_emission) {
if (!blocked) {
/* accumulate */
path_radiance_accum_light(
L, state, throughput * num_samples_inv, &L_light, shadow, num_samples_inv, is_lamp);
path_radiance_accum_light(kg,
L,
state,
throughput * num_samples_inv,
&L_light,
shadow,
num_samples_inv,
is_lamp);
}
else {
path_radiance_accum_total_light(L, state, throughput * num_samples_inv, &L_light);
@@ -250,7 +256,7 @@ ccl_device_inline void kernel_path_surface_connect_light(KernelGlobals *kg,
if (has_emission) {
if (!blocked) {
/* accumulate */
path_radiance_accum_light(L, state, throughput, &L_light, shadow, 1.0f, is_lamp);
path_radiance_accum_light(kg, L, state, throughput, &L_light, shadow, 1.0f, is_lamp);
}
else {
path_radiance_accum_total_light(L, state, throughput, &L_light);