Skip to content

Skip padding pixels during GSplat sorting and rendering#8471

Merged
mvaligursky merged 2 commits intomainfrom
mv-gsplat-padding
Feb 23, 2026
Merged

Skip padding pixels during GSplat sorting and rendering#8471
mvaligursky merged 2 commits intomainfrom
mv-gsplat-padding

Conversation

@mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Feb 23, 2026

Summary

  • CPU sort worker now operates only on active splats, completely skipping work-buffer padding pixels. An indexMap (built once per world-state change, not per-sort) maps compact splat indices back to work-buffer pixel positions, so the sorted order buffer and distance arrays are sized to totalActiveSplats instead of totalUsedPixels.
  • GPU compaction flag pass rejects padding pixels via a sentinel pcNodeIndex value (0xFFFFFFFF), preventing stale data in unused work-buffer regions from being treated as visible splats.
  • Work-buffer copy shaders (GLSL + WGSL) now write sentinel values for pcId and pcNodeIndex in the padding branch, ensuring padding pixels are never mistaken for real splats regardless of sort path.
  • Last partial-row sub-draw is extended to full row width so the fragment shader covers trailing padding pixels, preventing stale data from previous LODs causing ghost splats with GPU sorting.
  • GSplat count stat now reports only active splats, excluding padding.

Technical Details

  • GSplatWorldState tracks totalActiveSplats alongside totalUsedPixels
  • GSplatManager passes totalActiveSplats for CPU sort paths and GPU compaction element counts
  • Sort worker builds indexMap in the intervals handler and uses it during counting sort output
  • GSplatInfo.updateSubDraws() extends colEnd of the last partial row to textureWidth
  • compute-gsplat-compact-flag.js checks for sentinel nodeIdx == 0xFFFFFFFF before visibility lookup

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the unified GSplat pipeline to consistently treat work-buffer padding pixels as non-splats, reducing CPU sorting work and preventing GPU-side “ghost splats” caused by stale padding data.

Changes:

  • Introduces totalActiveSplats (excluding per-placement row padding) and routes CPU sorting/CPU-compaction to operate only on active splats.
  • Adds sentinel pcNodeIndex = 0xFFFFFFFF (and related shader writes) so GPU compaction/visibility rejects padding pixels reliably.
  • Adjusts work-buffer sub-draw generation to cover trailing padding pixels so they get overwritten instead of retaining stale data.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js Writes pcId and a sentinel pcNodeIndex for out-of-bounds (padding) pixels in WGSL.
src/scene/shader-lib/wgsl/chunks/gsplat/compute-gsplat-compact-flag.js Treats sentinel pcNodeIndex pixels as always invisible during GPU compaction flagging.
src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js Mirrors padding sentinel writes for GLSL.
src/scene/gsplat-unified/gsplat-world-state.js Tracks totalActiveSplats in addition to totalUsedPixels.
src/scene/gsplat-unified/gsplat-unified-sort-worker.js CPU worker sorts only active splats and maps compact indices back to work-buffer pixels via indexMap.
src/scene/gsplat-unified/gsplat-manager.js Threads totalActiveSplats through CPU sort/compaction paths and updates stats to exclude padding.
src/scene/gsplat-unified/gsplat-info.js Extends a sub-draw region to ensure trailing padding pixels are covered by fragment writes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mvaligursky mvaligursky merged commit 3314f93 into main Feb 23, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-gsplat-padding branch February 23, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue performance Relating to load times or frame rate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants