Skip to content

Commit d62b8c8

Browse files
raymondyfeiRaymond FeiCedricGuillemetCopilot
authored
feat(SPLAT): Extend with NianticLabs WASM implementation and enable 4-th order spherical harmonics (#18267)
This PR extends the existing SPZ (Splat Zip) loader with optional support for NianticLab's official SPZ implementation compiled to WASM (see [NianticLabs SPZ](https://github.com/nianticlabs/spz/) for more details). The WASM package is published to NPM as `@adobe/spz` because Adobe is responsible for NPM package publication. The WASM-based loader is **opt-in**: when a `spzLibraryUrl` is provided in the loader options, the WASM path is used; otherwise, the built-in manual TypeScript parser is used as the default. This keeps the loader zero-dependency by default while allowing users to opt into the richer WASM implementation. In particular, the WASM path enables support for the latest features, such as loading SPZ files with 4th-order spherical harmonics (SH4) and vendor-specific extensions. Changes: - Adds an optional `spzLibraryUrl` field to `SPLATLoadingOptions`. When provided, the WASM library is loaded dynamically from that URL (similar to how `InitializeCSG2Async` loads the Manifold library). - Retains the existing manual SPZ parser (GZip decompression + custom bit-reading logic) as the default path when `spzLibraryUrl` is not set. - Adds support for the safe-orbit-camera extension loaded from an SPZ file (WASM path only). - Adds support for 4th-order spherical harmonics rendering in both WebGL and WebGPU shaders, where two optional textures hold the SH4 data. --------- Co-authored-by: Raymond Fei <yfei@adobe.com> Co-authored-by: Cedric Guillemet <1312968+CedricGuillemet@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent aba19cb commit d62b8c8

19 files changed

Lines changed: 3682 additions & 3193 deletions

File tree

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/dev/core/src/Materials/GaussianSplatting/gaussianSplattingMaterial.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,18 @@ export class GaussianSplattingMaterial extends PushMaterial {
178178
}
179179

180180
protected static _Attribs = [VertexBuffer.PositionKind, "splatIndex0", "splatIndex1", "splatIndex2", "splatIndex3"];
181-
protected static _Samplers = ["covariancesATexture", "covariancesBTexture", "centersTexture", "colorsTexture", "shTexture0", "shTexture1", "shTexture2", "partIndicesTexture"];
181+
protected static _Samplers = [
182+
"covariancesATexture",
183+
"covariancesBTexture",
184+
"centersTexture",
185+
"colorsTexture",
186+
"shTexture0",
187+
"shTexture1",
188+
"shTexture2",
189+
"shTexture3",
190+
"shTexture4",
191+
"partIndicesTexture",
192+
];
182193
protected static _UniformBuffers = ["Scene", "Mesh"];
183194
protected static _Uniforms = [
184195
"world",
@@ -435,7 +446,7 @@ export class GaussianSplattingMaterial extends PushMaterial {
435446
effect.setTexture("colorsTexture", gsMesh.colorsTexture);
436447

437448
if (gsMesh.shTextures) {
438-
for (let i = 0; i < gsMesh.shTextures?.length; i++) {
449+
for (let i = 0; i < gsMesh.shTextures.length; i++) {
439450
effect.setTexture(`shTexture${i}`, gsMesh.shTextures[i]);
440451
}
441452
}

0 commit comments

Comments
 (0)