When to triangulate in a pipeline

When you’re working with the bulk of your mesh asset files with WIP states, when and where do you store your triangulation? Are people relying on export script triangulation or do you store your source mesh separate from your triangulation mesh? How do you recover time spent hand turning triangles when you know you’re going to need to edit that mesh again?

A big difference between Maya and MAX is MAX is always storing triangles, just hiding them unless you want to see them. Maya stores polygons, so they are triangulated on demand, based on it’s internal triangulation.

For Maya pipelines, there isn’t an ideal solution that I am aware of. We generally let the export pipeline handle triangulation.

If your talking Maya, you can create a triangulation node that will override the in-built Maya triangulation. If you can compile C++ then you can use the “polyTrgNode” plugin, otherwise you will have to port it to python. The default code will stop Maya from making optimal triangulation and use the vert order.

How is the data being exported? In a standard format, like fbx? In a proprietary binary format you create? In some other format?

I’d generally leave it to the engine importer to handle triangulation. So the intermediary format (fbx collada etc.) is non-triangulated and then the engine can choose the optimum triangulation for its needs when that data is built. If the artists want to ensure any faces are triangulated in a particular direction then they can add those edges explicitly i.e. where triangulation might have a significant impact on the silhouette or tangent basis. I’d say those cases are relatively rare on reasonably dense meshes though.

Our intermediate format is FBX and I had been relying on the built FBX triangulation as our current models generally have complete edge loops without any hand tuned optimizations. I came from a 3DS max house where we did keep an extra edit stack as necessary for our ultra low poly Nintendo DS models, but in a Maya environment I hadn’t found a better solution. The suggestion to add certain edges as necessary seems reasonable, I just have been wanting to avoid wrecking the edge loops without necessity since these models are far from done.

Unfortunately Maya’s Quadrangulate function does not do a good enough job to ‘reverse’ a triangulation, so you don’t have a non-destructive way to toggle between a quad mesh and a triangle mesh. You can, of course insert a triangulate node and then delete it later - you could triangulate it at export time that way without changing the WIP model. You won’t be able to persist any hand tuning if you go that route, you’ll just get the default Maya triangulation . On the other hand if the models really are WIPs then you don’t want to waste people’s time hand tuning the triangulation anyway: it’s work that will be invalidated so often that it’s not worth doing.

You can also ‘branch’ a model by creating a dummy mesh (a cube or something) and feeding the .outMesh of your real model into the .inMesh of that second mesh. The second guy will get the complete state of the first (including all it’s edits and history) but can have a history of it’s own downstream from that. So you could triangulate that one without deleting the edge loops on the other. You’ll still have to deal with hand tweaks that become wonky when upstream topology changes

We’ve always found that simply writing out the existing “live” triangle information using the API on export works best rather than baking them. In that way the artists work in Quads/NGons and can triangulate any particular areas they wish to be artist controlled if needed. The artist can always see the “live” triangulation simply by switching the Shape nodes .displayTriangles on to preview them.