BabylonJS/Babylon.js · error
Multiview is not supported
Error message
Multiview is not supported
What it means
NullEngine is a headless, non-rendering engine whose capability list does not include multiview (WebVR/XR stereo rendering) unless explicitly enabled. createMultiviewRenderTargetTexture() checks getCaps().multiview and throws when the capability is absent.
Source
Thrown at packages/dev/core/src/Engines/nullEngine.pure.ts:899
texture.samples = 1;
texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;
texture.samplingMode = fullOptions.samplingMode;
texture.type = fullOptions.type;
this._internalTexturesCache.push(texture);
return rtWrapper;
}
/**
* Creates a new multiview render target wrapper for headless render-state tests.
* @param width defines the width of the texture
* @param height defines the height of the texture
* @returns a new multiview render target wrapper
*/
public override createMultiviewRenderTargetTexture(width: number, height: number): RenderTargetWrapper {
if (!this.getCaps().multiview) {
throw new Error("Multiview is not supported");
}
const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, { width, height });
const texture = new InternalTexture(this, InternalTextureSource.RenderTarget, true);
texture.baseWidth = width;
texture.baseHeight = height;
texture.width = width;
texture.height = height;
texture.isMultiview = true;
texture.isReady = true;
texture.format = Constants.TEXTUREFORMAT_RGBA;
texture.samples = 1;
rtWrapper.setTextures(texture);
return rtWrapper;
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Do not create multiview render targets in headless/NullEngine scenarios; use a plain render target texture.
- Check engine.getCaps().multiview before calling and branch to a normal render target.
- If multiview is truly required, use a real WebXR-capable engine instead of NullEngine.
Example fix
// before
const rt = engine.createMultiviewRenderTargetTexture(512, 512);
// after
if (engine.getCaps().multiview) {
rt = engine.createMultiviewRenderTargetTexture(512, 512);
} else {
rt = engine.createRenderTargetTexture(512, 512, false);
} Defensive patterns
Strategy: validation
Validate before calling
if (!engine.getCaps().multiview) {
// fall back to createRenderTargetTexture
} Type guard
function supportsMultiview(e) {
return !!e.getCaps().multiview;
} Try / catch
try {
rt = engine.createMultiviewRenderTargetTexture(w, h);
} catch (e) {
if (/Multiview is not supported/.test(e.message)) {
rt = engine.createRenderTargetTexture(w, h, false);
}
} Prevention
- Always consult getCaps().multiview before XR/multiview setup.
- Keep headless test scenes free of WebXR-specific targets.
- Centralize render-target creation in a capability-aware factory.
When it happens
Trigger: Calling nullEngine.createMultiviewRenderTargetTexture(w, h) on a default NullEngine instance (multiview cap is false).
Common situations: Unit tests or server-side rendering using NullEngine that exercise multiview/XR render-target code paths; copy-pasted WebXR scene setup running headless.
Related errors
- Invalid Space Warp framebuffer
- _readPixelsAsync only work on WebGL2+
- XRCompositionLayer.${control} is not supported by this XR ru
- Anchors not enabled in this environment/browser
- String(error)
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/e5078fb3603fdb58.
Report an issue: GitHub.