Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/scene/gsplat-unified/gsplat-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,12 @@ class GSplatRenderer {
}

configureMaterial() {
const { device, workBuffer } = this;
const { workBuffer } = this;

// Inject format's shader chunks (uses workBuffer.format)
this._injectFormatChunks();

// Set defines
this._material.setDefine('STORAGE_ORDER', device.isWebGPU);
this._material.setDefine('SH_BANDS', '0');

// Set GSPLAT_COLOR_FLOAT define based on work buffer's color format
Expand Down
2 changes: 0 additions & 2 deletions src/scene/gsplat/gsplat-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,9 @@ class GSplatInstance {
setMaterialOrderData(material) {
if (this.orderBuffer) {
material.setParameter('splatOrder', this.orderBuffer);
material.setDefine('STORAGE_ORDER', true);
} else {
material.setParameter('splatOrder', this.orderTexture);
material.setParameter('splatTextureSize', this.orderTexture.width);
material.setDefine('STORAGE_ORDER', false);
}
}

Expand Down
14 changes: 2 additions & 12 deletions src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ attribute vertex_id_attrib: u32; // render order base
#else
uniform numSplats: u32; // total number of splats

#ifdef STORAGE_ORDER
var<storage, read> splatOrder: array<u32>;
#else
// texture for non-unified gsplat rendering
var splatOrder: texture_2d<u32>;
#endif
var<storage, read> splatOrder: array<u32>;
#endif

// initialize the splat source structure
Expand All @@ -39,12 +34,7 @@ fn initSource(source: ptr<function, SplatSource>) -> bool {
#ifdef GSPLAT_INDIRECT_DRAW
splatId = compactedSplatIds[source.order];
#else
#ifdef STORAGE_ORDER
splatId = splatOrder[source.order];
#else
let uv = vec2u(source.order % uniform.splatTextureSize, source.order / uniform.splatTextureSize);
splatId = textureLoad(splatOrder, vec2i(uv), 0).r;
#endif
splatId = splatOrder[source.order];
#endif
setSplat(splatId);

Expand Down