diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-11 13:31:58 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-11 13:31:58 +0400 |
commit | 561cf26c2f92a11c8f2fa2da79bcaebf2647fc76 (patch) | |
tree | 31b680b7aa9e21d230128dc9db9836aa5df27574 /intern/cycles/kernel/svm | |
parent | 18fda6d84c139d1e105dc58796f37effc31f35d5 (diff) |
Fix #35306: cycles normal mapping not working with flat shading.
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r-- | intern/cycles/kernel/svm/svm_tex_coord.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h index d793169261d..c4cf0d95793 100644 --- a/intern/cycles/kernel/svm/svm_tex_coord.h +++ b/intern/cycles/kernel/svm/svm_tex_coord.h @@ -261,7 +261,12 @@ __device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *stac /* get _unnormalized_ interpolated normal and tangent */ float3 tangent = primitive_attribute_float3(kg, sd, attr_elem, attr_offset, NULL, NULL); float sign = primitive_attribute_float(kg, sd, attr_sign_elem, attr_sign_offset, NULL, NULL); - float3 normal = primitive_attribute_float3(kg, sd, attr_normal_elem, attr_normal_offset, NULL, NULL); + float3 normal; + + if(sd->shader & SHADER_SMOOTH_NORMAL) + normal = primitive_attribute_float3(kg, sd, attr_normal_elem, attr_normal_offset, NULL, NULL); + else + normal = sd->N; /* apply normal map */ float3 B = sign * cross(normal, tangent); |