Notifications
Clear all

[Closed] Getting Vertex Normal in Trimesh with an Edit_Normals mod

There was a related discussion here but it’s archived. So here is a new one.

I want to be able to get the normals of a trimesh face. With models where normals are calculated via smoothing groups alone, this is quite simple because the getFaceNormal functions seem to accommodate that well.

But once you add an Edit_Normals modifier (or import some models from Maya via FBX) it is challenging to get that data.

If you have a loop that is iterating over a mesh by its faces like this:


for f = 1 to trimesh.numfaces do
(
 
/*Get Face Data*/
 
	 for v = 1 to 3 do
	 (
	   --v = face vertex index
	  )
)

How do you actually get the associated normal data for the vertex in a trimesh face? The problem I see with the example Bobo shared (and as he pointed out) is that the Edit_Normals data has no tri-structure. So a face in the Edit_Normals object could be tied to an arbitrary set of trimesh faces. How do you map the data of trimesh face #N (and its 3 verts) with the correct Edit_Normals face and normal?

1 Reply

Ignore this question… it is easily solved by copying the object and converting to mesh. I had this solution in the past but abandoned it… and my notes mentioned that the normal were always lost when collapsing.

Brain farts run strong in my family. Too much mitichlorian tea I suppose.