Skip to content
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

Y orientation of viewport coordinates vs. NDC #4492

Closed
kpreid opened this issue Feb 16, 2024 · 0 comments · Fixed by #4641
Closed

Y orientation of viewport coordinates vs. NDC #4492

kpreid opened this issue Feb 16, 2024 · 0 comments · Fixed by #4641
Assignees
Labels
api WebGPU API copyediting Pure editorial stuff (copyediting, *.bs file syntax, etc.)
Milestone

Comments

@kpreid
Copy link

kpreid commented Feb 16, 2024

In the WebGPU specification "Editor’s Draft, 16 February 2024" as currently posted on gpuweb.github.io, § 3.3 Coordinate Systems:

  • Normalized device coordinates (or NDC) have three dimensions, where: … The bottom-left corner is at (-1.0, -1.0, z).
  • Framebuffer coordinates
    • The top-left corner is at (0.0, 0.0).
    • x increases to the right.
    • y increases down.
  • Viewport coordinates combine framebuffer coordinates in x and y dimensions, with depth in z.

This implies that, when NDC are converted to framebuffer coordinates or viewport coordinates, the Y coordinate must be negated to convert from "increases up" to "increases down". But in § 23.3.5 Rasterization, the function for this conversion is given as:

framebufferCoords(n) = vector(vp.x + 0.5 × (n.x + 1) × vp.width, vp.y + .5 × (n.y + 1) × vp.height)

This does not negate n.y. This seems to contradict both the definitions of the coordinate systems, and what implementations actually do.

@kainino0x kainino0x added the copyediting Pure editorial stuff (copyediting, *.bs file syntax, etc.) label Feb 16, 2024
@kainino0x kainino0x added this to the Milestone 0 milestone Feb 16, 2024
@kainino0x kainino0x added the api WebGPU API label Apr 30, 2024
@toji toji self-assigned this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api WebGPU API copyediting Pure editorial stuff (copyediting, *.bs file syntax, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants