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

File size goes to 70mb when exporting gltf with 50 shape keys, and fbx is only 6mb #1581

Closed
butaixianran opened this issue Feb 26, 2022 · 10 comments

Comments

@butaixianran
Copy link

I'm exporting Daz Character from Blender to gltf+bin files. Character is with 50 common facial and viseme morphs, without cloth, hair or animation.

File size of gltf is 2mb, but bin file goes to about 70mb.

If I export fbx from Daz or Blender with morphs, fbx file size is about 6mb.

That's a big difference between 6mb and 70mb.

And if I export gltf+bin file without shape keys, bin file is less than 6mb.

This could make gltf out of game when exporting model from blender to game engines.

Is there a solution for this?


Infromation:
Blender version: 3.0

Daz to Blender bridge for 3.0:
https://github.com/butaixianran/DazToBlender

@scurest
Copy link
Contributor

scurest commented Feb 26, 2022

AFAIK FBX stores shapekey positions sparsely (#1346) and doesn't store normals.

@butaixianran
Copy link
Author

Thanks for your reply, it helps.

Now, I unchecked shape key normal when exporting, bin file is down to 31mb.

Then, we have to wait Sparse Accessors for gltf.

@donmccurdy
Copy link
Contributor

Would it be possible to share the .blend and/or .glb files for this example?

If your game engine supports the EXT_meshopt_compression glTF extension I'd suggest trying to run gltfpack on the model:

gltfpack -i in.glb -o out.glb -cc

@butaixianran
Copy link
Author

butaixianran commented Feb 27, 2022

I updated a blender file also a glb file for testing:

blender file: 108mb
https://mega.nz/file/9n5W3R7I#isbVWh_xI_vnU5JpIppL9f99tOfSkFT8nW5NcrXDgA0

glb file: 75mb
https://mega.nz/file/Rjw2nTKA#boURdDt2AE6DFFFpl3vi8JDks__FuG5JdgMJoU7oknk

There is a Daz Genesis 8 free default character in it, with facial shape keys.

Also thanks for the information about gltfpack. It helps to size down glb from 50mb to 35mb.

But I can't find any information about which gltf importer support "EXT_meshopt_compression" in Unity. Most gltf importer have not been updated for years.

@donmccurdy
Copy link
Contributor

Thanks! glTFast for Unity is the package I'd suggest, and does support EXT_meshopt_compression. I'll look into ways to reduce the file with sparse shape keys as a post-export optimization when I have the chance, or the gltfpack author might be open to implementing that as well.

@julienduroure
Copy link
Collaborator

Closing, as there is no bug here. Only space for enhancement, in case one day we manage sparse encoding.
This is not a priority for now

@donmccurdy
Copy link
Contributor

As an update here — glTF Transform v3 will support writing sparse (mostly zero) data more compactly, and could be a good option for compressing files with shape keys, like this one.

Example, using a pre-release of v3:

npm install --global @gltf-transform/cli@next

gltf-transform sparse input.glb output.glb

I didn't find the original FBX to compare, but this seems to bring the size down to where you'd expect. The .bin file containing the mesh data is now only 4.4 MB.

@mostafamdy
Copy link

Hi @donmccurdy do you know how can I use gltf-transform with threejs

@donmccurdy
Copy link
Contributor

@mostafamdy let's discuss this in donmccurdy/glTF-Transform#882.

@lyuma
Copy link

lyuma commented May 10, 2023

Am I correct in assuming this is a duplicate of:

I'll put my comment there instead.

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

6 participants