diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-09-01 02:28:58 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-09-01 15:57:39 +0300 |
commit | 06d2dc6be2834b80af26a59783222b565a6ca8b8 (patch) | |
tree | 8c1ec0c661a80a3543ee9ed62199dfd16240c21b /intern/cycles/kernel/integrator/init_from_bake.h | |
parent | 60119daef569f647c3004360daf657739461b750 (diff) |
Cleanup: minor cleanups for sample pattern code
Diffstat (limited to 'intern/cycles/kernel/integrator/init_from_bake.h')
-rw-r--r-- | intern/cycles/kernel/integrator/init_from_bake.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/intern/cycles/kernel/integrator/init_from_bake.h b/intern/cycles/kernel/integrator/init_from_bake.h index c00d677d420..9897bc3d65c 100644 --- a/intern/cycles/kernel/integrator/init_from_bake.h +++ b/intern/cycles/kernel/integrator/init_from_bake.h @@ -121,13 +121,8 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg, /* Random number generator. */ const uint rng_hash = hash_uint(seed) ^ kernel_data.integrator.seed; - float filter_x, filter_y; - if (sample == 0) { - filter_x = filter_y = 0.5f; - } - else { - path_rng_2D(kg, rng_hash, sample, PRNG_FILTER, &filter_x, &filter_y); - } + const float2 rand_filter = (sample == 0) ? make_float2(0.5f, 0.5f) : + path_rng_2D(kg, rng_hash, sample, PRNG_FILTER); /* Initialize path state for path integration. */ path_state_init_integrator(kg, state, sample, rng_hash); @@ -150,8 +145,9 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg, /* Sub-pixel offset. */ if (sample > 0) { - u = bake_clamp_mirror_repeat(u + dudx * (filter_x - 0.5f) + dudy * (filter_y - 0.5f), 1.0f); - v = bake_clamp_mirror_repeat(v + dvdx * (filter_x - 0.5f) + dvdy * (filter_y - 0.5f), + u = bake_clamp_mirror_repeat(u + dudx * (rand_filter.x - 0.5f) + dudy * (rand_filter.y - 0.5f), + 1.0f); + v = bake_clamp_mirror_repeat(v + dvdx * (rand_filter.x - 0.5f) + dvdy * (rand_filter.y - 0.5f), 1.0f - u); } |