diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-08-24 02:42:45 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-08-24 02:43:57 +0300 |
commit | bffa1681577e3c850c4fbab5799612febf32a245 (patch) | |
tree | 87fca54b03015913cd7c8396fcc7a8ebbb18fa97 /intern/cycles/kernel/svm | |
parent | eec1ea0ccf2a47cbfa67e2cde250e44533c0d573 (diff) |
Fix T90854: Cycles, normal map fails with applied transformations
Prior to rBb8ecdbcd964a normals were stored both in
DeviceScene.tri_vnormal and the float3 attributes buffer. However, the
normals in `DeviceScene.tri_vnormal` might have be transformed to world
space if the object's transformation was applied, while the data in the
float3 attributes buffer were not. This caused shading issues in cases
where the objects did have transformation applied, as the math expects
the normals to be in object space.
To fix this, convert the normals to object space if necessary before
applying the normal map.
Reviewed By: brecht
Maniphest Tasks: T90854
Differential Revision: https://developer.blender.org/D12294
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r-- | intern/cycles/kernel/svm/svm_tex_coord.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h index fec6a2cc27f..46600551cc4 100644 --- a/intern/cycles/kernel/svm/svm_tex_coord.h +++ b/intern/cycles/kernel/svm/svm_tex_coord.h @@ -289,7 +289,7 @@ ccl_device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *st float3 normal; if (sd->shader & SHADER_SMOOTH_NORMAL) { - normal = triangle_smooth_normal_unnormalized(kg, sd->Ng, sd->prim, sd->u, sd->v); + normal = triangle_smooth_normal_unnormalized(kg, sd, sd->Ng, sd->prim, sd->u, sd->v); } else { normal = sd->Ng; |