Closed bartteunis closed 1 year ago
See Normals under Mesh Structure.\ Also see relevant bpy properties:
Another important thing is that loop normals have to be calculated, see bpy.types.Mesh.calc_normals_split.
Also see this important bit of info on Blender's use of normals: https://github.com/BadDogSkyrim/PyNifly/wiki/Spelunking-the-Blender-Data-Model
See the Alembic exporter's notes on Custom Split Normals of Meshes
The missing piece appears to be the property MeshVertex.use_smooth
. More info on this can be found in this post:: https://blender.stackexchange.com/a/17930
After some thorough testing it turns out that the correct normals are always written to the loop normals after a call to calc_normals_split
and so can be accessed through the MeshLoop.normal
property.
The BMesh library however, which is used in this exporter, doesn't support this (yet, see T45151 - Bmesh module does not support smooth shading / split normals)
This may be the root cause, as the prep_mesh
function makes use of the BMesh library to apply some transformations to meshes.
Another reference to the same issue, confirming the previous comment: https://blender.stackexchange.com/a/249857
Accessing split normals for a bmesh (Edit mode) is unsupported
Always calculate split normals first (Meshloop.normal
) and then export those. Don't use BMesh.
Have a detailed look at all Blender functionality related to normals and shading and adjust the export so it exports the data in a way that the model is shaded the same as in Blender.