diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-04 01:28:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-04 22:11:14 +0300 |
commit | 77f300e2a9289af026278171b51103bf485297e4 (patch) | |
tree | 6b967bd8eb10274f6ec31c8da65c17f276476247 /intern/cycles | |
parent | 5bb677e592fd5902600f41653a2d56b4d9ae8c56 (diff) |
Fix use of uninitialized memory in Cycles normal baking.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/kernel_bake.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index 4d89839c46c..0d10e17a593 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -335,12 +335,14 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, /* data passes */ case SHADER_EVAL_NORMAL: { + float3 N = sd.N; if((sd.flag & SD_HAS_BUMP)) { shader_eval_surface(kg, &sd, &state, 0); + N = shader_bsdf_average_normal(kg, &sd); } /* encoding: normal = (2 * color) - 1 */ - out = shader_bsdf_average_normal(kg, &sd) * 0.5f + make_float3(0.5f, 0.5f, 0.5f); + out = N * 0.5f + make_float3(0.5f, 0.5f, 0.5f); break; } case SHADER_EVAL_UV: |