From 8f00a002833624370c8ce8ab3085d3c54508858a Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Thu, 19 Jun 2025 20:02:19 +0200 Subject: [PATCH] Fix #138188: camera_shader_random_sample returns zero if DOF is off --- intern/cycles/kernel/integrator/init_from_camera.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/intern/cycles/kernel/integrator/init_from_camera.h b/intern/cycles/kernel/integrator/init_from_camera.h index 12f8c9f4312..467f527b870 100644 --- a/intern/cycles/kernel/integrator/init_from_camera.h +++ b/intern/cycles/kernel/integrator/init_from_camera.h @@ -28,8 +28,10 @@ ccl_device_inline Spectrum integrate_camera_sample(KernelGlobals kg, path_rng_2D(kg, rng_pixel, sample, PRNG_FILTER); /* Motion blur (time) and depth of field (lens) sampling. (time, lens_x, lens_y) */ - const float3 rand_time_lens = (kernel_data.cam.shuttertime != -1.0f || - kernel_data.cam.aperturesize > 0.0f) ? + const bool use_motionblur = kernel_data.cam.shuttertime != -1.0f; + const bool use_dof = kernel_data.cam.aperturesize > 0.0f; + const bool use_custom_cam = kernel_data.cam.type == CAMERA_CUSTOM; + const float3 rand_time_lens = (use_motionblur || use_dof || use_custom_cam) ? path_rng_3D(kg, rng_pixel, sample, PRNG_LENS_TIME) : zero_float3();