diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-02-11 20:48:21 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-02-12 17:01:29 +0300 |
commit | 9febda912b04559277d465b9610334c04a73d2ce (patch) | |
tree | ed64b83783214e4605924de6fd4ab28001a132d5 /intern/cycles | |
parent | 9fa6e06287dc49f1fcf2bbfa150c0ff368668fed (diff) |
Baking: support vertex color baking of normal material, UV discontinuities
Baking vertex colors per-corner leads to unwanted discontinuities when there is
sampling noise, for example in ambient occlusion or with a bevel shader node for
normals. For this reason the code used to always average results per-vertex.
However when using split normals, multiple materials or UV islands, we do want to
preserve discontinuities. So now bake per corner, but make sure the sampling seed
is shared for vertices.
Fix T85550: vertex color baking crash with split normals, Ref D10399
Fix T84663: vertex color baking blending at UV seams
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/kernel_bake.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index e876e5d8ca6..359099d78c6 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -233,6 +233,7 @@ ccl_device void kernel_bake_evaluate( ccl_global float *differential = buffer + kernel_data.film.pass_bake_differential; ccl_global float *output = buffer + kernel_data.film.pass_combined; + int seed = __float_as_uint(primitive[0]); int prim = __float_as_uint(primitive[1]); if (prim == -1) return; @@ -240,7 +241,7 @@ ccl_device void kernel_bake_evaluate( prim += kernel_data.bake.tri_offset; /* Random number generator. */ - uint rng_hash = hash_uint2(x, y) ^ kernel_data.integrator.seed; + uint rng_hash = hash_uint(seed) ^ kernel_data.integrator.seed; int num_samples = kernel_data.integrator.aa_samples; float filter_x, filter_y; |