-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Clarify glTF coordinate conversion documentation #22355
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
Clarify glTF coordinate conversion documentation #22355
Conversation
… glTF file follows the standard coordinate system. Added experimental warning.
|
I'm adding this to the 0.18 milestone - it's a docs only change to a feature that was changed substantially in 0.18. |
| /// then created for each node within the glTF scene. Nodes without a | ||
| /// parent in the glTF scene become children of the scene entity. | ||
| /// The scene entity is created by the glTF loader. Its parent is the entity | ||
| /// with the `SceneInstance` component, and its children are the root nodes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Every entity is created by the glTF loader, not just the "scene entity"
SceneInstanceandSceneRootare not part of a scene. If you spawn a scene using theSceneSpawneryou will not have aSceneInstanceor aSceneRoot.
Here's an alternative:
Bevy's glTF loader creates an Entity for each glTF Scene to contain the glTF Scene's nodes. This Scene Entity's children are the entities created from the top-level nodes in the glTF Scene definition. Each node can also continue to have its own child nodes. The Scene Entity that was created to contain the glTF Scene's nodes is the one that becomes rotated.
If you use
SceneRootto spawn the entire scene as a child, that means the Entity with theSceneRootis parent of the full set of Scene nodes described in the previous paragraph, including the Scene Entity. The child Entity of the SceneRoot is the one that is rotated according to the previous paragraph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every entity is created by the glTF loader, not just the "scene entity"
The parent of the scene entity is not created by the loader. I was worried that the user might interpret "scene entity" as the parent entity that they created, so it's worth emphasising that the loader creates the scene entity even if it's arguably redundant.
SceneInstanceandSceneRootare not part of a scene. If you spawn a scene using theSceneSpawneryou will not have aSceneInstanceor aSceneRoot.
The reference to SceneInstance was originally added by Cart. So you're correct and I'm open to changing it, but I'm reluctant to do so without a second opinion. Maybe it was an oversight and should be changed, or maybe there's an assumption that most people use SceneRoot/SceneInstance and that keeps the explanation simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like you agree with the suggested rewrite but want to add SceneInstance into the second paragraph in addition to SceneRoot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree with the suggested rewrite. I think the current description is good enough, assuming most people are spawning scenes via components.
If I feel there's a consensus that the current description isn't good enough, I'd still need to take a different approach - the suggested rewrite doesn't cover another place that references the scene entity:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I think the PR is not sufficient, so I'll leave the change suggestion.
Different documentation sections that are incorrect should also be updated, which is separate from this suggestion and does not affect its relevance.
ChristopherBiscardi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving because the experimental note needs to make it into 0.18, but I maintain the suggested change should be made.
# Objective Add more information to the documentation for glTF coordinate conversion. This tries to address the issues raised in #22209. ## Solution The new docs cover exactly which entities will have a correct `Transform::forward`, assuming the glTF file consistently uses the standard glTF coordinate system for both scenes and nodes. I've also restored the warning that was in the 0.17 documentation: > _CAUTION: This is an experimental feature. Behavior may change in future versions._ This is because: 1. I want to [add node conversion](#22354) in 0.19, and that might involve changing how scene conversion works. 2. Cart has mentioned that [BSN might restructure scenes](#20394 (comment)), which could also change how scene conversion works. Screenshot: <img width="1252" height="1519" alt="image" src="https://github.com/user-attachments/assets/ca37dd14-81f1-4adb-86fe-d8c593956c27" /> If this PR lands then I might do another PR to update the migration guide - I can't update it in this PR as the guides are only in the 0.18 branch.
Objective
Add more information to the documentation for glTF coordinate conversion. This tries to address the issues raised in #22209.
Solution
The new docs cover exactly which entities will have a correct
Transform::forward, assuming the glTF file consistently uses the standard glTF coordinate system for both scenes and nodes.I've also restored the warning that was in the 0.17 documentation:
This is because:
Screenshot:
If this PR lands then I might do another PR to update the migration guide - I can't update it in this PR as the guides are only in the 0.18 branch.