Write linear-space SCALE in GLB export to follow KHR_gaussian_splatting spec#268
Merged
Conversation
…ng spec The KHR_gaussian_splatting spec requires KHR_gaussian_splatting:SCALE to be linear and non-negative, but the GLB writer stored the raw log-space scale values (the internal/PLY convention). Spec-conformant viewers therefore failed to visualize the exported splats. Apply Math.exp() to the scale components on export, mirroring the sigmoid activation already applied to opacity. exp() is always positive, so the non-negative requirement holds by construction. This matches how scale is interpreted elsewhere (the AABB/renderer path exponentiates the stored log-space scale). Add a regression test that parses the exported GLB and asserts SCALE equals exp(input) and OPACITY equals sigmoid(input). Fixes #267. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
92dfd04 to
d9493a2
Compare
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
GLB export wrote
KHR_gaussian_splatting:SCALEin log-space, but the KHR_gaussian_splatting spec requires scale to be linear and non-negative:As a result, viewers that conform to the spec fail to visualize the exported splats. Opacity was already handled correctly (sigmoid activation); scale was simply missing its
exp()activation.Fix
Apply
Math.exp()to each scale component in the GLB writer, mirroring the sigmoid already applied to opacity.exp()is always positive, so the non-negative requirement is satisfied by construction.This matches how scale is interpreted elsewhere in the codebase — e.g. the AABB/renderer path exponentiates the stored log-space scale (
Math.exp(...)), and the coordinate-space transform addsMath.log(s)for a uniform scale.Test
Adds
test/write-glb.test.mjs, which writes a GLB from a table with known log-space scales and logit opacities, parses the binary back, and asserts:KHR_gaussian_splatting:SCALEequalsexp(input)and is non-negativeKHR_gaussian_splatting:OPACITYequalssigmoid(input)and lies in[0, 1]Fixes #267.