refactor: read SOG gsplat data directly from source textures#8628
Merged
Conversation
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).
Contributor
There was a problem hiding this comment.
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_V2selecting 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 ensuresGSplatProcessorinherits 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.
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.
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:
Measured on a ~10MB test asset: VRAM 841MB → 647MB (~23% reduction), frame time unchanged (~33ms).
Changes:
packGpuMemory()/packShMemory()and the associated reorder fragment shader chunks (GLSL and WGSL).GSplatSogDatanow exposes a synchronousprepareCodebook()(codebook null-entry patch + V2 LUT texture build) and an asyncprepareGpuData()(centers generation). Both are invoked by the SOG parsers.GSplatSogResourceregisters the source textures (and, for V2, the codebook LUT) as streams instead of the packed texture; adds aSOG_V2material define.gsplatSogVS/gsplatSogSHVS(GLSL and WGSL) to sample source textures directly, with#ifdef SOG_V2selecting codebook LUT lookups vs. V1 linear min/max dequantization.GSplatProcessornow 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.minimalMemoryoption (was only used by octree streaming, no longer needed) and the now-deadreorderData()shim.API Changes:
minimalMemorywas never a documented public option.