Maya GLTF export errors

Hi all,

This one is more of a curiosity, as technically its all working.

So normally I use Maya for modelling and animations and use Babylon exporter plug-in to export GLTF. If the models are more complex and consist of more objects - then, when testing it in this viewer:

It reports errors on the model, while technically working fine. (These errors show up for the developer and they say/ask it is best to clean them up.) However, previewing the same files in Babylon Sandbox doesn’t seem to be showing any issues with it. (I’m guessing the donmccurdy viewer reports more techy info)

One workaround I’ve found was to send the model&animations to Blender, use the Clean up Geometry>Desimate Geometry and Degenerate Dissolve, export GLTF from Blender and then the files have no errors.

In Maya, though, everything appears clean, models and normals look fine. I’m hoping to get some insight on what is actually happening on tech side with these models, that I’m missing? Tried researching this, but no real info found.

Attached error report screenshot.

Thanks!

Maybe @PatrickRyan has an idea :slight_smile:

@laine-k-22 , the Babylon sandbox will also report glTF validation issues. You can find the validator in the inspector:

image

As you can see, there are no errors or warnings, but there are 10 info messages such as:

What I am seeing in your output, is that your exported tangents are not unit length, which is likely a rounding error somewhere in the export. Even with some of these errors, your asset may appear to render correctly because the amount of error in the length of your tangents may not be different enough from unit length to actually render incorrectly. Something like a length of 0.999933573 will kick a non-unit-length error but may be so close to 1.0 to not see any difference in the render.

Some things you can try is to export your asset without tangents if those are the things kicking the errors. Including tangent data is not necessary unless you are seeing rendering errors when not exporting them. The tangents will be automatically computed by engines that accept the glTF format and not exporting that data will make your asset smaller depending on the number of vertices in your asset.

If you need tangent data, you can try a mesh cleanup operation to see if you can get rid of any data that is throwing off your tangent length. This type of operation could force Maya to recalculate the normals and tangents to clean them up.

Another option could be to use a simplistic file format as a way to clean up your mesh. There are times when I am having problems with mesh data where I will export the mesh to obj, which is a simple enough format to remove anything that could be screwing up your mesh data. Then re-importing that obj mesh and replacing the original is a good way to strip out anything bad in the mesh, but this kind of operation will also eliminate history.

Deleting non-deformer history is another way to clean up meshes, which is pretty painless. You lose your history, but it may also be enough to clean up data like this. I mention deleting non-deformer history because delete history will also delete animation keys stored on an object, where deleting non-deformer history will leave animation keys alone. If your mesh does not have any deformers, including any animation keys, either will work.

Unfortunately, since our exporter is just a plug-in, we don’t have access to the entirety of the Maya engine and so it’s really difficult to ensure the glTF will always be valid when exporting. I would guess that any native glTF export support would be more consistent in exporting valid glTF files, and notice that those DCC tools that have native support have far fewer instances of invalid glTF exports.

I wish I had a more definitive answer here, but the reality is that it’s really hard to debug why a tangent or normal may not be unit length in Maya. The best options would be not to export non-unit data if able, delete mesh history, use a mesh cleanup operation, export the mesh to obj and then re-import to clean it up, or to move your mesh to another DCC like Blender to cleanup and export.

Thanks for taking the time, very insightful!
I’ll have to add an extra step of trouble-shooting and cleaning a mesh before animating to my workflow, which I didn’t realize I would need (woops :sweat_smile:).

1 Like