GSplat Extra Streams and Work Buffer Customization#8383
Merged
mvaligursky merged 4 commits intomainfrom Jan 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for custom texture streams on gsplat resources and per-instance shader customization in unified rendering mode. It enables users to store custom per-splat or per-instance data and modify splats during work buffer rendering via custom shader code.
Changes:
- Added
GSplatFormat.addExtraStreams()API to define custom texture streams (resource-level or instance-level) - Added
GSplatComponent.setWorkBufferModifier()to inject custom shader code for modifying splats during work buffer rendering - Added work buffer update control via new constants (
WORKBUFFER_UPDATE_AUTO,WORKBUFFER_UPDATE_ONCE,WORKBUFFER_UPDATE_ALWAYS)
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js | Integrates custom modifier functions into work buffer rendering (WGSL) |
| src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js | Integrates custom modifier functions into work buffer rendering (GLSL) |
| src/scene/gsplat/gsplat-streams.js | Adds instance-level texture management and dynamic stream synchronization |
| src/scene/gsplat/gsplat-format.js | Implements extra streams API with version tracking and shader code generation |
| src/scene/gsplat/gsplat-container.js | Changes constructor to use maxNumSplats and adds dynamic numSplats setter |
| src/scene/gsplat/gsplat-resource-base.js | Updates material configuration to support custom modifiers and format declarations |
| src/scene/gsplat/gsplat-resource.js | Changes format property from public to protected |
| src/scene/gsplat/gsplat-compressed-resource.js | Changes format property from public to protected |
| src/scene/gsplat/gsplat-sog-resource.js | Changes format property from public to protected |
| src/scene/gsplat-unified/gsplat-placement.js | Adds work buffer modifier support, instance texture management, and update mode control |
| src/scene/gsplat-unified/gsplat-info.js | Captures format state and instance streams for rendering |
| src/scene/gsplat-unified/gsplat-manager.js | Integrates state tracking and instance stream initialization |
| src/scene/gsplat-unified/gsplat-work-buffer-render-pass.js | Binds instance textures and passes modifier to render info |
| src/scene/gsplat-unified/gsplat-placement-state-tracker.js | New file tracking placement state changes for work buffer invalidation |
| src/scene/gsplat/gsplat-instance.js | Updates material configuration call signature |
| src/scene/constants.js | Defines new work buffer update mode constants |
| src/framework/components/gsplat/component.js | Exposes public API for work buffer modifiers and instance textures |
| examples/src/examples/gaussian-splatting/procedural-instanced.example.mjs | Demonstrates dynamic numSplats modification |
Comments suppressed due to low confidence (1)
src/framework/components/gsplat/component.js:1
- The example incorrectly assigns to
extraStreamsproperty directly, but the actual API isaddExtraStreams()method. This should be:resource.format.addExtraStreams([...]). The property is read-only according to the implementation.
import { hashCode } from '../../../core/hash.js';
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
slimbuck
approved these changes
Jan 19, 2026
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.
GSplat Extra Streams and Work Buffer Customization
Overview
Adds support for custom texture streams on gsplat resources and per-instance shader customization in unified rendering mode.
Features
Extra Streams Support
GSplatFormat.addExtraStreams(streams)- Add custom texture streams to a gsplat formatinstance: false(default) - texture shared across all instances of the resourceinstance: true- texture created per gsplat component instanceGSplatComponent.getInstanceTexture(name)- Access instance-level textures for writing custom dataWork Buffer Customization
GSplatComponent.setWorkBufferModifier({ glsl, wgsl })- Inject custom shader code to modify splats during work buffer renderingmodifySplatCenter(center),modifySplatRotationScale(originalCenter, center, rotation, scale), andmodifySplatColor(center, color)functionsloadStreamName()functionsWork Buffer Update Control
New constants for controlling work buffer update frequency:
WORKBUFFER_UPDATE_AUTO- Update only when needed (default)WORKBUFFER_UPDATE_ONCE- Update next frame, then revert to AUTOWORKBUFFER_UPDATE_ALWAYS- Update every frame (for time-based effects)Set via
gsplatComponent.workBufferUpdate = pc.WORKBUFFER_UPDATE_ALWAYSNew Public API
Constants
WORKBUFFER_UPDATE_AUTOWORKBUFFER_UPDATE_ONCEWORKBUFFER_UPDATE_ALWAYSGSplatFormat
addExtraStreams(streams)Adds additional texture streams for custom gsplat data.
Parameters:
streams-Array<GSplatStreamDescriptor>- Array of stream descriptorsGSplatStreamDescriptor:
namestringloadName()function)formatnumberPIXELFORMAT_RGBA8,PIXELFORMAT_RGBA32F)instancebooleanfalseextraStreams(getter)Returns the array of extra streams. Read-only, do not modify directly.
GSplatComponent
getInstanceTexture(name)Returns the instance-level texture for the given stream name.
Parameters:
name-string- The stream nameReturns:
Texture | undefinedsetWorkBufferModifier(value)Sets custom shader code for modifying splats when written to the work buffer.
Parameters:
value-{ glsl?: string, wgsl?: string } | null- Shader code object or null to clearworkBufferUpdateControls how often the work buffer is updated for this component.
Type:
number(useWORKBUFFER_UPDATE_*constants)Default:
WORKBUFFER_UPDATE_AUTOGSplatContainer
Constructor Change
The constructor now takes
maxSplatsinstead ofnumSplats:maxSplats(getter)Returns the maximum number of splats the container can hold (set at construction).
Type:
number(read-only)numSplats(getter/setter)Controls the number of splats to render. Must be between 0 and
maxSplats.Type:
numberDefault:
maxSplatsNote: Changing this value triggers internal buffer reallocation in unified rendering mode. Avoid calling this every frame. For per-frame visibility control, consider using the format's read shader code that returns
splatScale = vec3(0.0)for splats you want to hide.Usage Examples
Adding Custom Color Per Instance