It seems I need to do an extra multiplication of the vertex normal with an inverted object world matrix like this
to get the correct mapping.
I can’t figure out if I’m doing something wrong in my script or there is a bug in the vertex normal calculation.
I have a script that uses
mesh = obj.to_mesh(bpy.context.scene, True, 'PREVIEW', calc_tessface=False) mesh.transform(obj.matrix_world)
to give me world data for an object obj. This correctly returns world space face normals & position, and vertex position, but incorrect vertex normals. I have to accept first any rotation of the object to get correct vertex normals.
Am I doing something wrong?