Skip to content

Add camera-relative splat rendering support for large world coordinates#291

Open
WilliamLiu-1997 wants to merge 1 commit intosparkjsdev:v2.0.0-previewfrom
WilliamLiu-1997:v2.0.0-preview
Open

Add camera-relative splat rendering support for large world coordinates#291
WilliamLiu-1997 wants to merge 1 commit intosparkjsdev:v2.0.0-previewfrom
WilliamLiu-1997:v2.0.0-preview

Conversation

@WilliamLiu-1997
Copy link
Copy Markdown

This relates to #287

Large-world precision: add optional camera-relative rendering path

Summary

This PR adds an optional camera-relative rendering mode for large-world scenes to reduce precision loss and make splat handling more consistent across pipeline paths.

Motivation

Several parts of the current pipeline still operate on absolute large coordinates, including generation, view-direction evaluation, depth handling, and final accumulator transforms. In large-coordinate scenes, this can lead to jitter, unstable depth/sorting, and inconsistent behavior between packed, extSplats, and extCovSplats paths.

Changes

  • Add useRelativeCenter in src/SplatGenerator.ts to enable camera-relative rendering
  • Keep public context in absolute-world space, while introducing internal renderContext in src/SplatMesh.ts for relative rendering
  • Rebase center consistently across packed, extSplats, and extCovSplats paths in src/SplatAccumulator.ts
  • Make depth output use the corresponding relative center logic
  • Always apply display.viewOrigin in src/SparkRenderer.ts so accumulator-to-view transforms are consistent across paths
  • Update built-in view-space modifiers to use renderContext.worldToView

Benefits

  • Improves numerical stability in large-world scenes
  • Reduces visible jitter and depth instability
  • Unifies behavior across different splat encoding paths
  • Preserves existing public API semantics by keeping relative logic internal

Notes

  • Disabled by default; must be enabled with useRelativeCenter = true
  • Switching modes rebuilds the relevant generator program cache
  • Custom extensions that assume gsplat.center is always in absolute world space may need review

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.

1 participant