Page MenuHome

Fix T90854: Cycles, normal map fails with applied transformations
ClosedPublic

Authored by Kévin Dietrich (kevindietrich) on Aug 23 2021, 3:43 AM.

Details

Summary

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.

Diff Detail

Repository
rB Blender
Branch
fix_T90854 (branched from master)
Build Status
Buildable 16574
Build 16574: arc lint + arc unit

Event Timeline

Kévin Dietrich (kevindietrich) requested review of this revision.Aug 23 2021, 3:43 AM
Kévin Dietrich (kevindietrich) created this revision.
Brecht Van Lommel (brecht) requested changes to this revision.Aug 23 2021, 3:33 PM
Brecht Van Lommel (brecht) added inline comments.
intern/cycles/kernel/svm/svm_tex_coord.h
295

Use sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED.

296

This is unfortunately wrong if the object has scale in the transform. It's a bit involved but you have to transform the 3 normals, normalize them, and then interpolate without normalization.

This revision now requires changes to proceed.Aug 23 2021, 3:33 PM
  • Transform normals separately, with normalization.
  • Merge branch 'master' into fix_T90854
This revision is now accepted and ready to land.Aug 23 2021, 8:52 PM