Skip to content

Add GPU sphere intersection queries for Gaussian splats#39

Draft
andybak wants to merge 4 commits into
wuyize25:mainfrom
icosa-mirror:pr/intersector
Draft

Add GPU sphere intersection queries for Gaussian splats#39
andybak wants to merge 4 commits into
wuyize25:mainfrom
icosa-mirror:pr/intersector

Conversation

@andybak

@andybak andybak commented Jul 16, 2026

Copy link
Copy Markdown

This PR adds a runtime sphere-intersection query to GsplatRenderer. It is intended
for tools that need to determine whether a world-space sphere overlaps any uploaded
splat, such as selection widgets or spatial interaction tools.

The query transforms the sphere into renderer-local space, dispatches a compute
shader over the uploaded splats, and reads back a one-element hit buffer. Both Spark
and Uncompressed GPU resource layouts are supported.

Public API

bool TryIntersectSphere(Vector3 centerWorld, float radiusWorld, out float score)

The method returns true when at least one splat intersects the sphere. The current
implementation returns a binary score of 1.0 for a hit and leaves the score at
-1.0 when there is no hit or the renderer cannot be queried.

Main changes

  • Add GsplatRenderer.TryIntersectSphere.
  • Add Spark and Uncompressed intersection kernels.
  • Account for renderer transforms, non-uniform scale, splat scale, and the renderer's
    splat downscale factor.
  • Add and dispose a reusable one-element GPU hit buffer.
  • Add the intersection compute shader to GsplatSettings defaults.

Risk and performance

The method performs a synchronous GPU readback through GraphicsBuffer.GetData.
Calling it frequently or once per renderer every frame can stall the CPU waiting for
the GPU. The intended use should therefore be occasional interaction queries unless
the implementation is later converted to asynchronous readback or batching.

The returned score is currently binary rather than a distance or overlap measure.

Suggested testing

  • Test hits and misses with Spark and Uncompressed assets.
  • Test translated, rotated, uniformly scaled, and non-uniformly scaled renderers.
  • Test partially uploaded assets and renderers with no uploaded splats.
  • Test the effect of SplatDownscaleFactor.
  • Profile repeated calls to document the synchronous readback cost.

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