Avoid MfnMesh.create removing (degenerate) triangles?

Avoid MfnMesh.create removing (degenerate) triangles?

vidar.rinne
Contributor Contributor
962 Views
3 Replies
Message 1 of 4

Avoid MfnMesh.create removing (degenerate) triangles?

vidar.rinne
Contributor
Contributor

Hello,

I'm working on writing a mesh (our proprietary format) back to Maya and it is very important that the result is identical to the input I gave MfnMesh.create, which in my case it is not. I know that my input does not fulfill all Maya's conditions of being a valid mesh, several triangles have zero area and some are identical.

This is from the Maya documentation:
"

  • If the vertex connection list for a polygon specifies an edge with the same start and end vertices, those edges will be removed. (ie. a polygon specified as 1 2 2 3 4 will be transformed into 1 2 3 4).
  • If the same vertex appears in the vertex connection list for a polygon more than once, another vertex will be created at the same location, and the list will be altered to use the copy. (ie. a polygon specified as 1 2 3 1 4 will be transformed into 1 2 3 5 4, where 5 is in the same location as 1).

"

Is there some other way to get my hands on the fields? Adding polygons or splitting vertices post creation will not work in this case, as the structure of the mesh is critical (indices of various fields must remain untouched). This will most likely be too slow as well...

(This is already done for 3ds Max and works very well)

 

Maya SDK (2020), C++

 

Any help would be appreciated!

 

Thanks!

0 Likes
963 Views
3 Replies
Replies (3)
Message 2 of 4

jmreinhart
Advisor
Advisor

Meshes in Maya always have to fulfill those requirements. An edge can't have both ends as the same vertex and a polygon can't have the same vertex twice. The isn't a way to create a mesh like that using the API or the interface. The only thing you may be able to do is use the MPxSurfaceShape to create exactly what you need without those constraints. 

 

There might be other workarounds that would work, but I'd need to know why you need edges and faces that don't fit within those limitations to be able to help more than that.

 

0 Likes
Message 3 of 4

vidar.rinne
Contributor
Contributor

Imagine that you have your original mesh in Maya and by using some tool you reduce the mesh (less triangles and vertices). Now you want to transform or blend the original mesh to the reduced mesh using some slider. To be able to make this transition there is an intermediate mesh that has the tri count of the original mesh and the shape of the reduced mesh. This intermediate mesh has some "degenerate" triangles but that is how it is supposed to be (as they are not supposed to exist in the reduced mesh, althou must be there for blend purposes).

0 Likes
Message 4 of 4

jmreinhart
Advisor
Advisor

So why couldn't the blend geo have the same topology (face/edge/vertices) as the hi-resolution geometry? I guess I'm imagining the bend geo looks like the hi-res geo shrink wrapped on to the lo-res.

0 Likes