Skip to content

refactor: read SOG gsplat data directly from source textures#8628

Merged
mvaligursky merged 2 commits into
mainfrom
mv-sog-direct-source-textures
Apr 21, 2026
Merged

refactor: read SOG gsplat data directly from source textures#8628
mvaligursky merged 2 commits into
mainfrom
mv-sog-direct-source-textures

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Removes the packed-texture intermediate step for SOG gsplat assets. Splat data is now read directly from the original means/quats/scales/sh0/sh_labels/sh_centroids textures, and V2 codebooks are packed into a single 256x1 RGBA32F LUT texture for in-shader lookups.

Motivation:

  • The packed format offered no meaningful perf win, cost extra VRAM (packed textures + source textures kept alive), and introduced additional GPU work that could cause dropped frames on a load spike.
  • Packing through 11:11:10 quantization also lost precision vs. the source data.

Measured on a ~10MB test asset: VRAM 841MB → 647MB (~23% reduction), frame time unchanged (~33ms).

Changes:

  • Remove packGpuMemory() / packShMemory() and the associated reorder fragment shader chunks (GLSL and WGSL).
  • GSplatSogData now exposes a synchronous prepareCodebook() (codebook null-entry patch + V2 LUT texture build) and an async prepareGpuData() (centers generation). Both are invoked by the SOG parsers.
  • GSplatSogResource registers the source textures (and, for V2, the codebook LUT) as streams instead of the packed texture; adds a SOG_V2 material define.
  • Rewrite gsplatSogVS / gsplatSogSHVS (GLSL and WGSL) to sample source textures directly, with #ifdef SOG_V2 selecting codebook LUT lookups vs. V1 linear min/max dequantization.
  • GSplatProcessor now inherits the source resource's format defines (e.g. SOG_V2) when building its shader, fixing missing-uniform warnings and incorrect dequantization when processing V2 SOG assets.
  • Remove the internal minimalMemory option (was only used by octree streaming, no longer needed) and the now-dead reorderData() shim.

API Changes:

  • None public-facing. minimalMemory was never a documented public option.

Remove the packed-texture intermediate step for SOG gsplat assets. Splat data is
now read directly from the original means/quats/scales/sh0/sh_labels/sh_centroids
textures, and V2 codebooks are packed into a single 256x1 RGBA32F LUT texture for
in-shader lookups.

- Remove packGpuMemory/packShMemory and the reorder fragment shader chunks
  (GLSL + WGSL).
- GSplatSogData: new sync prepareCodebook() (null-entry patch + V2 LUT texture
  build) and slimmed async prepareGpuData() (centers generation only).
- GSplatSogResource: register source textures (and V2 codebook LUT) as streams,
  add SOG_V2 material define.
- Rewrite gsplatSogVS / gsplatSogSHVS chunks to sample source textures, with
  #ifdef SOG_V2 selecting codebook LUT lookups vs V1 linear min/max dequant.
- GSplatProcessor inherits source resource format defines so the shared read
  chunk compiles for the correct variant (fixes missing-uniform warnings and
  incorrect dequant when processing V2 SOG assets).
- Remove internal minimalMemory option (only used by octree streaming,
  no longer needed) and dead reorderData() shim.

Measured on a ~10MB asset: VRAM 841MB -> 647MB, frame time unchanged (~33ms).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors SOG GSplat rendering to eliminate the packed-texture intermediate and instead sample the original SOG source textures directly in both GLSL and WGSL, adding a V2 codebook LUT texture path.

Changes:

  • Rewrites SOG (and SOG SH) vertex format shader chunks (GLSL/WGSL) to decode directly from source textures, with SOG_V2 selecting LUT-based codebook decode.
  • Removes the GPU “reorder/pack” fragment shader chunks and the associated packing workflow in GSplatSogData.
  • Updates SOG loading/resource plumbing: adds synchronous prepareCodebook() (null-entry patch + V2 LUT build), registers source textures as streams, and ensures GSplatProcessor inherits format defines.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/sogSH.js WGSL SH decode now reads from sh_labels/sh_centroids and optionally LUT-decodes V2.
src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/sog.js WGSL core SOG decode now reads from source textures and optionally uses sogCodebook LUT.
src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatSogReorderSh.js Deletes obsolete WGSL reorder/pack SH fragment shader.
src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatSogReorder.js Deletes obsolete WGSL reorder/pack fragment shader.
src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/sogSH.js GLSL SH decode now reads from sh_labels/sh_centroids and optionally LUT-decodes V2.
src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/sog.js GLSL core SOG decode now reads from source textures and optionally uses sogCodebook LUT.
src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplatSogReorderSh.js Deletes obsolete GLSL reorder/pack SH fragment shader.
src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplatSogReorder.js Deletes obsolete GLSL reorder/pack fragment shader.
src/scene/gsplat/gsplat-sog-resource.js Registers source textures as streams, adds SOG_V2 define, updates V1 uniform parameter upload.
src/scene/gsplat/gsplat-sog-data.js Removes pack workflow; adds V2 sogCodebook LUT texture creation and prepareCodebook().
src/framework/parsers/sog.js Calls prepareCodebook()/prepareGpuData() during SOG load for non-decompress flow.
src/framework/parsers/sog-bundle.js Same as above for bundled SOG loads.
src/framework/gsplat/gsplat-processor.js Inherits source resource defines (e.g. SOG_V2) when compiling processing shader.
src/framework/components/gsplat/gsplat-asset-loader.js Removes internal minimalMemory option usage when creating gsplat assets.

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

Comment thread src/scene/gsplat/gsplat-sog-resource.js Outdated
Comment thread src/scene/gsplat/gsplat-sog-data.js Outdated
Comment thread src/framework/parsers/sog.js
Comment thread src/framework/parsers/sog-bundle.js
@mvaligursky mvaligursky merged commit 1f958e2 into main Apr 21, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-sog-direct-source-textures branch April 21, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue enhancement Request for a new feature performance Relating to load times or frame rate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants