Skip to content

Conversation

@mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Jan 27, 2026

Summary

  • New GSplat editor example demonstrating AABB selection, deletion, and cloning
  • Simplified GSplatProcessor and GSplatFormat shader APIs
  • Unified work buffer format with container packed format chunks
  • Added textureDimensions getter to GSplatResourceBase

Changes

New Editor Example

  • Simple GSplat editor with AABB-based selection, deletion, and cloning
  • Modular shader files: selection-processor, delete-processor, copy-processor, workbuffer-modifier
  • GPU-based selection marking with CPU readback for clone operations
  • Transform gizmo integration for selection box manipulation
  • HTML entity list with delete functionality

GSplatProcessor API Simplification

  • Unified API: processGLSL/processWGSL now contain complete process() function with declarations
  • Removed separate declarationsGLSL/declarationsWGSL options
  • Fixed stream filtering to allow reading all source streams when source != destination
  • Added dstTextureSize uniform for destination texture dimensions

GSplatFormat API Simplification

  • Removed declarationsGLSL/declarationsWGSL options (declarations now part of read code)
  • Added pre-compiled regex patterns for template replacement (performance)

Shader Refactoring

  • New shared Splat struct with index and uv fields
  • New setSplat(index) helper function replaces direct struct access
  • Extracted gsplatSplat.js chunk for shared splat struct/functions
  • Unified containerPackedRead chunk used by both GSplatFormat and work buffer
  • Added GSPLAT_COLOR_FLOAT define for conditional color reading paths
  • Removed workBufferRead.js (merged into containerPackedRead.js)
  • New containerFloatRead.js for float-based container formats

API Additions

  • GSplatResourceBase.textureDimensions getter returns Vec2 (width, height)
  • Removed internal textureSize getter (use textureDimensions.x)

Example Updates

  • Updated paint.example.mjs to use new unified processor API
  • Updated procedural-instanced.example.mjs to use simplified format API

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

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 / GSplatFormat APIs (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.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@mvaligursky mvaligursky requested a review from a team January 27, 2026 11:42
@mvaligursky mvaligursky merged commit 5c4c82e into main Jan 28, 2026
13 checks passed
@mvaligursky mvaligursky deleted the mv-editor-example-refactoring branch January 28, 2026 09:53
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants