Differences with GetNormals from Maya and Max

Hi,
I wanted to export vertex normals from maya and 3ds max. The values that I get seems fairly different.
A simple print from a cube all smoothed (no hard edges), the values from max are obtained using the getNormal (on a editable mesh) and the maya values are obtained with the getVertexNormals (openMaya).
Maya :
[-0.5773502588272095, -0.5773502588272095, 0.5773502588272095]
[0.5773502588272095, -0.5773502588272095, 0.5773502588272095]
[-0.5773502588272095, 0.5773502588272095, 0.5773502588272095]
[0.5773502588272095, 0.5773502588272095, 0.5773502588272095]
[-0.5773502588272095, 0.5773502588272095, -0.5773502588272095]
[0.5773502588272095, 0.5773502588272095, -0.5773502588272095]
[-0.5773502588272095, -0.5773502588272095, -0.5773502588272095]
[0.5773502588272095, -0.5773502588272095, -0.5773502588272095]

Max :
[0,-0.447214,-0.894427]
[0,-0.707107,-0.707107]
[0,0.707107,-0.707107]
[0.707107,0,-0.707107]
[0,-0.707107,0.707107]
[0,-0.447214,0.894427]
[0,0.447214,0.894427]
[0.447214,0,0.894427]

I don’t see the relation between the two, do I miss something ? I’m no expert in vector equation, so maybe there an obvious reason why there so different or maybe they’re not that different. Anyway, help would be gladly appreciated :slight_smile: Thanks

I found the same result in Max using editable poly with polyOp.getFacesUsingVert polyOp.getFaceNormal. Wichi gives me
[-0.57735,-0.57735,-0.57735]
[0.57735,-0.57735,-0.57735]
[-0.57735,0.57735,-0.57735]
[0.57735,0.57735,-0.57735]
[-0.57735,-0.57735,0.57735]
[0.57735,-0.57735,0.57735]
[-0.57735,0.57735,0.57735]
[0.57735,0.57735,0.57735]

So with that method, I’m basically get the average normals from the shared polygons. Which make a lot of sense for me.

Buuuuut I thought getNormal from editable mesh did the same! The API says :

Returns the normal at the indexed vertex’s position as a point3. The normal is based on the faces that use the vertex and the smoothing groups assigned to those faces.

Is the difference could be “Returns the normal at the indexed vertex’s position”, which lead to huge differences!

Anybody knows if I can get the same result in maya, so having a vertex normal at vertex position ?

3ds max doesn’t really support vertex normals like Maya does. I mean, I guess it does if you jump through some hoops. If you create a box primitive, it won’t actually have vertex normals defined. The “GetNormal()” function actually returns an average value of the surrounding face SMOOTHING GROUPS. A non-smoothed box mesh should actually have 24 vertex normals: 3 per vertex, to create the hard edges.

In max, to define, edit, and even get values for actual vertex normals, you need to add an Edit_Normals() modifier. Adding the modifier on the box primitive will initialize the vertex normals based on the face smoothing groups.

en_mod = $box001.modifiers[#Edit_Normals]
normal_cnt = en_mod.GetNumNormals()

for i = 1 to normal_cnt do (
 format "% %\n" i (en_mod.getNormal(i))
)

returns:

Edit_Normals:Edit Normals
24
1 [0,0,-1]
2 [0,0,-1]
3 [0,0,-1]
4 [0,0,-1]
5 [0,0,1]
6 [0,0,1]
7 [0,0,1]
8 [0,0,1]
9 [0,-1,0]
10 [0,-1,0]
11 [0,-1,0]
12 [0,-1,0]
13 [1,0,0]
14 [1,0,0]
15 [1,0,0]
16 [1,0,0]
17 [0,1,0]
18 [0,1,0]
19 [0,1,0]
20 [0,1,0]
21 [-1,0,0]
22 [-1,0,0]
23 [-1,0,0]
24 [-1,0,0]

if I smooth the box and run the same code:

Edit_Normals:Edit Normals
8
1 [-0.57735,-0.57735,-0.57735]
2 [-0.57735,0.57735,-0.57735]
3 [0.57735,0.57735,-0.57735]
4 [0.57735,-0.57735,-0.57735]
5 [-0.57735,-0.57735,0.57735]
6 [0.57735,-0.57735,0.57735]
7 [0.57735,0.57735,0.57735]
8 [-0.57735,0.57735,0.57735]

Which looks like what you’re getting in Maya.

rich

Oh, interesting, adding a modifiers seems like an extra steps but a good workaround when working with an Editable_mesh.
Thanks for the tip.