Home Technical Talk

Get polygon normal in maya (MEL or Python)

polycounter lvl 19
Offline / Send Message
Brice Vandemoortele polycounter lvl 19
Hi guys.
This is probably a very common problem, but I can't find any useful resource on the web :/

I'm building a script that check the visibility of all the faces of a model from a certain camera angle and deletes them if needed. In this case 'visibility' is just testing if the face is 'facing' the camera, not an actual raycasting trough the scene so it should be pretty simple...
The thing is: you can display the face's normal using the custom polygon display, but I can't find a way to get it in script. All I can do is polyNormalPerVertex(), which only outputs the VERTEX normal, as you would guess from its name.
'Simple!' you say. I just need to get the vertices from the face and average their normals BUT that function gives me all the normals from that vertex (there's multiple normals if the vertex is on an hardedge), not only the normal from the face I'm dealing with. I have no idea how to differentiate all the normals queried by the function.
Maybe I'm just taking the complicated path because I don't know anything about the API :)

Any idea?

Replies

Sign In or Register to comment.