Conversation
When UV quantization was enabled (by default) and the input had two identical meshes with two different materials that required different UV bounds, we could mistakenly reuse the encoded mesh data through accessor deduplication; the first mesh that was serialized used the quantization settings. This was fairly rare, as it required one of the materials to also be used on a different mesh so that the combined UV range is different. To fix this, we only deduplicate accessors if the UV quantization settings are compatible.
Because UVs are stored in a quantized form by default, we need to first apply the dequantization transform and only then apply the original texture transform. Our logic was the opposite, and only worked if quantization offset was 0 or if texture transform was offset-only. Note that this relies on the original transform being TRS; if the original transform was TSR, then applying a second non-uniform scale like so: TSR * TS would introduce skew and the resulting matrix will not be decomposable. Currently, three.js is using incorrect order (TSR), but Babylon.js and PlayCanvas correctly implement glTF specification using TRS.
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.
When UV quantization was enabled (by default) and the input had two
identical meshes with two different materials that required different UV
bounds, we could mistakenly reuse the encoded mesh data through accessor
deduplication; the first mesh that was serialized used the quantization
settings.
Also, if the input file had
KHR_texture_transformobjects, the quantizationtransform was not combined correctly with the existing transform: to
preserve the offset, it needs to be transformed according to offset/scale.
This could be masked by the quantization offset being 0.