-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Remove side effects from quantize()
#1185
Comments
For others' context -
From your description, I understand why de-duplicating materials breaks your use case. Does "prune" also cause a problem, and if so, what? Quantization creates new materials and accessors, and might leave materials or accessors — that were previously unique and in use — as duplicated or unused, unless we do something to clean that up. I don't want to add any user-facing options that would cause new data to be added but not cleaned up. It could double the size of the file, we can't do that. I think be best solution would be to change |
The The designer gave me a well-designed glTF structure without animation, but the animation data are stored in other glTFs (dynamically downloaded according to different scenes). The animation files require the same node tree structure to work. If the |
Sorry, I underestimated the complexity of quantization. I thought quantization only created new nodes. |
I think this could be fixed very easily by adding the glTF-Transform/packages/functions/src/quantize.ts Lines 127 to 134 in 91f4cdf
I'd be happy to approve a PR for that change if it's useful to you. The remaining issues with let id = 1;
for (const material of document.getRoot().listMaterials()) {
material.setExtras({id: id++});
} Or maybe we could create a new option like |
Thank you, it would be very useful to add a As for
The material names provided by the designer do not follow any special naming convention, which is also difficult to control. |
dedup
and prune
in quantize
functionquantize()
If you wanted to check on this in your assets — I think material names coming from DCC tools like Blender are guaranteed to be unique. That doesn't necessarily mean your three.js materials have unique names (three.js may have to clone some of the original glTF materials) but they'll remain unique in glTF Transform. That'd be a much easier fix than a larger refactor of |
Thank you, this is definitely the simplest and most effective solution to this kind of problem. I will adopt this approach. |
Work continued #1300. |
Is your feature request related to a problem? Please describe.
Some models provided by designers need to maintain their original structure, but
dedup
andprune
functions will destroy the structure of the glTF.Describe the solution you'd like
Add options to disable
prune
anddedup
functions.Describe alternatives you've considered
Add flags to modified nodes and materials,
prune
anddedup
will only destroy the modified data.Additional context
The real-world scenario is that designers have a series of models, and we optimize the material size through quantization. These materials of glTF have the same properties in glTF, so they are removed. However, we actually need to adjust these materials at runtime to achieve different effects in different locations.
So I don't want to run
dedup
function in my glTF process pipeline.The text was updated successfully, but these errors were encountered: