How can I compress my FBX file further below 5MB?
To reduce the filesize of a model you’ll first need to know why it is the size it is. Often this is textures, mesh geometry, or animation data. If you export to .gltf
instead of the binary .glb
you should see textures in separate files, and geometry and animations (if any) in a .bin
file.
To reduce the size of textures, you’ll want to use traditional image optimization tools and shouldn’t need to edit the glTF file at all.
To reduce mesh complexity, use a modeling tool (e.g. “Decimate” in Blender), or compress the glTF file using Draco (as you’ve done here). Reducing the size of animation is a more advanced topic.
TheProgrammer
Updated on December 06, 2022Comments
-
TheProgrammer over 1 year
I have an
.fbx
file that takes 58.8MBAfter converting it to a
.glb
using draco compression with this package:https://github.com/facebookincubator/FBX2glTF/tree/master/npm
The file now takes 28.4MB
Ideally, I would need to get the file below 5MB.
How can I achieve that ?
I am using 3DS Max.
The character used to take the whole screen on load, now here is what I see after converting the
.fbx
to.glTF
, reducing the size of the textures from2048x2048
to1024x1024
and converting them to.jpg
:-
emackey over 5 yearsI don't think a >90% compression ratio is realistic, even for the best compression algorithms, given 3D mesh input data. Your best bet may be to reduce the amount of incoming data, by removing fine-grained detail. Some packages call this "decimating" the mesh. It may also be possible to convert high-poly detail to baked normal maps on a low-poly mesh.
-
TheProgrammer over 5 years@emackey Ultimately, I would like to load the model inside three.js to let my users play with it. 5MB is already a lot for most internet connections. I agree that >90% compression is most likely unrealistic, I should have written something to the tune of "the smallest size possible". Do you think it would be possible to gzip a gltf file and unzip it on the client ? What size gains could I get from that in your opinion ?
-
Don McCurdy over 5 yearsIt would be helpful to know what portion of your file size is geometry, and what portion is textures. Try exporting to
.gltf
instead of.glb
to see those separately. Or if you can share the file, that's also helpful. -
emackey over 5 yearsSometimes a lot of the file size comes from textures. If you have PNG textures and can take a small quality reduction, convert them to JPG for smaller sizes.
-
TheProgrammer over 5 years@DonMcCurdy The .gltf is 91KB. All the rest of the 28.4MB is textures...
-
Don McCurdy over 5 yearsIn that case you'll need to resize or further compress the images using the usual image compression tools. This can be done without editing the glTF file.
-
TheProgrammer over 5 years@DonMcCurdy I did that. Loaded the gltf file and now my character seems to have been scaled 1000 times smaller ? I don't understand what happened.
-
TheProgrammer over 5 years@DonMcCurdy Edited question with screenshot of current situation. No errors in console.
-
TheProgrammer over 5 years@DonMcCurdy Would you know how to scale it up ?
-
Don McCurdy over 5 yearsI assume this is three.js? See the three.js docs, you can scale things with
object.scale.set( 1000, 1000, 1000 )
or similar. -
TheProgrammer over 5 years@DonMcCurdy That's the thing. I can't. I tried doing gltf.asset.scale.set(1000,1000,1000), it tells mes scale is undefined.
-
TheProgrammer over 5 years@DonMcCurdy Regardless, this question has essentially been answered now (i.e.: convert to gltf and compress textures, etc...). Only remains for someone to formally do so. In the meantime, I opened a new question for the new issue: stackoverflow.com/questions/51785250/… with my code, hopefully it is a bit clearer that way
-
TheProgrammer over 5 years@DonMcCurdy So, could you please formally answer this question so I can accept your answer and then we can move to the other issue ? You were the one who suggested exporting to .gltf instead of .glb to see how much space the textures were taking.
-
-
TheProgrammer over 5 yearsI would welcome your input on this question if you have any: stackoverflow.com/questions/51773583/…