Drive splat orientation from DataTable.transform instead of per-format hardcoding#885
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes how SuperSplat determines the initial orientation of loaded splat assets by using the authoring-frame transform provided by @playcanvas/splat-transform readers, instead of hardcoded per-format orientation logic in the editor. It also switches the Splat constructor to accept/apply a quaternion rotation directly to avoid Euler ambiguity and unnecessary conversions.
Changes:
- Removed per-format
getOrientation(filename)logic and now drive orientation fromDataTable.transform. - Updated
loadGSplatDatato return{ gsplatData, transform }and threaded that through the asset loader. - Updated
Splatto take aQuatand apply it viasetLocalRotationinstead of Euler degrees.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/splat.ts | Updates Splat construction to take/apply a Quat rotation (replacing Euler-based orientation). |
| src/io/read/loader.ts | Changes loadGSplatData to return both converted GSplatData and the source Transform. |
| src/asset-loader.ts | Removes hardcoded orientation switch and passes transform.rotation to Splat. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
getOrientation(filename)switch inasset-loader.tswith thetransformreturned by splat-transform's readers, so each format's authoring frame is described by data rather than baked into the editor.loadGSplatDatanow returns{ gsplatData, transform }; the asset loader hands theQuatrotation straight toSplat.Splat's constructor takes aQuatand applies it viasetLocalRotation, replacing the previousVec3Euler +setEulerAngles(avoids the deg→quat→deg round-trip and removes Euler ambiguity).Why
The
getOrientationswitch returned(0, 0, 180)for PLY/splat/KSplat/SOG,(90, 0, 180)for LCC, and(0, 0, 0)for SPZ. Splat-transform already tags every DataTable with the correct authoring-frameTransform(PLY/splat/KSplat/SOG/SPZ →Transform.PLY = (0, 0, 180); LCC →(90, 0, 180)), so the per-format switch was duplicating information that the loader already provides — and the SPZ entry was wrong (this is what made SPZ files load 180° rotated relative to the equivalent PLY).Compatibility
Requires
@playcanvas/splat-transformwith the SPZ coordinate-system fix (in flight at playcanvas/splat-transform#230). With that version, SPZ files load with the same(0, 0, 180)orientation as PLY and the two render identically.Test plan
.plyscene — orientation matches previous behavior..spz— now orients identically to the PLY (was 180° around Y before)..lccscene — orientation matches previous behavior (90, 0, 180)..sog,.compressed.ply,.ksplat,.splat— all orient as before.