diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-27 12:06:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-27 12:06:29 +0300 |
commit | 9a74b603670cc3fab14d9fcd7be7b3c17731a8ee (patch) | |
tree | 0611021c1450e586308d58223353793dcc137afe /intern/cycles/kernel/kernel_light.h | |
parent | 474971f3d84e5eacde7e92fc86ef4e10a5e0786c (diff) | |
parent | bc3727a94374d9c56745c943a1e6574627a88510 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern/cycles/kernel/kernel_light.h')
-rw-r--r-- | intern/cycles/kernel/kernel_light.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index cd879e27e72..b1be0b2155a 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -224,7 +224,7 @@ float3 background_map_sample(KernelGlobals *kg, float randu, float randv, float float2 cdf_last_v = kernel_tex_fetch(__light_background_marginal_cdf, res); /* importance-sampled V direction */ - float dv = (randv - cdf_v.y) / (cdf_next_v.y - cdf_v.y); + float dv = inverse_lerp(cdf_v.y, cdf_next_v.y, randv); float v = (index_v + dv) / res; /* this is basically std::lower_bound as used by pbrt */ @@ -250,7 +250,7 @@ float3 background_map_sample(KernelGlobals *kg, float randu, float randv, float float2 cdf_last_u = kernel_tex_fetch(__light_background_conditional_cdf, index_v * cdf_count + res); /* importance-sampled U direction */ - float du = (randu - cdf_u.y) / (cdf_next_u.y - cdf_u.y); + float du = inverse_lerp(cdf_u.y, cdf_next_u.y, randu); float u = (index_u + du) / res; /* compute pdf */ |