diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-11-23 18:38:30 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-11-23 18:38:30 +0300 |
commit | db450c93201f4fd963fa1a7d6bc73cb6646642e7 (patch) | |
tree | 02f4d6093ce84be262552bd50137b9f7e98ead7c /intern | |
parent | 71c80bd939f89cc032a95fd93f9d7d99be7928a3 (diff) | |
parent | 70424195a8a68f5d08f91b5947008825af7b4ee8 (diff) |
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/integrator/shade_volume.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/light/light.h | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/intern/cycles/kernel/integrator/shade_volume.h b/intern/cycles/kernel/integrator/shade_volume.h index 8fc9351b3e3..712c22357b8 100644 --- a/intern/cycles/kernel/integrator/shade_volume.h +++ b/intern/cycles/kernel/integrator/shade_volume.h @@ -699,8 +699,10 @@ ccl_device_forceinline bool integrate_volume_sample_light( float light_u, light_v; path_state_rng_2D(kg, rng_state, PRNG_LIGHT_U, &light_u, &light_v); - light_distribution_sample_from_volume_segment( - kg, light_u, light_v, sd->time, sd->P, bounce, path_flag, ls); + if (!light_distribution_sample_from_volume_segment( + kg, light_u, light_v, sd->time, sd->P, bounce, path_flag, ls)) { + return false; + } if (ls->shader & SHADER_EXCLUDE_SCATTER) { return false; diff --git a/intern/cycles/kernel/light/light.h b/intern/cycles/kernel/light/light.h index 3f7d0e0899e..e0a9f1c57f5 100644 --- a/intern/cycles/kernel/light/light.h +++ b/intern/cycles/kernel/light/light.h @@ -73,7 +73,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg, ls->P = zero_float3(); ls->Ng = zero_float3(); ls->D = zero_float3(); - ls->pdf = true; + ls->pdf = 1.0f; ls->t = FLT_MAX; return true; } @@ -131,7 +131,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg, float3 dir = make_float3(klight->spot.dir[0], klight->spot.dir[1], klight->spot.dir[2]); ls->eval_fac *= spot_light_attenuation( dir, klight->spot.spot_angle, klight->spot.spot_smooth, ls->Ng); - if (ls->eval_fac == 0.0f) { + if (!in_volume_segment && ls->eval_fac == 0.0f) { return false; } } @@ -170,7 +170,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg, float3 sample_axisu = axisu; float3 sample_axisv = axisv; - if (klight->area.tan_spread > 0.0f) { + if (!in_volume_segment && klight->area.tan_spread > 0.0f) { if (!light_spread_clamp_area_light( P, Ng, &ls->P, &sample_axisu, &sample_axisv, klight->area.tan_spread)) { return false; @@ -203,7 +203,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg, ls->pdf *= kernel_data.integrator.pdf_lights; - return (ls->pdf > 0.0f); + return in_volume_segment || (ls->pdf > 0.0f); } ccl_device bool lights_intersect(KernelGlobals kg, |