-
Notifications
You must be signed in to change notification settings - Fork 1.7k
GSplat Editor Example and Gsplat Shader / GsplatProcessor API Refactoring #8412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new GSplat editor example and refactors GSplat shader/processor APIs to use a unified “global splat” identifier and consolidated read/process code, while aligning work-buffer/container stream naming and packed/float read paths.
Changes:
- Introduces a GSplat editor example (AABB selection, deletion, cloning) with modular processor shaders and a work-buffer modifier.
- Refactors GSplat shader chunks to use a shared
Splat { index, uv }+setSplat()pattern and unifies packed/float container read chunks. - Simplifies
GSplatProcessor/GSplatFormatAPIs (process/read code becomes complete module-scope code) and adds destination texture sizing support.
Reviewed changes
Copilot reviewed 57 out of 59 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/scene/shader-lib/wgsl/collections/gsplat-chunks-wgsl.js | Register new WGSL chunks (splat + packed/float reads) |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatStructs.js | Include shared splat struct/helper in WGSL |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatStreamDecl.js | Switch stream loads to splat.uv + add loadWithIndex |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatSource.js | Initialize global splat via setSplat |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatFormat.js | Remove legacy splatUV global |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatCommon.js | Reorder includes for new splat global usage |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplat.js | Update vertex pipeline to global splat reads |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/workBufferRead.js | Remove legacy work-buffer read chunk |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/uncompressedSH.js | Update SH read API to global splat |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/uncompressed.js | Update read API to global splat |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/sogSH.js | Update SH read API to global splat |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/sog.js | Update SOG reads to use global splat |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/containerRead.js | Remove splatUV dependency in wrapper |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/containerPackedRead.js | Add packed container/work-buffer read path (WGSL) |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/containerFloatRead.js | Add float container read path (WGSL) |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/compressedSH.js | Update compressed SH read API |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/compressed.js | Update compressed format to global splat |
| src/scene/shader-lib/wgsl/chunks/gsplat/gsplatSplat.js | Add shared WGSL Splat + setSplat() |
| src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatProcess.js | Processor template: module-scope process() + dst sizing |
| src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js | Work-buffer copy shader updated for new streams/global splat |
| src/scene/shader-lib/wgsl/chunks/gsplat/compute-gsplat-sort-key.js | Rename work-buffer input binding to dataTransformA |
| src/scene/shader-lib/glsl/collections/gsplat-chunks-glsl.js | Register new GLSL chunks (splat + packed/float reads) |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplatStructs.js | Include shared splat struct/helper in GLSL |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplatStreamDecl.js | Switch stream loads to splat.uv + add loadWithIndex |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplatSource.js | Initialize global splat via setSplat |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplatFormat.js | Remove legacy splatUV global |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplatCommon.js | Reorder includes for new splat global usage |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplat.js | Update vertex pipeline to global splat reads |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/workBufferRead.js | Remove legacy work-buffer read chunk |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/uncompressedSH.js | Update SH read API to global splat |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/uncompressed.js | Update read API to global splat |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/sogSH.js | Update SH read API to global splat |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/sog.js | Update SOG reads to use global splat |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/containerRead.js | Remove splatUV dependency in wrapper |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/containerPackedRead.js | Add packed container/work-buffer read path (GLSL) |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/containerFloatRead.js | Add float container read path (GLSL) |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/compressedSH.js | Update compressed SH read API |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/compressed.js | Update compressed format to global splat |
| src/scene/shader-lib/glsl/chunks/gsplat/gsplatSplat.js | Add shared GLSL Splat + setSplat() |
| src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplatProcess.js | Processor template: module-scope process() + dst sizing |
| src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js | Work-buffer copy shader updated for new streams/global splat |
| src/scene/gsplat/gsplat-resource-base.js | Expose textureDimensions + adjust work-buffer color stream name |
| src/scene/gsplat/gsplat-format.js | Remove declarations option + add default float container format |
| src/scene/gsplat/gsplat-container.js | Update container docs + bind read code directly as functions |
| src/scene/gsplat-unified/gsplat-work-buffer.js | Rename work-buffer streams + color-only target to dataColor |
| src/scene/gsplat-unified/gsplat-sort-key-compute.js | Update binding/parameter to dataTransformA |
| src/scene/gsplat-unified/gsplat-renderer.js | Define GSPLAT_COLOR_FLOAT based on dataColor format |
| src/scene/gsplat-unified/gsplat-params.js | Rename work-buffer streams + use packed read chunk |
| src/framework/gsplat/gsplat-processor.js | Simplify processor API + add dst texture sizing uniform |
| examples/thumbnails/gaussian-splatting_editor_small.webp | Add editor example thumbnail (small) |
| examples/thumbnails/gaussian-splatting_editor_large.webp | Add editor example thumbnail (large) |
| examples/src/examples/gaussian-splatting/procedural-instanced.example.mjs | Update example to new GSplatFormat read API |
| examples/src/examples/gaussian-splatting/paint.example.mjs | Update example to new GSplatProcessor API + load helpers |
| examples/src/examples/gaussian-splatting/editor.workbuffer-modifier.mjs | Add editor work-buffer modifier shader |
| examples/src/examples/gaussian-splatting/editor.selection-processor.mjs | Add selection processor shader (AABB select) |
| examples/src/examples/gaussian-splatting/editor.example.mjs | Add full GSplat editor example |
| examples/src/examples/gaussian-splatting/editor.delete-processor.mjs | Add delete processor shader (AABB delete) |
| examples/src/examples/gaussian-splatting/editor.copy-processor.mjs | Add copy/clone processor shader with remap texture |
| examples/src/examples/gaussian-splatting/editor.controls.mjs | Add UI controls for editor example |
Comments suppressed due to low confidence (1)
src/scene/gsplat/gsplat-container.js:49
- This JSDoc example still uses the old GSplatFormat read style (assigning splatCenter/splatColor/splatScale/splatRotation). GSplatFormat now expects readGLSL/readWGSL to define getCenter()/getColor()/getScale()/getRotation() functions instead. Update the example snippet accordingly so it matches the new API.
* // Example 2: Using a custom format
* const format = new pc.GSplatFormat(device, [
* { name: 'data', format: pc.PIXELFORMAT_RGBA32F }
* ], {
* // Shader code to read splat attributes from the texture
* readGLSL: `
* vec4 d = loadData();
* splatCenter = d.xyz;
* splatColor = vec4(1.0);
* splatScale = vec3(d.w);
* splatRotation = vec4(0, 0, 0, 1);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Summary
textureDimensionsgetter to GSplatResourceBaseChanges
New Editor Example
selection-processor,delete-processor,copy-processor,workbuffer-modifierGSplatProcessor API Simplification
processGLSL/processWGSLnow contain completeprocess()function with declarationsdeclarationsGLSL/declarationsWGSLoptionsdstTextureSizeuniform for destination texture dimensionsGSplatFormat API Simplification
declarationsGLSL/declarationsWGSLoptions (declarations now part of read code)Shader Refactoring
Splatstruct withindexanduvfieldssetSplat(index)helper function replaces direct struct accessgsplatSplat.jschunk for shared splat struct/functionscontainerPackedReadchunk used by both GSplatFormat and work bufferGSPLAT_COLOR_FLOATdefine for conditional color reading pathsworkBufferRead.js(merged intocontainerPackedRead.js)containerFloatRead.jsfor float-based container formatsAPI Additions
GSplatResourceBase.textureDimensionsgetter returnsVec2(width, height)textureSizegetter (usetextureDimensions.x)Example Updates
paint.example.mjsto use new unified processor APIprocedural-instanced.example.mjsto use simplified format API