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

Document the differences in normalized vertex positions in the backends #1044

Closed
kvark opened this issue Sep 9, 2016 · 1 comment
Closed

Comments

@kvark
Copy link
Member

kvark commented Sep 9, 2016

From the chat:

GL expects Z output in [-1,1], and that's what our math produces (cgmath catering to GL)
DX expects Z in [0,1](while still treating X and Y in [-1,1] like GL does), so we gotta patch it
note that Z we are patching is in the homogeneous coordinates, so we use W there, and the end result (Z/W) goes into [0,1]

Thus, for DX we need to replace this:

return mul(u_Transform, float4(pos));

by this:

float4 ndc = mul(u_Transform, float4(pos));
ndc.z = (ndc.z + ndc.w) * 0.5;
return ndc;

Related: #942

@Bastacyclop
Copy link
Contributor

Maybe just describe them instead of describing their differences ?

homu added a commit that referenced this issue Sep 11, 2016
Document normalized coordinates

Fixes #1044.
Please check those coordinates before merging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants