-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Disable mesh compression if vertex position.z
is always 0
#86144
Disable mesh compression if vertex position.z
is always 0
#86144
Conversation
Is it true that a lot of the code assumes mesh compression is on? I am not that familiar. |
e15b4a1
to
fb65ddd
Compare
position.z
is always 0
fb65ddd
to
eca1125
Compare
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.
The code looks good, but it should be in the respective importers, not in the SurfaceTool.
godot/editor/import/3d/resource_importer_obj.cpp
Lines 386 to 387 in 2e7fc81
mesh_flags = 0; | |
} |
godot/modules/gltf/gltf_document.cpp
Lines 2825 to 2827 in 16d6142
if (p_state->force_disable_compression || !a.has("POSITION") || !a.has("NORMAL") || p.has("targets") || (a.has("JOINTS_0") || a.has("JOINTS_1"))) { | |
flags &= ~RS::ARRAY_FLAG_COMPRESS_ATTRIBUTES; | |
} |
godot/editor/import/3d/editor_import_collada.cpp
Lines 999 to 1002 in 16d6142
if (p_mesh->get_blend_shape_count() != 0 || p_skin_controller) { | |
// Can't compress if attributes missing or if using vertex weights. | |
mesh_flags &= ~RS::ARRAY_FLAG_COMPRESS_ATTRIBUTES; | |
} |
eca1125
to
6d190d8
Compare
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.
Looks great! There is just a small typo in your comment. Once that is fixed, we can merge this for 4.3!
6d190d8
to
077e20c
Compare
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.
Looks great! Thank you
Thanks! |
Fixes #85963
As #85963 (comment) mentioned, "We could detect if the z channel is used in the vertex positions, if z is always 0, we could assume the mesh is 2D and disable compression" , this pr is a brute-force way of implementing it. I'm not sure if it's the right place to insert this check, but it seems the suitable place.
Feel free to correct me!