Skip to content

setScissor() has flipped Y axis in WebGPU #32419

@astralarya

Description

@astralarya

Description

The setScissor() method (https://threejs.org/docs/?q=sci#Renderer.setScissor) seems to use a flipped Y axis in WebGPU compared to WebGL. This apparently matches the underlying differences in convention between WebGPU and WebGL, but the docs imply that this should not be the case. This issue also likely affects PassNode, which also has a setScissor() function.

Reproduction steps

Create a scissored view with setScissor() using the WebGPU renderer. The position of the scissored view is consistent with a Y axis with zero in the top left of the viewport.

Code

The drei View component calls setScissor() here:
https://github.com/pmndrs/drei/blob/master/src/web/View.tsx#L97

Live example

Minimal repro using @react-three/drei View here: https://github.com/astralarya/react-three-drei-view-webgpu
Run pnpm install and pnpm dev to start.

Screenshots

The render canvas is styled to cover the entire viewport. The view div is outlined in red and is setup to be in the upper left corner of the viewport. Note how the scene is rendering in the bottom left corner.
Image
Commenting out the gl={} prop here switches the app from WebGPU back to WebGL (https://github.com/astralarya/react-three-drei-view-webgpu/blob/main/src/App.tsx#L30)

The scene will then render in the red box as expected (after a hard reload--hot reload is not sufficient)
Image

Version

v0.181.2

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions