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

This PR adds the option to run the produced gltf export through gltfpack with various options #1945

Merged
merged 17 commits into from
Nov 28, 2023

Conversation

deccer
Copy link
Contributor

@deccer deccer commented Jun 26, 2023

Hi there,

Juan and I thought of extending this plugin with the option to run the exported glTF through the tool gltfpack (aka meshoptimizer). The main motivation is to get ktx2 support.

By default gltfpack outputs regular .glb/.gltf files that have been optimized for GPU consumption using various cache optimizers and quantization and can also compress textures using Basis Universal format stored in a KTX2 container.

gltfpack will output to a subfolder gltfpacked in the folder you exported the glTF to.

For the plugin to be able to run the originally exported glTF, you need to have gltfpack installed on your system somewhere and configure its path in the plugin preferences, then gltfpack relevant options will also appear in the export dialog, where you can also decide if you want to make use of gltfpack or not, among the options you can pass through that tool.

Extension in action:
image

Its preferences too:
image

Any feedback is welcome

@CLAassistant
Copy link

CLAassistant commented Jun 26, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@julienduroure julienduroure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, Thanks for this PR
First of all, I need to check the Blender policy about calling some external tools.

addons/io_scene_gltf2/__init__.py Outdated Show resolved Hide resolved
addons/io_scene_gltf2/__init__.py Outdated Show resolved Hide resolved
addons/io_scene_gltf2/__init__.py Show resolved Hide resolved
@julienduroure
Copy link
Collaborator

(And you should rebase with main branch, as I fixed some bugs after recent changes in Blender)

@deccer
Copy link
Contributor Author

deccer commented Jul 1, 2023

Thank you for taking a look :)

@deccer deccer requested a review from julienduroure July 1, 2023 20:13
@julienduroure julienduroure added this to the Blender 4.1 milestone Nov 4, 2023
@julienduroure
Copy link
Collaborator

Hello,
Can you please rebase with main?
I will merge it soon

@julienduroure julienduroure merged commit b2419d6 into KhronosGroup:main Nov 28, 2023
Comment on lines +224 to +237
export_gltfpack_vpi: EnumProperty(
name='Vertex Position Attributes',
description='Type to use for vertex position attributes',
items=(('Integer', 'Integer', 'Use integer attributes for positions'),
('Normalized', 'Normalized', 'Use normalized attributes for positions'),
('Floating-point', 'Floating-point', 'Use floating-point attributes for positions')),
default='Integer',
)

export_gltfpack_noq: BoolProperty(
name='Disable Quantization',
description='Disable quantization; produces much larger glTF files with no extensions',
default=True,
)
Copy link
Contributor

@donmccurdy donmccurdy Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these two defaults are in conflict. If quantization is disabled, integer vertex position attributes won't work. I think the uses of the "Vertex Position Attributes" flag in gltfpack are very limited — perhaps it would be best to remove that option from the UI, and just show an option for quantization enabled by default?

@julienduroure
Copy link
Collaborator

Thanks @donmccurdy to point it
I will propose a PR soon

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

Successfully merging this pull request may close these issues.

5 participants