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-12-08 23:19:37 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-12-12 15:04:43 +0300
commit3437c9c3bf3d16a5ae070226d927a3a329239c8c (patch)
treef7ad2b332a4200caa8d57ac85199ac760fc6bfeb /intern/cycles/kernel/kernel_emission.h
parent85b7d397f7620b57ce4014ee7b0119eef64578d9 (diff)
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
Diffstat (limited to 'intern/cycles/kernel/kernel_emission.h')
-rw-r--r--intern/cycles/kernel/kernel_emission.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index e70958c2b06..c63d1149d03 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -234,14 +234,13 @@ ccl_device_noinline_cpu float3 indirect_primitive_emission(
/* Indirect Lamp Emission */
-ccl_device_noinline_cpu bool indirect_lamp_emission(KernelGlobals *kg,
+ccl_device_noinline_cpu void indirect_lamp_emission(KernelGlobals *kg,
ShaderData *emission_sd,
ccl_addr_space PathState *state,
+ PathRadiance *L,
Ray *ray,
- float3 *emission)
+ float3 throughput)
{
- bool hit_lamp = false;
-
for (int lamp = 0; lamp < kernel_data.integrator.num_all_lights; lamp++) {
LightSample ls ccl_optional_struct_init;
@@ -261,7 +260,7 @@ ccl_device_noinline_cpu bool indirect_lamp_emission(KernelGlobals *kg,
}
#endif
- float3 L = direct_emissive_eval(
+ float3 lamp_L = direct_emissive_eval(
kg, emission_sd, &ls, state, -ray->D, ray->dD, ls.t, ray->time);
#ifdef __VOLUME__
@@ -271,7 +270,7 @@ ccl_device_noinline_cpu bool indirect_lamp_emission(KernelGlobals *kg,
volume_ray.t = ls.t;
float3 volume_tp = make_float3(1.0f, 1.0f, 1.0f);
kernel_volume_shadow(kg, emission_sd, state, &volume_ray, &volume_tp);
- L *= volume_tp;
+ lamp_L *= volume_tp;
}
#endif
@@ -279,14 +278,11 @@ ccl_device_noinline_cpu bool indirect_lamp_emission(KernelGlobals *kg,
/* multiple importance sampling, get regular light pdf,
* and compute weight with respect to BSDF pdf */
float mis_weight = power_heuristic(state->ray_pdf, ls.pdf);
- L *= mis_weight;
+ lamp_L *= mis_weight;
}
- *emission += L;
- hit_lamp = true;
+ path_radiance_accum_emission(kg, L, state, throughput, lamp_L);
}
-
- return hit_lamp;
}
/* Indirect Background */