Add GSplat procedural shape scripts and example, other fixes and imrovements#8415
Merged
mvaligursky merged 3 commits intomainfrom Jan 29, 2026
Merged
Add GSplat procedural shape scripts and example, other fixes and imrovements#8415mvaligursky merged 3 commits intomainfrom
mvaligursky merged 3 commits intomainfrom
Conversation
3 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for procedural Gaussian splat shapes with three new ESM scripts (images, lines/arrows/AABBs, and text), implements deferred destruction for GSplat resources to handle asynchronous sorter lifecycle, adds dynamic container update support with centersVersion tracking, fixes AABB propagation for dynamic GSplat containers, and includes a new procedural-shapes example demonstrating CAD-style visualization.
Changes:
- Added deferred resource destruction mechanism via
GSplatResourceCleanupto safely handle resources still in use by the sorter - Added
centersVersiontracking to GSplat resources for detecting and propagating center data changes to the sorter - Fixed AABB handling in
GSplatPlacementto returnresource.aabbas fallback when no custom AABB is set - Added three new procedural shape scripts:
gsplat-image.mjs,gsplat-lines.mjs, andgsplat-text.mjs - Added
GSplatFormat.createSimpleFormat()helper for basic splat formats with uniform-scale and no rotation - Added
GSplatContainer.update()method to replace directnumSplatssetter with better control over center updates - Added one-time warning in sort worker for splats lost due to AABB bounds issues
- Added new procedural-shapes example demonstrating all new scripts with CAD-style bicycle visualization
Reviewed changes
Copilot reviewed 28 out of 33 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/scene/shader-lib/wgsl/collections/gsplat-chunks-wgsl.js | Fixed import path for gsplatSplat shader chunk |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatSplat.js | Added new shader chunk with Splat struct and setSplat helper |
| src/scene/shader-lib/wgsl/chunks/gsplat/vert/formats/containerSimpleRead.js | Added simple format read functions for containers |
| src/scene/shader-lib/glsl/collections/gsplat-chunks-glsl.js | Fixed import path for gsplatSplat shader chunk (GLSL version) |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplatSplat.js | Added new shader chunk with Splat struct and setSplat helper (GLSL version) |
| src/scene/shader-lib/glsl/chunks/gsplat/vert/formats/containerSimpleRead.js | Added simple format read functions for containers (GLSL version) |
| src/scene/gsplat/gsplat-sog-resource.js | Updated to use _actualDestroy() for deferred destruction pattern |
| src/scene/gsplat/gsplat-resource.js | Removed redundant destroy() override |
| src/scene/gsplat/gsplat-resource-cleanup.js | New class managing deferred destruction of GSplat resources |
| src/scene/gsplat/gsplat-resource-base.js | Added centersVersion tracking and deferred destruction via _actualDestroy() |
| src/scene/gsplat/gsplat-format.js | Added createSimpleFormat() static helper method |
| src/scene/gsplat/gsplat-container.js | Replaced numSplats setter with update() method supporting centersVersion |
| src/scene/gsplat-unified/gsplat-unified-sort-worker.js | Added one-time warning for sortKey overflow |
| src/scene/gsplat-unified/gsplat-placement.js | Changed AABB handling to use resource.aabb as fallback, improved type imports |
| src/scene/gsplat-unified/gsplat-placement-state-tracker.js | Added centersVersion to tracked state |
| src/scene/gsplat-unified/gsplat-octree.resource.js | Added centersVersion = 0 for static octree resources |
| src/scene/gsplat-unified/gsplat-octree-instance.js | Removed redundant placement.aabb.copy() call |
| src/scene/gsplat-unified/gsplat-manager.js | Added centersVersion tracking to detect and propagate center updates to sorter |
| src/scene/gsplat-unified/gsplat-director.js | Added GSplatResourceCleanup.process() call in update loop |
| src/framework/components/gsplat/system.js | Simplified customAabb cloning using nullish coalescing |
| src/framework/components/gsplat/component.js | Removed automatic customAabb assignment, simplified setter logic |
| scripts/esm/gsplat/gsplat-text.mjs | New script for rendering text as Gaussian splats |
| scripts/esm/gsplat/gsplat-lines.mjs | New script for rendering lines, arrows, and AABBs as Gaussian splats |
| scripts/esm/gsplat/gsplat-image.mjs | New script for rendering images as Gaussian splats |
| scripts/esm/gsplat/gsplat-flipbook.mjs | Updated comments to reflect deferred destruction handling |
| examples/thumbnails/gaussian-splatting_procedural-shapes_small.webp | Small thumbnail for procedural-shapes example |
| examples/thumbnails/gaussian-splatting_procedural-shapes_large.webp | Large thumbnail for procedural-shapes example |
| examples/src/examples/gaussian-splatting/procedural-shapes.example.mjs | New example demonstrating procedural shapes with CAD-style bicycle visualization |
| examples/src/examples/gaussian-splatting/procedural-shapes.controls.mjs | Controls for procedural-shapes example |
| examples/src/examples/gaussian-splatting/procedural-instanced.example.mjs | Updated to use container.update() with centersUpdated=false |
| examples/src/examples/gaussian-splatting/paint.example.mjs | Added credit attribution for apartment model |
| examples/src/examples/gaussian-splatting/editor.example.mjs | Added credit attribution for apartment model |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
slimbuck
approved these changes
Jan 28, 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.
Summary
centersVersiontrackingprocedural-shapesexample demonstrating CAD-style visualizationGSplatFormat.createSimpleFormat(device)helper for basic splat formatNew Scripts
gsplat-image.mjsRenders an image asset as Gaussian splats, one splat per non-transparent pixel. The image is sized to fit in a 1x1 unit space (matching
PlaneGeometry), centered at the origin on the XZ plane.gsplat-lines.mjsRenders line-based primitives as Gaussian splats:
Primitives are added/removed via API, and the container is automatically rebuilt when dirty.
gsplat-text.mjsRenders text strings as Gaussian splats using canvas-based text rendering. Supports:
Engine Changes
Deferred Resource Destruction (
gsplat-resource-cleanup.js)GSplatResourceCleanupclass manages per-device queues of resources pending destructionrefCount > 0(still in use by sorter) are queued for deferred destructionGSplatResourceBase.destroy()now handles deferral automatically via_actualDestroy()pattern_actualDestroy()for their specific cleanupGSplatDirector.update()Dynamic Container Updates
centersVersionproperty toGSplatResourceBasefor tracking center data changesupdate(numSplats, centersUpdated)method toGSplatContainerGSplatManagerdetects version changes and re-uploads centers to sorterGSplatPlacementStateTrackertrackscentersVersionfor state invalidationAABB Propagation Fix
GSplatPlacement.aabbnow returnsresource.aabbby default (dynamic fallback)customAabbsetterSort Worker Improvements
sortKeyoverflow (splats lost due to AABB bounds issues)New Example
procedural-shapes.example.mjsCAD-style visualization demonstrating all new scripts: