PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6k stars 1.19k forks source link

Simple skinned animation crashes Maya 2017 on export using when enabling skin clusters #766

Closed Lonerobot closed 1 year ago

Lonerobot commented 5 years ago

I have a simple single mesh, single bone, single control object in Maya 2017. I’m trying to export this using the usd export plugin for Maya. (I disabled bifrost to get this working as per instructions)

As soon as I enable export of skin clusters the program crashes . Usdcat looks fine, can import and export mesh data no problem via the pxrUsd Maya plugin. It’s just when I try to enable the skin clusters, animation and skeleton. My aim is to get skinned bone animation written correctly to usd, and this is the only way I can see to do it.

macos, usd v19.03. MacBook Pro, Maya 2017

edit- corrected autocorrect issue

jtran56 commented 5 years ago

Filed as internal issue #USD-5081.

sdao commented 5 years ago

Hey @Lonerobot do you have a repro file that consistently crashes for us to take a look at? It would help to reproduce if we could know the Maya file you're using, the Maya point release (e.g. update 4), and the exact settings that you're using to export (the screenshot doesn't seem to show skeleton/skin clusters being exported?)

Also, when you say "disabled bifurcation", I'm assuming you meant "disabled bifrost", is that right?

I have a very simple test case that seems to work... Here's a screenshot of my setup if you'd like to recreate it: skel_export_example Here's a link to the .ma file if you'd like to test it: skel_export_example.ma.zip

I'm using a recent dev branch build of USD and the Maya plugins, and I tried both Maya 2017 Update 2 and Update 4... they are working ok with my setup. Exporting from the dialog works successfully for me, but this MEL command also works: usdExport -file "/my/usd/file/path.usda" -frameRange 0 60 -exportSkin auto -exportSkels auto It generates this usd file: skel_export_example.usda.zip If you preview that in usdview, you'll see that the usda file matches the ma file.

One thing to note is that your joints need to be under a root transform/group node for them to export properly (the error message isn't super clear on this and there's a bit of logspam, but it shouldn't crash your Maya session).

Hope this helps and please let us know if you have any more details so we can try to figure out the crash that's happening. Thanks!

Lonerobot commented 5 years ago

Hi @sdao,

Thanks for following this up - the joint group seems to have been the issue with the crash, so thanks for that tip. I'll add some proper information this time! I am using maya 2017 with update 4.

I've tried a few different settings and have had a few crashes, but the most consistent export settings are below (the original screengrab wasn't from my maya session)

Screenshot 2019-03-12 at 19 59 04

My character setup is an export from 3dsmax into maya, so there are some null and ctrl hierarchies in there. They are all under the group with the mesh also parented in there too. Perhaps it's the extra rubbish from the FBX transfer into Maya but the animation is correct regardless in Maya.

Screenshot 2019-03-12 at 20 02 34

My resulting export shows the mesh, (and some rig objects) but the animation doesn't appear to follow the bones anymore.

Screenshot 2019-03-12 at 20 19 23

Converting to USDZ via the xcode CMD line tools doesnt yield something viewable via Quicklook. (Appreciate this could well be an Apple implementation issue on how it parses the usdc file)

I've included my maya file and the encoded USDC file below. Thanks for the tips so far, I have at least got rig data into USDC without the crashing issue I reported.

RigFiles.zip

If there is any extra information about the settings i'd be grateful, like the differences between the ar-kit compatibility profile and standard. (i've tried both)

Cheers,

Pete

sdao commented 5 years ago

I still haven't been able to repro the crashing, though I can see some problems the exporter is having with the joint hierarchy in your file.

(Perhaps the crash is Mac-specific for some reason? I've been doing all my testing on Linux. And you just mean a crash in the Maya process during export, right? If you can capture a stack trace to send over, that would help immensely.)

Back to the problem with the exporter: unfortunately, the UsdMaya plugin doesn't handle joint hierarchies that contain non-joint nodes very well. I can repro similar problems with a simple test scene of my own if there are non-joint nodes in the hierarchy.

  1. The first problem it's having is that the plugin only looks for joint hierarchies under "joint" nodes, so it won't export your skeleton/skinning properly. And when it can't export skinning for meshes, it falls back to its default behavior of exporting the mesh with animated "points" (in effect, baking out the animation), so the mesh will no longer follow the bones.
  2. The second problem is that the plugin doesn't look like it's handling the bindPose for non-joint nodes properly, so the skinning is going to be corrupted anyways.

Admittedly, we don't use really use Maya for rigging/animation, so the plugin support is a bit untested when it comes to more complex rigs. Thanks for pointing out some of the issues so that we can take a look. I'll update the bug that we have internally and we'll investigate further when we get the chance. Thanks!

Lonerobot commented 5 years ago

Hi Steven,

Thanks again for the prompt reply. That's good to know, I thought the extra hierarchies were not helping things.

So I thought, If I bake the bones into world space, this should avoid the issue with non-joint nodes. Then I can add them to a group in Maya and add this and the skinned mesh to a Master group?

This is where I now get my crash. Does the bone hierarchy have to be walkable from the root group? Mine is a flat structure of what is essentially baked FK bones. Even on basic rigs you always have constraints driving the various systems, so having a baked export set for realtime has always been my route for game engine animations.

I tried exporting the attached maya file with auto/auto for the skeletons and skin clusters, as well as one where I turned skeleton to the second drop down option under the current group (only under skelroots)

I've attached the crash data in the zip file too so you can see what is going on.

Crash_Dump_Maya.zip

Cheers,

Pete

sdao commented 5 years ago

Hey, so unfortunately we still have not been able to reproduce the crash at all on our machines, even on a Mac running 2017 :( Your crash report indicates that the crash occurs in PxrUsdTranslators_MeshWriter::_WriteRestState here: https://github.com/PixarAnimationStudios/USD/blob/master/third_party/maya/plugin/pxrUsdTranslators/jointWriter.cpp#L564 but we're not sure exactly where. Some thoughts:

As for the issue with the skinning looking wrong, it turns out that it is just an issue with the GL preview of the skinning with Hydra in usdview as far as we can tell (I can't speak to Apple's implementation, though). The GL skinning preview is a bit new so might handle some edge cases like this incorrectly.

To get things to export properly from Maya, you'll have to make a single dummy root node, and then reparent your entire joint hierarchy under that root node in order for the export to pick up the skeleton. Then, in usdview, you can run this in the interpreter: UsdSkel.BakeSkinning(usdviewApi.stage.Traverse()) which will bake out the skeleton to animated points. That bakes out the animation to points, which gives a fairly accurate reproduction of what you see in Maya (modulo a few problem spots). The baking is the "canonical" animation described by UsdSkel.

Hope this helps a bit, Steven

sunyab commented 1 year ago

Closing this out since this is related to the old Maya plugin which has migrated to https://github.com/Autodesk/maya-usd and no longer ships with USD.