Add OpacityPruneThreshold to remove low-opacity splats at import time#36
Merged
wuyize25 merged 3 commits intoJul 18, 2026
Merged
Conversation
Overdraw from many overlapping translucent splats is the main rendering cost of Gaussian Splatting. Pruning splats whose opacity (after sigmoid) is below a threshold reduces the splat count itself, improving frame rate and also cutting memory usage and load time. As a reference, a threshold of 0.05 removed about 40% of the splats on a real-world scan with little visible change. The default of 0 keeps the previous behavior of loading every splat. - GsplatImporter exposes an Opacity Prune Threshold slider (0-0.99); the importer version is bumped and the threshold is part of the SPZ cache key so changing it triggers a proper reimport - LoadFromPly / LoadFromPlyBytes take an optional opacityPruneThreshold parameter (default 0f), so runtime byte-array loading can prune too - The PLY read loop skips splats below the threshold using a separate write index, then trims the arrays; loading fails with a clear error if the threshold removed every splat - GsplatAsset.SourceSplatCount records the pre-prune count; the importer and the runtime loader test log how many splats were pruned - Currently only supported for .ply import; a warning is logged when a nonzero threshold is set on an .spz asset
Owner
|
Thanks for the PR. I'll review it in a few days. |
Owner
|
I changed the newly added Also, I’d appreciate it if you could implement opacity pruning for the SPZ format as well. |
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.
Motivation
Overdraw from many overlapping translucent splats is the main rendering cost of
Gaussian Splatting. This PR adds an optional Opacity Prune Threshold that removes
splats whose opacity (after sigmoid) is below the threshold at import time. Since it
reduces the splat count itself, it improves frame rate and also cuts memory usage and
load time — this was especially effective in my testing on Quest standalone, where a
modest threshold gave a noticeable frame-rate improvement with little visible change.
As a reference, a threshold of
0.05removed about 40% of the splats on one of myreal-world scans (mostly thin fog-like components). The default of
0keeps thecurrent behavior of loading every splat, and setting it back to
0and reimportingfully restores the original data.
Changes
GsplatImporterexposes an Opacity Prune Threshold slider (0–0.99). Theimporter version is bumped to 2, and the threshold is included in the SPZ cache key
so changing it busts the cache correctly
LoadFromPly/LoadFromPlyBytestake an optional trailingfloat opacityPruneThreshold = 0fparameter, so runtime byte-array loading(added in Add runtime PLY loading from byte arrays #34) can prune as well — existing call sites are unaffected
then trims the data arrays to the surviving count; loading fails with a clear
error if the threshold removed every splat
GsplatAsset.SourceSplatCountrecords the pre-prune splat count; the importerlogs how many splats were pruned (count and percentage)
.plyimport; a warning is logged when a nonzerothreshold is set on an
.spzassetHow to test
Import path
.plyfile in the Project window0.05) and press Apply[Gsplat Import] scene.ply: pruned N / M splats (x.x%) below opacity 0.05,and the asset renders with the reduced splat count
0and Apply — the full original data is restoredRuntime path
The
RuntimePlyBytesLoaderTestcomponent (from #34) now also has anOpacity Prune Threshold field: set it, enter Play mode, and the same prune
statistics are logged for the byte-array loading path (both paths share the same
LoadFromPlyStreamimplementation).Testing done
visual difference is minimal at low thresholds (thin fog-like details go first)
0produces identical results to the previous behavior