Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export only selected nodes without meshes. #147

Open
1fth3n3ls3 opened this issue Dec 4, 2020 · 2 comments
Open

Export only selected nodes without meshes. #147

1fth3n3ls3 opened this issue Dec 4, 2020 · 2 comments

Comments

@1fth3n3ls3
Copy link

In my current project we usually save animation files in separate files. This animations are applied to a "static" model who contains meshes with or without skin info, nodes (cameras or locators) and deformer nodes (if mesh is skinned).
Animation files usually doesn't contain meshes, just the info of animated nodes. That way the files size is way less than if the meshes were included. Usually a character can have hundreds of animation files. So in the end be able to only export animated nodes without meshes is huge.
I don't know if it would be possible to implement that feature to the exporter. I think, being able to export only animatied nodes without meshes is quite common, so more people could benefit from it. So I really hope you could consider the posibility to add it to the current exporter.

@ziriax
Copy link
Contributor

ziriax commented Dec 4, 2020

That feature is actually already "partially" implemented in the exporter, but has never been fully tested.

Also, GLTF unfortunately doesn't have a "animation only" file format, so the approach below might not be ideal for you.

So here's my approach.

Basically: export the mesh scene once to a GLTF file, and export each animation scene to a single GLTF file.

Details:

  • ask the exporter to split the mesh and animation buffers into different files, by passing the -sma extra flag to the exporter (-splitMeshAnimation). This gives you a GLTF mesh for each GLTF animation. This has the advantage that the animation can be previewed in any GLTF tool. Also the exporter can be asked to output the same GLTF mesh buffers for all scenes, see below.

  • you might also need to pass the -fac flag so that animation channels are created even for nodes that do not animate (as in the base mesh scene, nothing will animation).

  • often each exported animation file will export exactly the same mesh GLTF file. Also the Maya mesh will usually be referenced by the animated Maya scene. You can ask the exporter to use the same filename for each identical GLTF mesh by passing -hbu -sbr. Unfortunately Maya often adds some "tweak" nodes to change the imported referenced scene, and then the mesh will not be identical, so this doesn't always work 100%.

  • I made a .NET Core tool that will re-assemble all separate animations and mesh files into a single GLTF, see Tools/ModelClipMerger

So in summary, to get started, try exporting with -sma -hbu -sbr or -sma -hbu -sbr -fac and see what this gives for you. Then either write your own code to load and re-assemble these, or use the ModelClipMerger tool to do this for you, statically.

This repository also contains MEL scripts for bulk exporting many Maya scenes at once, generating GIFs from Playblasts, etc...

This is all experimental.

PS: If commercial support is needed, feel free to request this, my company offers this.

@1fth3n3ls3
Copy link
Author

Thank you Ziriax for the detailed explanation on how to workaround this issue. I will let you know my advances in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants