Skip to content

Conversation

david-lively
Copy link
Contributor

@david-lively david-lively commented Oct 3, 2025

Description

This PR modifies the texture and model import process to comply with Unity's U-right, V-up convention.
The glTF 2.0 spec mandates that textures are anchored at UV (0,0) and the upper-left corner of the texture, with UVs increasing to the right and down. (See https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#images .)
Unity, however, assumes that UV (0,0) corresponds to the bottom-left corner of the image. Previously, the system did not flip either the textures OR the UVs, so it mostly worked, but has caused issues with tangent generation.

In the UV overlay debug images below, the six columns on the left were loaded by Cesium, while the six on the right were loaded by Unity glTFast. These were generated using the same glTF model:

This requires changes to cesium-native in CesiumGS/cesium-native#1259 .

Before this change:
image

After this change:
image

With textures flipped:
image

Author checklist

  • I have submitted a Contributor License Agreement (only needed once).
  • I have done a full self-review of my code.
  • I have updated CHANGES.md with a short summary of my change (for user-facing changes).
  • I have added or updated unit tests to ensure consistent code coverage as necessary.
  • I have updated the documentation as necessary.

Testing plan

Load a tileset. Use Unity's Render Debugger to visualize the Texcoord0 vertex attribute. Observe that UV coordinates increase in the right- and up-direction, and that textures are correctly flipped to match.
image

…UV coordinates to comply with Unity U-right, V-up convention.
@david-lively david-lively requested a review from j9liu October 3, 2025 17:44
@david-lively david-lively marked this pull request as ready for review October 3, 2025 17:44
@david-lively david-lively removed the request for review from j9liu October 3, 2025 17:44
@david-lively david-lively requested a review from j9liu October 3, 2025 17:52
@david-lively david-lively mentioned this pull request Oct 3, 2025
5 tasks
Copy link
Contributor

@j9liu j9liu left a comment

Choose a reason for hiding this comment

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

Thanks @david-lively! I'm still building this locally to test it out, but figured I'd post my comments now.

@david-lively david-lively requested a review from j9liu October 6, 2025 17:33
Copy link
Contributor

@j9liu j9liu left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @david-lively ! Just a few small things that I won't trouble you with; I'll batch into a commit so CI can start running.

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.

2 participants