Answered

Exporting FBX without the model

Adam 3 years ago updated by Peter - Soxware Developer 3 years ago 9

Hello,

I'm importing FBXs with animation files and no meshes from my motion capture software. I'd like to export the animations back into an FBX (can be new or update existing) once I've modified the animation. When I export to an FBX it includes the mesh and other game objects within my player object into the FBX which I do not want.

My desired FBX output would only include an empty Reference GameObject (if necessary) and the animation file.

I do not want to export only the .anim file as it'll be much larger than the compressed version stored in an FBX and take up a lot of space within my project. I have thousands of animations and the storage space increase would be far too large.

UMotion Version:
1.28
Unity Version:
2021.2.10

Answer

Answer
Answered

Hi,

thank you very much for your support request.

In my experience, when you want your animation to be compatible with humanoid, exporting your animations with a mesh results in less problems. Unity automatically creates a working humanoid avatar for you, which is not always working that great for animation files that have no mesh assigned to them. You can export multiple animations into a single FBX file if you don't want to have the same mesh over and over again.

If you really don't want to have a mesh in your FBX file, just select the original FBX file that you've used to import your animation as destination file. The skeleton hierarchy present in that FBX file is kept. UMotion does not add any mesh data.

There is also a mode to export as a fresh FBX file in UMotion (in the settings, simply change the "Write Mode" to "Export As New File"). This also includes no mesh data. Make sure to add a T-Pose as a first frame, otherwise Untiy's humanoid animation system most likely does not create a working humanoid avatar for that animation.

Further reading

Export settings: https://www.soxware.com/umotion-manual/ProjectSettings.html

Export feature: https://www.soxware.com/umotion-manual/ImportExport.html

Please let me know in case you have any follow-up questions.

Bets regards,
Peter

Answer
Answered

Hi,

thank you very much for your support request.

In my experience, when you want your animation to be compatible with humanoid, exporting your animations with a mesh results in less problems. Unity automatically creates a working humanoid avatar for you, which is not always working that great for animation files that have no mesh assigned to them. You can export multiple animations into a single FBX file if you don't want to have the same mesh over and over again.

If you really don't want to have a mesh in your FBX file, just select the original FBX file that you've used to import your animation as destination file. The skeleton hierarchy present in that FBX file is kept. UMotion does not add any mesh data.

There is also a mode to export as a fresh FBX file in UMotion (in the settings, simply change the "Write Mode" to "Export As New File"). This also includes no mesh data. Make sure to add a T-Pose as a first frame, otherwise Untiy's humanoid animation system most likely does not create a working humanoid avatar for that animation.

Further reading

Export settings: https://www.soxware.com/umotion-manual/ProjectSettings.html

Export feature: https://www.soxware.com/umotion-manual/ImportExport.html

Please let me know in case you have any follow-up questions.

Bets regards,
Peter

Hi Peter,

If I select the FBX file I used to import the animation and export it to that, it fails saying it's looking for a GameObject that is within my player that is not within the original FBX.

If I choose to export to a new file it succeeds but the output FBX includes the GameObjects that are present inside my player object in the hierarchy of the scene. It also doesn't include an avatar.

Is there a setting I'm missing so it behaves as you described?

If I select the FBX file I used to import the animation and export it to that, it fails saying it's looking for a GameObject that is within my player that is not within the original FBX.

If I choose to export to a new file it succeeds but the output FBX includes the GameObjects that are present inside my player object in the hierarchy of the scene.

I could add a setting to UMotion in the meaning of "Ignore on FBX export". When enabled on a bone/transform, this bone/transform and any of it's children would not be included in the exported FBX file. Would that be any helpful?

Other than that, the current behavior is intended. The character you animate should be setup exactly like you want it to be present in the FBX file.

It also doesn't include an avatar.

An avatar is a Unity proprietary thing that does not exist within the FBX file format. The avatar is created by Unity on importing the character. Make sure you have your import settings setup correctly, having a mesh in the FBX file usually helps Unity to create a better avatar automatically. Without a mesh, having a T-Pose as reference pose (the pose shown in config mode) and a T-Pose as first frame in an animation also helps Unity to create a correct avatar automatically.

Best regards,
Peter

Hi Peter,

We will have many different meshes (think skins/outfits) that the player can choose from and will have close to a thousand different animations throughout our game. So we'll need to keep the animation files separate from the character FBXs. Our interest in exporting to an FBX is to keep the size of the animation file down while it's on our disks and in our source repository. You can imagine the problems one thousand animations will create if their individual file sizes are increased non-trivially.

If you were able to add an option where we could export to an FBX that just contained the animation file and would work (we could preview using our own model or "Unity Guy" in the animation preview window in the editor) that would be great. I can send you one of our animation FBXs if that would help. Essentially if the below screenshot is what we imported into UMotion, we'd get the same thing on export.

If you were able to add an option where we could export to an FBX that just contained the animation file and would work

Afaik the FBX always needs to have the complete rig/skeleton that is actually driven by the animation that is included in the FBX file (but it does not have to have a mesh of course). Please note that the preview of the hierarchy shown in Unity's project window is only 1 level deep. Drag and drop the FBX into the scene, to see the complete skeletal hierarchy.


UMotion is using the GameObject that is assigned to the Pose Editor to generate the rig/skeleton when exporting to a fresh FBX. UMotion itself isn't capable of writing mesh data (it can only preserve mesh data when exporting into an existing FBX file).

So if your GameObject assigned to the Pose Editor has the correct skeleton, you can decide to either export as a fresh FBX or override an existing FBX with the same skeleton.


If this doesn't play nice with your workflow, please provide a dedicated example so that I can look into a solution for that specific one. Best would be to create a small example project (a fresh Unity project that includes just the files I need to recreate your situation on my end) and send it to me via the email support form. If file size is >25MB, please upload to a cloud storage or request a link to my Dropbox via the email form.


Best regards,
Peter

Hi Peter,

I've filled out the linked support form with a link to the project.

Hi Adam,

thank you very much for sending me the files.

There are a few technical things I should explain to help you better understand that what you're trying to do doesn't work the way you expect it:


The animation's FBX file is a skeleton rig with an animation but without a mesh. When you place it into a Unity project, Unity is going to import the FBX file based on the import settings you've defined in the inspector. If you set the import settings to "humanoid", Unity is going to create a humanoid Avatar and convert the animation into a humanoid animation.


Please note that the humanoid avatar is created by Unity and does not exist in the actual FBX file. The animation that you now see when you unfold the FBX file in Unity's project window, is in humanoid format and isn't the original animation that is actually in the FBX file anymore.

The humanoid Avatar is based on the avatar settings you see when you click on "Configure..." in the Rig tab of the import settings. As a side note, Unity usually does a great job to create this avatar settings automatically, but there are also cases where you have to manually adjust these settings (especially when the FBX file contains no mesh data). The humanoid avatar is used to "abstract" the animation in a way that it can be assigned to other characters that are defined as humanoid as well. This is called animation re-targeting and is purely happening in Unity "world".

Learn more how Unity's humanoid animation system achieves animation re-targeting: https://blog.unity.com/technology/mecanim-humanoids


The raw animation inside the FBX file would not be compatible with the character you currently use for animating as the animation's FBX file uses a completely different skeleton than your character (see picture below). Assigning the animation is only possible due to Unity's humanoid animation system, which converted normalized the animation during import in a way, that it can be assigned to other humanoid characters.

Left is your character's skeletal structure, right is the one of your animation's FBX file.

When working with UMotion, you assign your character to the pose editor and then import the animation from the FBX file (to be more precise, you import the humanoid version of the animation that originally was inside the FBX file). What's happening under the hood is that the humanoid animation system is re-targeting the animation to be compatible with your character. The result is an animation that now uses the skeleton of your character.


If you now try to write the animation back into the animation's source FBX file, you get an error because that animation's original source FBX file contains a completely different skeleton than the one inside your UMotion project. So as mentioned before, this is technically not possible.


FBX does not support animation re-targeting by itself, so there is no way to export into an FBX file that has a different skeletal data than the animation you are trying to export.

------------------


What to do instead:

  • Duplicate your character's FBX file.
  • Open the FBX file with your favorite 3D modeling application and remove the mesh data (but keep the skeletal data)
  • Use the resulting FBX file (or multiple instances of it if you want one FBX per animation) as destination file for your animation exports. As you might already guessed, this FBX file now contains the correct skeletal data and is thus capable of receiving the animation export.
  • Hint: In the import settings of this FBX file, make sure to set "Avatar Definition" to "Copy From Other Avatar" and select your character's avatar (the file that has the mesh). As mentioned before, Unity most likely won't create a correct avatar for you in this case where you are missing mesh data.


I hope this better helps you understanding the issue. Let me know in case you have any further questions.

Best regards,
Peter

Hi Peter,

Thank you for the information and background. In the screenshot you provided, why does the Reference object within the animation have a skeleton? The FBX included in the project I sent has an empty Reference object with no skeleton.

While I believe I understand everything you're saying, we're perfectly fine to do dynamic retargeting and we don't want an animation to be specific to a character's rig as we will apply these animations on many different character's with different rigs. It would not be feasible to have duplicate animations for each character's rigs. As you described, Unity is going to retarget this for us and we've been happy with the results thus far.

Ultimately what we're looking for is for the animation clip to exist within an FBX for compression purposes. If there is another means of compressing the animation file when exported we'd be happy to pursue that as well. I would hope I'm correct in assuming it's possible to put an .anim inside an .fbx as the motion capture software that's generating the FBX I included in the project does this.

Is it possible to make UMotion blindly export the .anim file into a desired .fbx file?

Thank you for the information and background. In the screenshot you provided, why does the Reference object within the animation have a skeleton? The FBX included in the project I sent has an empty Reference object with no skeleton.

Because of this (quote from a previous post of mine):

Please note that the preview of the hierarchy shown in Unity's project window is only 1 level deep. Drag and drop the FBX into the scene, to see the complete skeletal hierarchy.

Looking at the Unity project window, you only see the bone named "Reference". The FBX file does have a complete skeleton (and has to, technically speaking). To see the entire hierarchy, place it in your scene (that's how I've taken the screenshot).


While I believe I understand everything you're saying, we're perfectly fine to do dynamic retargeting and we don't want an animation to be specific to a character's rig as we will apply these animations on many different character's with different rigs. It would not be feasible to have duplicate animations for each character's rigs. As you described, Unity is going to retarget this for us and we've been happy with the results thus far.

An FBX file itself is not capable of re-targeting. It always has to have a dedicated skeleton for the animation included. So whenever you want to export to a new FBX, you have to decide on a skeleton you want to include. Also mo-cap software adds a skeleton to the file. When exporting to an existing FBX file, you have to export using the same skeleton as the one already included in the file.

As soon as the FBX file is imported by Unity (and configured as humanoid), it creates a "normalized/re-target able" humanoid animation out of it which can be assigned to any character.

So no you do not have to create one FBX file for every of your characters, but you have to decide on one character you use for authoring your animations and export based on his skeleton.

Is it possible to make UMotion blindly export the .anim file into a desired .fbx file?

No, an *.anim file is Unity proprietary. I think what might confuse you is assuming that the thing you see when you expand an FBX file inside Unity is the content of the actual FBX file. This is not the case. What's beeing displayed is the content Unity created based on the FBX file during import. Imported animations for example are converted to Unity's *.anim format, new things like the avatar definitions are added etc.

If you want to check what's actually inside the FBX, use a tool like Max or Maya to open the file.

Best regards,
Peter