Added One Material per Mesh Func & "GlobalBounding" Splitting Strategy - #99
Draft
gojushin wants to merge 4 commits into
Draft
Added One Material per Mesh Func & "GlobalBounding" Splitting Strategy#99gojushin wants to merge 4 commits into
gojushin wants to merge 4 commits into
Conversation
Author
Author
|
Sooo. The issue is that the current BinPacking algorithm, which I reused for this, can't handle the massively higher amount of charts very well, with its O(N²) - O(N³) speed.... I implemented shelf packing, which under O(N log N), handles packing within seconds but is a clear degradation in quality. I am currently looking into how I can combine the two... but this could take a bit of time to get right. Please hang tight :) |
Author
|
In the long run, the only correct way to do this is probably to re-unwrap & bake the reduced parts. But that is likely out of scope here (and not really the point of the repo anyways). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Summary
Adds support for
--single-material-per-parta newGlobalBoundingsplit strategy (--split-strategy GlobalBounding)Single-material mode repacks each tile’s used diffuse and normal textures into a shared atlas, remaps UVs, and emits one material per part.
This is especially useful if the source mesh has UDIMs that are vastly scattered across the mesh.
The
GlobalBoundingsplit strategy creates a stable, source-derived square grid shared across LODs, with optional Z splitting based on the source bounds.Both options are non-breaking changes, as they only extend existing functionality by providing additional CLI args.
Related Issue: None
What I did so far
Remarks
The Atlas Merge does not take into account tint or opacity/alpha values from the .mtl.
In theory the other implementations could handle this better as materials are treated individually, but as far as I can tell the implementations mostly disregarded these too, which... assuming the kind of input we are working with... is fair.
GlobalBoundingSplitting also supportsz-splitting, but functionality for it might work counterintuitively.Inputs are usually way larger in width and height, then in depth. Using
--zsplitwould create a longestSide³ Volume, which would almost always encapsulate all parts of one mesh in height and not perform any splits onz.To provide meaning to
--zsplit, it usessourceBounds.Min.ZandsourceBounds.Max.Z, splitting across the entire height of the mesh.(I documented this in both the code and in the README)