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

Deduping textures resolution callback #108

Closed
Inviz opened this issue Oct 8, 2020 · 4 comments
Closed

Deduping textures resolution callback #108

Inviz opened this issue Oct 8, 2020 · 4 comments

Comments

@Inviz
Copy link

Inviz commented Oct 8, 2020

I like the deduping feature! Really useful. However one thing i've had is that i use multiple glb files with resources packed in, and merge them together. Sometimes some of them have slightly outdated versions of shared textures baked in. I wonder if there could be some sort of a callback to tell that texture is the same (e.g. by filename), instead of contents.

@Inviz Inviz changed the title Deduping textures resolution Deduping textures resolution callback Oct 8, 2020
@donmccurdy
Copy link
Owner

donmccurdy commented Oct 8, 2020

Are you using the dedup function through the CLI, or in a script? If the filenames really are 100% the same then they presumably refer to the same file on disk. This might be an unusual enough situation that I'd recommend scripting with the glTF-Transform API instead of using 'dedup' function directly, but if it turns out that it's not easy to do that, I am glad to help figure out how to make it easy. :)

@Inviz
Copy link
Author

Inviz commented Oct 8, 2020

I'm using it in a script, but the textures are already baked in to the files (which i guess is something i shouldn't do so i can avoid this issue altogether).

Okay, let me try to switch my workflow to avoid baking in textures into glb files, i think that's reasonable approach. Thanks for consideration and suggestions.

@Inviz
Copy link
Author

Inviz commented Oct 9, 2020

So it looks like Blender does not allow me to save glb/gltf files without packing/exporting unique images. So if I've got two files using same texture, the image will be packed into each of files bundles. And if I update one of the files, with new version of image, now i have undedupable images. So the only solution is to each time texture is updated, is to re-export all files that use that image and run dedupe script after merging. Which isn't nice. I wish i could dedupe textures by texture/material name or something... but that might be too specific of a task for your lib.

Actually, maybe what I really want is to dedupe materials by various criterias (like name). gltfpack does it by values, not by names. Ok so I guess i'll just write a script for that. I think this ticket can be closed :)

@donmccurdy
Copy link
Owner

So it looks like Blender does not allow me to save glb/gltf files without packing/exporting unique images.

It should be possible to avoid this, if you pre-pack the images in the way that Blender needs before exporting. For example, the roughness/metalness and baseColor/alpha maps will have to be combined. There may be other things involved, or that Blender could improve, see KhronosGroup/glTF-Blender-IO#1099 for some discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants