-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[3.x] Added Mesh Compression Import Options #48625
Conversation
Are you familiar with the quantize options in mesh optimizer? https://github.com/zeux/meshoptimizer#vertex-quantization |
Oh no I had not run into this before! From reading through, this is an external tool for optimizing mesh data correct? Is this integrated into godot already? Some cursory searching led me to see it being used for LOD generation What this PR does right now is just expose the existing ARRA_COMPRESS_* enums/functionality in the editor - do you think there's a way to pipe meshoptimizer up to these import options for example? |
So meshoptimize quantize code is already in Godot Engine but not exposed. The standard pattern is expose a pointer in surface tool. Add the implementation in mesh optimizer and use the function. Try it out! |
63709bf
to
389e8d0
Compare
Seems like you need to update the glTF module too:
|
Oh I was wondering where the gltf importer went when I rebased! Thanks for the heads up I didn't notice it moved, I'm working on updating the PR right now, thanks! |
389e8d0
to
3e65801
Compare
@akien-mga I updated this PR to fix the docs, add the GLTF, and the option to enable/disable octahedral vertex compression One thing I'm wondering ender user experience wise is whether we should provide the octahedral compression option at all because I'm worried that it might be confusing. The current options matrix looks like:
Based on the rendering quality though I'm leaning towards removing the option and always having it enabled, as rendering quality wise this is what we are looking at (see godotengine/godot-proposals#2395 (comment) for photo reference/context): Best Quality (these two are equivalent): Ok Quality: Lower Quality (but still acceptable in a majority of cases): Since oct32 has the same quality as totally uncompressed float32x3 while at the size of ok quality unorm8x3, that's why I suggest it should always be chosen What are your thoughts - should we just give the users all the choice or would it be reasonable to make it always on by default? |
I thought mesh compression already made it in. Is this PR still relevant? |
ClassDB::bind_method(D_METHOD("import_gltf_scene", "path", "flags", "bake_fps", "state"), | ||
&PackedSceneGLTF::import_gltf_scene, DEFVAL(0), DEFVAL(1000.0f), DEFVAL(Ref<GLTFState>())); | ||
ClassDB::bind_method(D_METHOD("pack_gltf", "path", "flags", "bake_fps", "compress_flags", "state"), | ||
&PackedSceneGLTF::pack_gltf, DEFVAL(0), DEFVAL(1000.0f), DEFVAL(0), DEFVAL(Ref<GLTFState>())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the default value be Mesh::ARRAY_COMPRESS_DEFAULT
here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
I think it is, though it's a bummer that it got limbo'ed for so long and now we're so close to the 3.4 release. This PR makes it possible to toggle octahedral compression at import time, while currently it's forced on, unless you tweak compression flags manually in an import plugin I suppose. Given that there are regression cases with octahedral compression enabled, that does seem like something important to include. |
3e65801
to
4844ef6
Compare
Fleshed out the "Optimize Mesh" options found in the mesh import UI Gave a checkbox to every vertex attribute that can be compressed Surfaced option to enable/disable Octahedral compression for normal/tangent vectors Also surfaces the vertex position compression option which previously inaccessible because the defaults did not compress vertex positions Supports all current importers (obj, fbx, collada, gltf)
4844ef6
to
203295f
Compare
Thanks! |
Fleshed out the "Optimize Mesh" options found in the mesh import UI
Gave a checkbox to every vertex attribute that can be compressed
Also surfaces the vertex position compression option which previously
inaccessible because the defaults did not compress vertex positions
Supports all current importers (obj, fbx, collada, gltf)