Skip to content

Procedural GSplat Container API#8352

Merged
mvaligursky merged 5 commits into
mainfrom
mv-procedural-splat
Jan 12, 2026
Merged

Procedural GSplat Container API#8352
mvaligursky merged 5 commits into
mainfrom
mv-procedural-splat

Conversation

@mvaligursky

@mvaligursky mvaligursky commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

Adds support for procedural Gaussian Splat generation through a new GSplatContainer class and GSplatFormat descriptor.

The GSplatFormat class allows defining custom texture layouts with arbitrary streams, while automatically generating the necessary shader code to read the data. The GSplatContainer holds the allocated textures and integrates seamlessly with the unified rendering pipeline, supporting multiple instances of the same container with per-instance parameters.

New Public API

GSplatFormat

Defines custom texture layouts for splat data with automatic shader code generation:

  • streams - Array of texture stream definitions (name, format)
  • readGLSL / readWGSL - Custom shader code for reading splat data
  • getDeclarations() / getReadCode() - Generated shader chunks

Example - defines a single texture, a single uniform and code to generate splat data used for rendering (only showing GLSL

const format = new pc.GSplatFormat(device, [
    { name: 'Data', format: pc.PIXELFORMAT_RGBA8 }
], {
    declarationsGLSL: `
        uniform vec3 uTint;
    `,
    readGLSL: `
        vec4 data = loadData();       // call autogenerated texture to get data from 'Data' texture

        // evaluate center, color, scale, and rotation of the splat
        splatCenter = data.rgb;
        splatColor = vec4(uTint, 1.0);
        splatScale = vec3(0.15);
        splatRotation = vec4(0.0, 0.0, 0.0, 1.0);
    `
});

GSplatContainer

Container for procedural splat data extending GSplatResourceBase:

  • Constructor takes (device, numSplats, format)
  • numSplats - Readonly count of splats
  • getTexture(name) - Get texture by stream name
  • centers - Float32Array for sorting (inherited from base)
  • aabb - BoundingBox for culling (inherited from base)

Example

const container = new pc.GSplatContainer(device, numSplats, format);

// fill in data to textures
const data = container.getTexture('Data').lock();
// write to data
container.getTexture('Data').unlock();

// add it to entity
const entity = new pc.Entity();
entity.addComponent('gsplat', {
    resource: container,
    unified: true
});

GSplatComponent.setParameter / getParameter / deleteParameter

Per-instance shader parameters. This is the same API Material class has for setting up uniforms.

Example:

  • a single container with a grid of points
  • shader chunk that uses provided tint uniforms to generate full splat data
  • added to scene multiple times (instances of the same container) with different uniforms
  • all rendered to the unified work buffer for global sorting
Screenshot 2026-01-08 at 16 42 15

@mvaligursky mvaligursky merged commit 34c81f1 into main Jan 12, 2026
7 checks passed
@mvaligursky mvaligursky deleted the mv-procedural-splat branch January 12, 2026 16:26
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