-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Merged
SergioRZMasson
merged 152 commits into
BabylonJS:master
from
SergioRZMasson:sergio/new-gltf-exporter-2
Dec 4, 2024
Merged
GLTF Serializer rework. #15869
SergioRZMasson
merged 152 commits into
BabylonJS:master
from
SergioRZMasson:sergio/new-gltf-exporter-2
Dec 4, 2024
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
Co-authored-by: Popov72 <github@evpopov.com>
Co-authored-by: Popov72 <github@evpopov.com>
Co-authored-by: Popov72 <github@evpopov.com>
Visualization tests for WebGPU (Experimental) |
ryantrem
reviewed
Dec 4, 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/src/glTF/2.0/glTFMorphTargetsUtilities.ts
Outdated
Show resolved
Hide resolved
ryantrem
reviewed
Dec 4, 2024
…s.ts Co-authored-by: Ryan Tremblay <ryantrem@msn.com>
…s.ts Co-authored-by: Ryan Tremblay <ryantrem@msn.com>
Co-authored-by: Ryan Tremblay <ryantrem@msn.com>
Co-authored-by: Ryan Tremblay <ryantrem@msn.com>
Co-authored-by: Ryan Tremblay <ryantrem@msn.com>
bghgary
reviewed
Dec 4, 2024
packages/dev/serializers/src/glTF/2.0/Extensions/KHR_lights_punctual.ts
Outdated
Show resolved
Hide resolved
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