-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebGPURenderer: Fix ArrayCamera viewports #28593
Conversation
… switching to the WebGPURenderer
e044724
to
e55b069
Compare
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
You are right. const w = x + width > renderContext.width ? width - 1 : width;
// for example:
// let width = renderContext.width - x + 2
// x+w = x + width - 1 = renderContext.width + 1 // this will exceed renderContext.width Maybe we can just do this ? const w = Math.min(width, renderContext.width - x); |
Yes, this is a breaking change but On |
When switching from Three.WebGLRenderer() to WebGPURenderer in the webgl_camera_array.html example, the WebGPUBackend consistently specified viewport dimensions that exceeded the maximum dimensions of the canvas. Removing the multiplyScalar() command on the viewportValue in Renderer.js partially solved this issue, presumably because the RenderPassEncoder's setViewport command. I presume this is because setViewport only needs to have its arguments specified in pixel coordinates, but I might be wrong. It doesn't seem like a separate function is modifying the viewport value before it is sent to the WebGPU backend...
Additionally, since the viewport dimensions seems to only exist in an integer format, when adjusting the window size, it's common for the specified viewport to exceed the valid dimensions of the canvas by 1 pixel, so a check has been added to the width and account for this behavior.
I looked through the WebGL backend, and it doesn't seem like similar issues popup despite both backends receiving the same viewport values from the example, so further investigation of the issue might be warranted.