I'm trying to extract the vertex normal of a mesh object at a particular vertex. I've noticed that I get different results when using the python API instead of the maya python commands.
Python commands (gives me the result i want):
cmds.polyNormalPerVertex("<myshapename>.vtx[523]", q=True,normalXYZ=True)
The maya python API call (gives me a different result):
# empty selection list
selectionList = om.MSelectionList()
selectionList.add(<myshapename>)
# create empty dag path object
dagPath = selectionList.getDagPath(0)
# get mesh
mesh = om.MFnTransform(dagPath)
# get vertex normal
mesh.getVertexNormal(523, False, space=om.MSpace.kWorld)
I noticed this discrepancy when trying to extract normals on an object whose vertices are on the seam border with another object. The normals have been averaged in maya using Normals > Average Normals
from the Polygons
menu set.
I know it's difficult without an example object, but I'm hoping somebody has seen this problem before.
Can anyone provide a possible explanation for this discrepancy?