I'm trying to write a JSON Serializer in Blender that can be loaded in Unity3D. I'm having an issue with getting the same normal data as represented in the Blender ViewPort.
Assuming I'm starting with an object (obj), if I collect the normals via;
mesh = obj.data
for v in mesh.vertices:
normal = [v.normal]
The resultant mesh is completely smooth ( 1 normal per vertex )
However if I collect the normals via the loops;
mesh = obj.data
mesh.calc_normals_split()
for loop in mesh.loops:
normal = loop.normal
I then get a split normal, and it's as if the mesh has no smoothing on it at all!
Depending on the edge seam, or the auto-smooth angle, different vertices could have radically different smoothing, so how can I go about getting normals that correctly describe the smoothing of the object as scene in blender?
I've found I can 'hack' around this by manually splitting the mesh at hard angles, but I'd really rather not. Any help is greatly appreciated.