Summary
The Gaussian Splatting SPZ loader cannot run on Babylon Native at all. Two separate platform gaps are involved, and together they block 22 SPZ / Gaussian Splatting scenes in the Babylon Native validation suite. Both reproduce identically on the WebGL/bgfx and WebGPU/Dawn backends, so this is not backend-specific.
This is a follow-up to BabylonJS/Babylon.js#18776, which made the first gap report clearly rather than silently misbehave. The underlying capability is still missing.
Gap 1 — ES module import is not supported on native (19 scenes)
GaussianSplattingFileLoader loads the SPZ library by generating ES module source and handing it to Tools._LoadScriptModuleAsync:
const module = await Tools._LoadScriptModuleAsync(
`import createSpzModule from '${spzLibraryUrl}';
const module = await createSpzModule();
const returnedValue = module;`
);
_LoadScriptModuleAsync appends its resolve shim and calls Tools.LoadScript(source, undefined, onError, scriptId, /* useModule */ true).
On web, _LoadScriptWeb(scriptUrl, onSuccess, onError, scriptId, useModule) injects that source into a <script type="module">. On native, there is no DOM and no ES module loader, so _LoadScriptNative now (post-#18776) fails fast with:
Loading a script as an ES module is not supported in Babylon Native
Before BabylonJS/Babylon.js#18776 the module source was passed to Tools.LoadFile as if it were a URL, which produced the confusing:
Unable to open URL 'import createSpzModule from 'https://unpkg.com/@adobe/spz@0.2.0/dist/spz.js';
Either way the scene fails. The error is now honest, but the feature is still unavailable.
Gap 2 — ReadableStream is not defined (3 scenes)
The SPZ "No WASM" decode path streams the response body, and Babylon Native's JS runtime has no ReadableStream:
Unable to load from https://.../hornedlizard.spz: ReadableStream is not defined
Affects Gaussian Splatting SPZ SH No WASM, Gaussian Splatting SPZ SH Order 4 No WASM, and Gaussian Splatting SPZ Detailed Splat No WASM.
Impact
Measured on the Babylon Native Playground validation catalog, running every test in its own process:
| Cause |
Scenes |
ES module import unsupported |
19 |
ReadableStream undefined |
3 |
All 22 fail on both the WebGL/bgfx and the WebGPU/Dawn backend. They are currently marked excluded in the Babylon Native test config, previously with a reason that misattributed the failure to XHR/streaming; that has now been corrected to point here.
Possible directions
Listing options rather than proposing a specific design, since the right layer is not obvious:
- Provide a non-module entry point for the SPZ library, or bundle/inline it, so the loader can use
Tools.LoadScript without useModule. This is the smallest change and would unblock the 19 scenes without any runtime work.
- Support ES modules in the Babylon Native JS runtime. V8 and JavaScriptCore both expose module-compilation APIs, but this is a substantial feature and would need a host-side module resolver.
- Avoid requiring
ReadableStream in the non-WASM decode path, or add a ReadableStream polyfill on the native side.
Happy to do the Babylon Native side of whichever direction you prefer. Option 1 looks like by far the best effort-to-value ratio if a non-module SPZ build is feasible.
Repro
Any of the affected playgrounds under Babylon Native, e.g. #XSNFXP#8 (Gaussian Splatting SPZ Extensions) with spzLibraryUrl set.
Summary
The Gaussian Splatting SPZ loader cannot run on Babylon Native at all. Two separate platform gaps are involved, and together they block 22 SPZ / Gaussian Splatting scenes in the Babylon Native validation suite. Both reproduce identically on the WebGL/bgfx and WebGPU/Dawn backends, so this is not backend-specific.
This is a follow-up to BabylonJS/Babylon.js#18776, which made the first gap report clearly rather than silently misbehave. The underlying capability is still missing.
Gap 1 — ES module
importis not supported on native (19 scenes)GaussianSplattingFileLoaderloads the SPZ library by generating ES module source and handing it toTools._LoadScriptModuleAsync:_LoadScriptModuleAsyncappends its resolve shim and callsTools.LoadScript(source, undefined, onError, scriptId, /* useModule */ true).On web,
_LoadScriptWeb(scriptUrl, onSuccess, onError, scriptId, useModule)injects that source into a<script type="module">. On native, there is no DOM and no ES module loader, so_LoadScriptNativenow (post-#18776) fails fast with:Before BabylonJS/Babylon.js#18776 the module source was passed to
Tools.LoadFileas if it were a URL, which produced the confusing:Either way the scene fails. The error is now honest, but the feature is still unavailable.
Gap 2 —
ReadableStreamis not defined (3 scenes)The SPZ "No WASM" decode path streams the response body, and Babylon Native's JS runtime has no
ReadableStream:Affects
Gaussian Splatting SPZ SH No WASM,Gaussian Splatting SPZ SH Order 4 No WASM, andGaussian Splatting SPZ Detailed Splat No WASM.Impact
Measured on the Babylon Native Playground validation catalog, running every test in its own process:
importunsupportedReadableStreamundefinedAll 22 fail on both the WebGL/bgfx and the WebGPU/Dawn backend. They are currently marked excluded in the Babylon Native test config, previously with a reason that misattributed the failure to XHR/streaming; that has now been corrected to point here.
Possible directions
Listing options rather than proposing a specific design, since the right layer is not obvious:
Tools.LoadScriptwithoutuseModule. This is the smallest change and would unblock the 19 scenes without any runtime work.ReadableStreamin the non-WASM decode path, or add aReadableStreampolyfill on the native side.Happy to do the Babylon Native side of whichever direction you prefer. Option 1 looks like by far the best effort-to-value ratio if a non-module SPZ build is feasible.
Repro
Any of the affected playgrounds under Babylon Native, e.g.
#XSNFXP#8(Gaussian Splatting SPZ Extensions) withspzLibraryUrlset.