-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
GLTF Serializer rework. #15869
Draft
SergioRZMasson
wants to merge
130
commits into
BabylonJS:master
Choose a base branch
from
SergioRZMasson:sergio/new-gltf-exporter-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
GLTF Serializer rework. #15869
SergioRZMasson
wants to merge
130
commits into
BabylonJS:master
from
SergioRZMasson:sergio/new-gltf-exporter-2
Conversation
This file contains 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
…into sergio/new-gltf-exporter-2
…into sergio/new-gltf-exporter-2
…s.ts Co-authored-by: Gary Hsu <[email protected]>
Co-authored-by: Gary Hsu <[email protected]>
…oRZMasson/Babylon.js into sergio/new-gltf-exporter-2
Visualization tests for WebGL 1 have failed. If some tests failed because the snapshots do not match, the report can be found at If tests were successful afterwards, this report might not be available anymore. |
bghgary
approved these changes
Nov 25, 2024
packages/dev/serializers/src/glTF/2.0/glTFMorphTargetsUtilities.ts
Outdated
Show resolved
Hide resolved
packages/dev/serializers/src/glTF/2.0/glTFMorphTargetsUtilities.ts
Outdated
Show resolved
Hide resolved
packages/dev/serializers/test/integration/glTFSerializer.test.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Gary Hsu <[email protected]>
Co-authored-by: Gary Hsu <[email protected]>
Co-authored-by: Gary Hsu <[email protected]>
…oRZMasson/Babylon.js into sergio/new-gltf-exporter-2
sebavan
approved these changes
Nov 26, 2024
I'm temporarily converting this back to draft since we are waiting on @ryantrem, the plan is to merge it next week. |
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.
This PR changes fundamentally how the Babylon serializer to GLTF works. It changes the way the serializer handles left hand to right hand conversion.
Left hand to Right hand conversion
We no longer set mesh nodes with a negative scaling to handle left vs right hand conversion. We instead change every single vertex information when needed (normal, positions, and tangents) if the mesh was created in a left handed scene. We do the same for animation data and node transforms.
This should help decrease the file size of the exported glTF by removing the need for a root node to convert handedness, essentially reverting #13909.
Cameras and Lights
We now collapse cameras and lights with their transform nodes that are added by the Babylon importer. The goal is for the scene to be able to roundtrip without infinitely expanding.
Preserve vertex data
We now avoid as much as possible changing the type of vertex data. If the Babylon scene is holding vertex data using a particular type we will avoid at all cost converting it to float or to any other type. We might apply transformations to the data (such as left to right hand system conversion) but those modifications will be done in place, avoiding as much as possible creating a new buffer.
We also allow meshes that share the same geometry to point to the same accessors in the generated GLTF, se we no longer do any buffer duplication.
This should help significantly decrease some glTF file sizes on roundtrip, as we no longer make copies of buffers nor needlessly convert smaller buffer types to float buffers.
Forum issues
This PR also fixes a couple of bugs from the forum:
Wrong flipping of animated cameras
Inconsistent transform serialization
Instances exporting as separate meshes and #14056