# How to serialize Mesh Normals? [Both Split Normals and Averaged]

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.

• Your second snippet correctly fetches the normal at every corner. I couldn't understand what you said was wrong with it. May 10 at 12:05

Wow okay I found an answer.. I'm an idiot.

The second strategy of calculating the split normals works as desired.

I was RecalculatingNormals(); in my CSharp importer script....