Skip to content

Write linear-space SCALE in GLB export to follow KHR_gaussian_splatting spec#268

Merged
willeastcott merged 1 commit into
mainfrom
fix/glb-scale-linear-space
Jun 22, 2026
Merged

Write linear-space SCALE in GLB export to follow KHR_gaussian_splatting spec#268
willeastcott merged 1 commit into
mainfrom
fix/glb-scale-linear-space

Conversation

@willeastcott

Copy link
Copy Markdown
Contributor

Summary

GLB export wrote KHR_gaussian_splatting:SCALE in log-space, but the KHR_gaussian_splatting spec requires scale to be linear and non-negative:

Scale values are linear and MUST NOT be 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 adds Math.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:SCALE equals exp(input) and is non-negative
  • KHR_gaussian_splatting:OPACITY equals sigmoid(input) and lies in [0, 1]

Fixes #267.

…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>
@willeastcott willeastcott force-pushed the fix/glb-scale-linear-space branch from 92dfd04 to d9493a2 Compare June 22, 2026 18:27
@willeastcott willeastcott merged commit a07f5aa into main Jun 22, 2026
3 checks passed
@willeastcott willeastcott deleted the fix/glb-scale-linear-space branch June 22, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GLB export is not following KHR_gaussian_splatting spec

1 participant