Skip to content

Add support for multiview with WebGPURenderer #5749

@vincentfretin

Description

@vincentfretin

You can use the new WebGPURenderer with aframe 1.7.1 with importmap, if you alias three to three.webgpu.js, aframe will use WebGPURenderer instead of WebGLRenderer, see source of the example https://aframe.io/aframe/examples/showcase/webgpu/ and using the latest super-three 0.177.0. But to use multiview with WebGPURenderer you will need a change here

if (rendererAttr.multiviewStereo) {
rendererConfig.multiviewStereo = rendererAttr.multiviewStereo === 'true';
}
this.maxCanvasSize = {
width: rendererAttr.maxCanvasWidth
? parseInt(rendererAttr.maxCanvasWidth)
: this.maxCanvasSize.width,
height: rendererAttr.maxCanvasHeight
? parseInt(rendererAttr.maxCanvasHeight)
: this.maxCanvasSize.height
};
}
// Trick Webpack so that it can't statically determine the exact export used.
// Otherwise it will conclude that one of the two exports can't be found in THREE.
// Only one needs to exist, and this should be determined at runtime.
var rendererImpl = ['WebGLRenderer', 'WebGPURenderer'].find(function (x) { return THREE[x]; });
renderer = this.renderer = new THREE[rendererImpl](rendererConfig);
the option is just called multiview and not multiviewStereo in WebGPURenderer it seems https://github.com/mrdoob/three.js/blob/b8f5c787fe6afbcbc442a6990f36a6c42d7405ca/src/renderers/webgpu/WebGPURenderer.js#L40C26-L40C35

Update the example https://aframe.io/aframe/examples/performance/multiview-extension/?multiview=on or duplicate it to test it with the new WebGPURenderer.
I was answering this on discord, so I'm creating the issue if anyone want to test it and do the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions