feat(SPLAT): Replace manual SPZ loader with NianticLabs WASM implementation and enable 4-th order spherical harmonics#18267
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Reviewer - this PR has made changes to one or more package.json files. |
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18267/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18267/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/18267/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
|
For the browser, it looks like the wasm is embedded in the js (not a separate .wasm file), so I guess there should be no separate download of a .wasm file or any .wasm hosting or csp or anything like that, which seems good. |
Does Babylon Native use V8 or JavaScriptCore? I thought these two supported WebAssembly. Or is there anything we could do to add support? |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Reviewer - this PR has made changes to one or more package.json files. |
BN works with V8, JavaScriptCore, Chakra, Hermes (via JSI), and there is some experimental work with QuickJS as well. I believe full wasm support is a bit split across V8/JSC and the host browser, and I also believe wasm is restricted on iOS unless it is in the browser (Safari). @bghgary thoughts? |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
|
We tested WebAssembly support on some JS engines, but I don't know the status off the top of my head. Either way, we have not tested WebAssembly much in Babylon Native so more investigation is required regardless. Maybe we could use the native version directly in Babylon Native? We have similar questions for Draco and KTX support. |
We've tested this for iOS 18 (Safari), and the SPZ module works. I'm not sure about other WASM features, though. |
I did some searching, and as of 2024, 99% of tracked browsers support WebAssembly 1.0 Wikipedia, and 2024 saw the last major holdout — Safari — add Tail Calls and Garbage Collection, completing cross-browser coverage. Uno Platform Note that Safari on iOS has supported Wasm since iOS 11, not iOS 15 (iOS 15 added improvements, not initial support). Even the extended 2.0 features already exceed 90% browser coverage. Wikipedia
Perhaps this makes both proposed mitigations compelling: a native fallback for the shrinking pool of unsupported platforms, or, simpler still, feature-flagging WASM-dependent capabilities in Babylon Native when running on unsupported kernels? |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Reviewer - this PR has made changes to one or more package.json files. |
|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
This PR replaces the existing manual TypeScript implementation of the SPZ (Splat Zip) loader with NianticLab's official SPZ implementation compiled to WASM (see NianticLabs SPZ for more details). The package was shipped to NPMJS as
@adobe/spzbecause Adobe is responsible for NPM package publication. The primary goal is to improve the consistency and maintainability of loading Gaussian Splatting files within Babylon.js, making it future-proof.In particular, this PR enables the support of the latest features, such as loading the SPZs with SH4, and vendor-specific extensions.
In addition, we enable the rendering of 4th-order spherical harmonics as it's a shipped feature in the latest version of SPZ.
Changes:
spz.loadSpzFromBuffer()to directly load the SPZ through the WASM library.