I can't find a way to achieve custom split normal effect. I want to use python (mesh normal/hard edge or soft edge) data collected from Maya then write to Blender mesh.

How to do it using the following Python API and how?


bmesh module


Custom Split Normals

Elaborating on this answer and here

Test script. Run in object mode. Switch to edit mode to see results.

import bpy

context = bpy.context
ob = context.object
me = ob.data
# visualize in edit mode    
me.show_normal_vertex = me.show_normal_loop = True
me.use_auto_smooth = True
# normal custom verts on each axis
me.normals_split_custom_set([(0, 0, 0) for l in me.loops])

enter image description here end up with custom split normals in each of the corner directions. Blue are the vert normals

# all custom split normals pointing up.
normals = [(0, 0, 1) for v in me.vertices]
# make csn's all face up.  

enter image description here all custom split normals facing up (0, 0, 1)

I am not aware if custom split normals can be accessed from bmesh.

  • $\begingroup$ really appreciate, I got your idea, and to get a hard/soft edge effect, except setting custom normal split, what else I need? setting sharp edge? $\endgroup$ – Xuqiang Zhang Mar 22 '18 at 1:15
  • $\begingroup$ I try it, and I think it is no need to mark sharp edge, I get same hard/soft edge effect like same mesh in Maya.what's your idea? $\endgroup$ – Xuqiang Zhang Mar 22 '18 at 1:38
  • $\begingroup$ @XuqiangZhang forgot to mention needs to be run in object mode. $\endgroup$ – batFINGER Mar 22 '18 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.