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
path: root/intern
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
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')
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h146
-rw-r--r--intern/cycles/kernel/kernel_bake.h8
-rw-r--r--intern/cycles/kernel/kernel_emission.h18
-rw-r--r--intern/cycles/kernel/kernel_path.h15
-rw-r--r--intern/cycles/kernel/kernel_path_branched.h6
-rw-r--r--intern/cycles/kernel/kernel_path_surface.h12
-rw-r--r--intern/cycles/kernel/kernel_path_volume.h4
-rw-r--r--intern/cycles/kernel/kernel_volume.h4
-rw-r--r--intern/cycles/kernel/split/kernel_branched.h2
-rw-r--r--intern/cycles/kernel/split/kernel_buffer_update.h2
-rw-r--r--intern/cycles/kernel/split/kernel_path_init.h3
-rw-r--r--intern/cycles/kernel/split/kernel_shadow_blocked_dl.h2
-rw-r--r--intern/cycles/render/film.cpp4
-rw-r--r--intern/cycles/render/film.h1
-rw-r--r--intern/cycles/render/integrator.cpp7
15 files changed, 119 insertions, 115 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 46a51f5a560..606c288649a 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -174,13 +174,13 @@ ccl_device_inline float3 bsdf_eval_sum(const BsdfEval *eval)
* visible as the first non-transparent hit, while indirectly visible are the
* bounces after that. */
-ccl_device_inline void path_radiance_init(PathRadiance *L, int use_light_pass)
+ccl_device_inline void path_radiance_init(KernelGlobals *kg, PathRadiance *L)
{
/* clear all */
#ifdef __PASSES__
- L->use_light_pass = use_light_pass;
+ L->use_light_pass = kernel_data.film.use_light_pass;
- if (use_light_pass) {
+ if (kernel_data.film.use_light_pass) {
L->indirect = make_float3(0.0f, 0.0f, 0.0f);
L->direct_emission = make_float3(0.0f, 0.0f, 0.0f);
@@ -285,7 +285,37 @@ ccl_device_inline void path_radiance_bsdf_bounce(KernelGlobals *kg,
}
}
-ccl_device_inline void path_radiance_accum_emission(PathRadiance *L,
+#ifdef __CLAMP_SAMPLE__
+ccl_device_forceinline void path_radiance_clamp(KernelGlobals *kg, float3 *L, int bounce)
+{
+ float limit = (bounce > 0) ? kernel_data.integrator.sample_clamp_indirect :
+ kernel_data.integrator.sample_clamp_direct;
+ float sum = reduce_add(fabs(*L));
+ if (sum > limit) {
+ *L *= limit / sum;
+ }
+}
+
+ccl_device_forceinline void path_radiance_clamp_throughput(KernelGlobals *kg,
+ float3 *L,
+ float3 *throughput,
+ int bounce)
+{
+ float limit = (bounce > 0) ? kernel_data.integrator.sample_clamp_indirect :
+ kernel_data.integrator.sample_clamp_direct;
+
+ float sum = reduce_add(fabs(*L));
+ if (sum > limit) {
+ float clamp_factor = limit / sum;
+ *L *= clamp_factor;
+ *throughput *= clamp_factor;
+ }
+}
+
+#endif
+
+ccl_device_inline void path_radiance_accum_emission(KernelGlobals *kg,
+ PathRadiance *L,
ccl_addr_space PathState *state,
float3 throughput,
float3 value)
@@ -296,23 +326,29 @@ ccl_device_inline void path_radiance_accum_emission(PathRadiance *L,
}
#endif
+ float3 contribution = throughput * value;
+#ifdef __CLAMP_SAMPLE__
+ path_radiance_clamp(kg, &contribution, state->bounce - 1);
+#endif
+
#ifdef __PASSES__
if (L->use_light_pass) {
if (state->bounce == 0)
- L->emission += throughput * value;
+ L->emission += contribution;
else if (state->bounce == 1)
- L->direct_emission += throughput * value;
+ L->direct_emission += contribution;
else
- L->indirect += throughput * value;
+ L->indirect += contribution;
}
else
#endif
{
- L->emission += throughput * value;
+ L->emission += contribution;
}
}
-ccl_device_inline void path_radiance_accum_ao(PathRadiance *L,
+ccl_device_inline void path_radiance_accum_ao(KernelGlobals *kg,
+ PathRadiance *L,
ccl_addr_space PathState *state,
float3 throughput,
float3 alpha,
@@ -339,21 +375,23 @@ ccl_device_inline void path_radiance_accum_ao(PathRadiance *L,
}
#endif
+ float3 contribution = throughput * bsdf * ao;
+
#ifdef __PASSES__
if (L->use_light_pass) {
if (state->bounce == 0) {
/* Directly visible lighting. */
- L->direct_diffuse += throughput * bsdf * ao;
+ L->direct_diffuse += contribution;
}
else {
/* Indirectly visible lighting after BSDF bounce. */
- L->indirect += throughput * bsdf * ao;
+ L->indirect += contribution;
}
}
else
#endif
{
- L->emission += throughput * bsdf * ao;
+ L->emission += contribution;
}
}
@@ -374,7 +412,8 @@ ccl_device_inline void path_radiance_accum_total_ao(PathRadiance *L,
#endif
}
-ccl_device_inline void path_radiance_accum_light(PathRadiance *L,
+ccl_device_inline void path_radiance_accum_light(KernelGlobals *kg,
+ PathRadiance *L,
ccl_addr_space PathState *state,
float3 throughput,
BsdfEval *bsdf_eval,
@@ -394,15 +433,24 @@ ccl_device_inline void path_radiance_accum_light(PathRadiance *L,
}
#endif
+ float3 shaded_throughput = throughput * shadow;
+
#ifdef __PASSES__
if (L->use_light_pass) {
+ /* Compute the clamping based on the total contribution.
+ * The resulting scale is then be applied to all individual components. */
+ float3 full_contribution = shaded_throughput * bsdf_eval_sum(bsdf_eval);
+# ifdef __CLAMP_SAMPLE__
+ path_radiance_clamp_throughput(kg, &full_contribution, &shaded_throughput, state->bounce);
+# endif
+
if (state->bounce == 0) {
/* directly visible lighting */
- L->direct_diffuse += throughput * bsdf_eval->diffuse * shadow;
- L->direct_glossy += throughput * bsdf_eval->glossy * shadow;
- L->direct_transmission += throughput * bsdf_eval->transmission * shadow;
- L->direct_subsurface += throughput * bsdf_eval->subsurface * shadow;
- L->direct_scatter += throughput * bsdf_eval->scatter * shadow;
+ L->direct_diffuse += shaded_throughput * bsdf_eval->diffuse;
+ L->direct_glossy += shaded_throughput * bsdf_eval->glossy;
+ L->direct_transmission += shaded_throughput * bsdf_eval->transmission;
+ L->direct_subsurface += shaded_throughput * bsdf_eval->subsurface;
+ L->direct_scatter += shaded_throughput * bsdf_eval->scatter;
if (is_lamp) {
L->shadow.x += shadow.x * shadow_fac;
@@ -412,13 +460,15 @@ ccl_device_inline void path_radiance_accum_light(PathRadiance *L,
}
else {
/* indirectly visible lighting after BSDF bounce */
- L->indirect += throughput * bsdf_eval_sum(bsdf_eval) * shadow;
+ L->indirect += full_contribution;
}
}
else
#endif
{
- L->emission += throughput * bsdf_eval->diffuse * shadow;
+ float3 contribution = shaded_throughput * bsdf_eval->diffuse;
+ path_radiance_clamp(kg, &contribution, state->bounce);
+ L->emission += contribution;
}
}
@@ -439,7 +489,8 @@ ccl_device_inline void path_radiance_accum_total_light(PathRadiance *L,
#endif
}
-ccl_device_inline void path_radiance_accum_background(PathRadiance *L,
+ccl_device_inline void path_radiance_accum_background(KernelGlobals *kg,
+ PathRadiance *L,
ccl_addr_space PathState *state,
float3 throughput,
float3 value)
@@ -456,19 +507,24 @@ ccl_device_inline void path_radiance_accum_background(PathRadiance *L,
}
#endif
+ float3 contribution = throughput * value;
+#ifdef __CLAMP_SAMPLE__
+ path_radiance_clamp(kg, &contribution, state->bounce - 1);
+#endif
+
#ifdef __PASSES__
if (L->use_light_pass) {
if (state->flag & PATH_RAY_TRANSPARENT_BACKGROUND)
- L->background += throughput * value;
+ L->background += contribution;
else if (state->bounce == 1)
- L->direct_emission += throughput * value;
+ L->direct_emission += contribution;
else
- L->indirect += throughput * value;
+ L->indirect += contribution;
}
else
#endif
{
- L->emission += throughput * value;
+ L->emission += contribution;
}
#ifdef __DENOISING_FEATURES__
@@ -587,8 +643,6 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg,
/* Light Passes are used */
#ifdef __PASSES__
float3 L_direct, L_indirect;
- float clamp_direct = kernel_data.integrator.sample_clamp_direct;
- float clamp_indirect = kernel_data.integrator.sample_clamp_indirect;
if (L->use_light_pass) {
path_radiance_sum_indirect(L);
@@ -622,44 +676,6 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg,
L->emission = make_float3(0.0f, 0.0f, 0.0f);
}
-
- /* Clamp direct and indirect samples */
-# ifdef __CLAMP_SAMPLE__
- else if (sum > clamp_direct || sum > clamp_indirect) {
- float scale;
-
- /* Direct */
- float sum_direct = fabsf(L_direct.x) + fabsf(L_direct.y) + fabsf(L_direct.z);
- if (sum_direct > clamp_direct) {
- scale = clamp_direct / sum_direct;
- L_direct *= scale;
-
- L->direct_diffuse *= scale;
- L->direct_glossy *= scale;
- L->direct_transmission *= scale;
- L->direct_subsurface *= scale;
- L->direct_scatter *= scale;
- L->emission *= scale;
- L->background *= scale;
- }
-
- /* Indirect */
- float sum_indirect = fabsf(L_indirect.x) + fabsf(L_indirect.y) + fabsf(L_indirect.z);
- if (sum_indirect > clamp_indirect) {
- scale = clamp_indirect / sum_indirect;
- L_indirect *= scale;
-
- L->indirect_diffuse *= scale;
- L->indirect_glossy *= scale;
- L->indirect_transmission *= scale;
- L->indirect_subsurface *= scale;
- L->indirect_scatter *= scale;
- }
-
- /* Sum again, after clamping */
- L_sum = L_direct + L_indirect;
- }
-# endif
}
/* No Light Passes */
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h
index 8e5a279e6cd..a349b225abb 100644
--- a/intern/cycles/kernel/kernel_bake.h
+++ b/intern/cycles/kernel/kernel_bake.h
@@ -39,7 +39,7 @@ ccl_device_inline void compute_light_pass(
# endif
/* init radiance */
- path_radiance_init(&L_sample, kernel_data.film.use_light_pass);
+ path_radiance_init(kg, &L_sample);
/* init path state */
path_state_init(kg, &emission_sd, &state, rng_hash, sample, NULL);
@@ -64,7 +64,7 @@ ccl_device_inline void compute_light_pass(
/* sample emission */
if ((pass_filter & BAKE_FILTER_EMISSION) && (sd->flag & SD_EMISSION)) {
float3 emission = indirect_primitive_emission(kg, sd, 0.0f, state.flag, state.ray_pdf);
- path_radiance_accum_emission(&L_sample, &state, throughput, emission);
+ path_radiance_accum_emission(kg, &L_sample, &state, throughput, emission);
}
bool is_sss_sample = false;
@@ -118,7 +118,7 @@ ccl_device_inline void compute_light_pass(
/* sample emission */
if ((pass_filter & BAKE_FILTER_EMISSION) && (sd->flag & SD_EMISSION)) {
float3 emission = indirect_primitive_emission(kg, sd, 0.0f, state.flag, state.ray_pdf);
- path_radiance_accum_emission(&L_sample, &state, throughput, emission);
+ path_radiance_accum_emission(kg, &L_sample, &state, throughput, emission);
}
# ifdef __SUBSURFACE__
@@ -287,7 +287,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg,
/* light passes */
PathRadiance L;
- path_radiance_init(&L, kernel_data.film.use_light_pass);
+ path_radiance_init(kg, &L);
shader_setup_from_sample(
kg,
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 */
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 693efad8c50..1a0b67275a7 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -104,10 +104,7 @@ ccl_device_forceinline void kernel_path_lamp_emission(KernelGlobals *kg,
light_ray.dP = ray->dP;
/* intersect with lamp */
- float3 emission = make_float3(0.0f, 0.0f, 0.0f);
-
- if (indirect_lamp_emission(kg, emission_sd, state, &light_ray, &emission))
- path_radiance_accum_emission(L, state, throughput, emission);
+ indirect_lamp_emission(kg, emission_sd, state, L, &light_ray, throughput);
}
#endif /* __LAMP_MIS__ */
}
@@ -139,7 +136,7 @@ ccl_device_forceinline void kernel_path_background(KernelGlobals *kg,
#ifdef __BACKGROUND__
/* sample background shader */
float3 L_background = indirect_background(kg, sd, state, buffer, ray);
- path_radiance_accum_background(L, state, throughput, L_background);
+ path_radiance_accum_background(kg, L, state, throughput, L_background);
#endif /* __BACKGROUND__ */
}
@@ -189,7 +186,7 @@ ccl_device_forceinline VolumeIntegrateResult kernel_path_volume(KernelGlobals *k
/* emission */
if (volume_segment.closure_flag & SD_EMISSION)
- path_radiance_accum_emission(L, state, *throughput, volume_segment.accum_emission);
+ path_radiance_accum_emission(kg, L, state, *throughput, volume_segment.accum_emission);
/* scattering */
VolumeIntegrateResult result = VOLUME_PATH_ATTENUATED;
@@ -321,7 +318,7 @@ ccl_device_forceinline bool kernel_path_shader_apply(KernelGlobals *kg,
if (sd->flag & SD_EMISSION) {
float3 emission = indirect_primitive_emission(
kg, sd, sd->ray_length, state->flag, state->ray_pdf);
- path_radiance_accum_emission(L, state, throughput, emission);
+ path_radiance_accum_emission(kg, L, state, throughput, emission);
}
#endif /* __EMISSION__ */
@@ -369,7 +366,7 @@ ccl_device_noinline
light_ray.dD = differential3_zero();
if (!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &ao_shadow)) {
- path_radiance_accum_ao(L, state, throughput, ao_alpha, ao_bsdf, ao_shadow);
+ path_radiance_accum_ao(kg, L, state, throughput, ao_alpha, ao_bsdf, ao_shadow);
}
else {
path_radiance_accum_total_ao(L, state, throughput, ao_bsdf);
@@ -675,7 +672,7 @@ ccl_device void kernel_path_trace(
float3 throughput = make_float3(1.0f, 1.0f, 1.0f);
PathRadiance L;
- path_radiance_init(&L, kernel_data.film.use_light_pass);
+ path_radiance_init(kg, &L);
ShaderDataTinyStorage emission_sd_storage;
ShaderData *emission_sd = AS_SHADER_DATA(&emission_sd_storage);
diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h
index 39309379f0c..f75e4ab4c97 100644
--- a/intern/cycles/kernel/kernel_path_branched.h
+++ b/intern/cycles/kernel/kernel_path_branched.h
@@ -55,7 +55,7 @@ ccl_device_inline void kernel_branched_path_ao(KernelGlobals *kg,
if (!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &ao_shadow)) {
path_radiance_accum_ao(
- L, state, throughput * num_samples_inv, ao_alpha, ao_bsdf, ao_shadow);
+ kg, L, state, throughput * num_samples_inv, ao_alpha, ao_bsdf, ao_shadow);
}
else {
path_radiance_accum_total_ao(L, state, throughput * num_samples_inv, ao_bsdf);
@@ -146,7 +146,7 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
/* emission and transmittance */
if (volume_segment.closure_flag & SD_EMISSION)
- path_radiance_accum_emission(L, state, *throughput, volume_segment.accum_emission);
+ path_radiance_accum_emission(kg, L, state, *throughput, volume_segment.accum_emission);
*throughput *= volume_segment.accum_transmittance;
/* free cached steps */
@@ -376,7 +376,7 @@ ccl_device void kernel_branched_path_integrate(KernelGlobals *kg,
/* initialize */
float3 throughput = make_float3(1.0f, 1.0f, 1.0f);
- path_radiance_init(L, kernel_data.film.use_light_pass);
+ path_radiance_init(kg, L);
/* shader data memory used for both volumes and surfaces, saves stack space */
ShaderData sd;
diff --git a/intern/cycles/kernel/kernel_path_surface.h b/intern/cycles/kernel/kernel_path_surface.h
index a32690d51eb..ba48c0bdfc4 100644
--- a/intern/cycles/kernel/kernel_path_surface.h
+++ b/intern/cycles/kernel/kernel_path_surface.h
@@ -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);
diff --git a/intern/cycles/kernel/kernel_path_volume.h b/intern/cycles/kernel/kernel_path_volume.h
index db10629ee9f..a787910e65c 100644
--- a/intern/cycles/kernel/kernel_path_volume.h
+++ b/intern/cycles/kernel/kernel_path_volume.h
@@ -57,7 +57,7 @@ ccl_device_inline void kernel_path_volume_connect_light(KernelGlobals *kg,
if (has_emission && !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);
}
# endif /* __EMISSION__ */
}
@@ -247,7 +247,7 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg,
if (has_emission && !blocked) {
/* accumulate */
path_radiance_accum_light(
- L, state, tp * num_samples_inv, &L_light, shadow, num_samples_inv, is_lamp);
+ kg, L, state, tp * num_samples_inv, &L_light, shadow, num_samples_inv, is_lamp);
}
}
}
diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h
index 4ddcbec0fef..f443bb88463 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -504,7 +504,7 @@ kernel_volume_integrate_homogeneous(KernelGlobals *kg,
float3 transmittance = volume_color_transmittance(coeff.sigma_t, ray->t);
float3 emission = kernel_volume_emission_integrate(
&coeff, closure_flag, transmittance, ray->t);
- path_radiance_accum_emission(L, state, *throughput, emission);
+ path_radiance_accum_emission(kg, L, state, *throughput, emission);
}
/* modify throughput */
@@ -629,7 +629,7 @@ kernel_volume_integrate_heterogeneous_distance(KernelGlobals *kg,
if (L && (closure_flag & SD_EMISSION)) {
float3 emission = kernel_volume_emission_integrate(
&coeff, closure_flag, transmittance, dt);
- path_radiance_accum_emission(L, state, tp, emission);
+ path_radiance_accum_emission(kg, L, state, tp, emission);
}
/* modify throughput */
diff --git a/intern/cycles/kernel/split/kernel_branched.h b/intern/cycles/kernel/split/kernel_branched.h
index e08d87ab618..bfcd21baac4 100644
--- a/intern/cycles/kernel/split/kernel_branched.h
+++ b/intern/cycles/kernel/split/kernel_branched.h
@@ -106,7 +106,7 @@ ccl_device_inline bool kernel_split_branched_indirect_start_shared(KernelGlobals
PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
PathRadiance *inactive_L = &kernel_split_state.path_radiance[inactive_ray];
- path_radiance_init(inactive_L, kernel_data.film.use_light_pass);
+ path_radiance_init(kg, inactive_L);
path_radiance_copy_indirect(inactive_L, L);
ray_state[inactive_ray] = RAY_REGENERATED;
diff --git a/intern/cycles/kernel/split/kernel_buffer_update.h b/intern/cycles/kernel/split/kernel_buffer_update.h
index e37be5b405e..dba1768f03f 100644
--- a/intern/cycles/kernel/split/kernel_buffer_update.h
+++ b/intern/cycles/kernel/split/kernel_buffer_update.h
@@ -135,7 +135,7 @@ ccl_device void kernel_buffer_update(KernelGlobals *kg,
* These rays proceed with path-iteration.
*/
*throughput = make_float3(1.0f, 1.0f, 1.0f);
- path_radiance_init(L, kernel_data.film.use_light_pass);
+ path_radiance_init(kg, L);
path_state_init(kg,
AS_SHADER_DATA(&kernel_split_state.sd_DL_shadow[ray_index]),
state,
diff --git a/intern/cycles/kernel/split/kernel_path_init.h b/intern/cycles/kernel/split/kernel_path_init.h
index 3faa3208341..82b0f583d8d 100644
--- a/intern/cycles/kernel/split/kernel_path_init.h
+++ b/intern/cycles/kernel/split/kernel_path_init.h
@@ -59,8 +59,7 @@ ccl_device void kernel_path_init(KernelGlobals *kg)
* These rays proceed with path-iteration.
*/
kernel_split_state.throughput[ray_index] = make_float3(1.0f, 1.0f, 1.0f);
- path_radiance_init(&kernel_split_state.path_radiance[ray_index],
- kernel_data.film.use_light_pass);
+ path_radiance_init(kg, &kernel_split_state.path_radiance[ray_index]);
path_state_init(kg,
AS_SHADER_DATA(&kernel_split_state.sd_DL_shadow[ray_index]),
&kernel_split_state.path_state[ray_index],
diff --git a/intern/cycles/kernel/split/kernel_shadow_blocked_dl.h b/intern/cycles/kernel/split/kernel_shadow_blocked_dl.h
index 82990ce9fae..5e46d300bca 100644
--- a/intern/cycles/kernel/split/kernel_shadow_blocked_dl.h
+++ b/intern/cycles/kernel/split/kernel_shadow_blocked_dl.h
@@ -87,7 +87,7 @@ ccl_device void kernel_shadow_blocked_dl(KernelGlobals *kg)
if (!shadow_blocked(kg, sd, emission_sd, state, &ray, &shadow)) {
/* 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);
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp
index 379b0e6c214..3cd7936ae45 100644
--- a/intern/cycles/render/film.cpp
+++ b/intern/cycles/render/film.cpp
@@ -287,8 +287,6 @@ NODE_DEFINE(Film)
SOCKET_FLOAT(mist_depth, "Mist Depth", 100.0f);
SOCKET_FLOAT(mist_falloff, "Mist Falloff", 1.0f);
- SOCKET_BOOLEAN(use_sample_clamp, "Use Sample Clamp", false);
-
SOCKET_BOOLEAN(denoising_data_pass, "Generate Denoising Data Pass", false);
SOCKET_BOOLEAN(denoising_clean_pass, "Generate Denoising Clean Pass", false);
SOCKET_BOOLEAN(denoising_prefiltered_pass, "Generate Denoising Prefiltered Pass", false);
@@ -331,7 +329,7 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
kfilm->light_pass_flag = 0;
kfilm->pass_stride = 0;
- kfilm->use_light_pass = use_light_visibility || use_sample_clamp;
+ kfilm->use_light_pass = use_light_visibility;
bool have_cryptomatte = false, have_aov_color = false, have_aov_value = false;
diff --git a/intern/cycles/render/film.h b/intern/cycles/render/film.h
index 48673af0114..95e54cb54d8 100644
--- a/intern/cycles/render/film.h
+++ b/intern/cycles/render/film.h
@@ -78,7 +78,6 @@ class Film : public Node {
float mist_falloff;
bool use_light_visibility;
- bool use_sample_clamp;
CryptomatteType cryptomatte_passes;
int cryptomatte_depth;
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp
index b41b0b7b260..530c32106b7 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -209,13 +209,6 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
dscene->sobol_directions.copy_to_device();
- /* Clamping. */
- bool use_sample_clamp = (sample_clamp_direct != 0.0f || sample_clamp_indirect != 0.0f);
- if (use_sample_clamp != scene->film->use_sample_clamp) {
- scene->film->use_sample_clamp = use_sample_clamp;
- scene->film->tag_update(scene);
- }
-
need_update = false;
}