Normalized Device Coordinates

早过忘川 提交于 2019-12-05 11:06:14

From Jim Blinn's A Trip Down The Graphics Pipeline, p. 138.

Let's start with what might at first seem the simplest transformation: normalized device coordinates to pixel space. The transform is

s_x * X_NDC + d_x = X_pixel
s_y * Y_NDC + d_y = Y_pixel

A user/programmer does all screen design in NDC. There are three nasty realities of the hardware that NDC hides from us:

  1. The actual number of pixels in x and y.

  2. Non-uniform pixel spacing in x and y.

  3. Up versus down for the Y coordinate. The NDC-to-pixel transformation will invert Y if necessary so that Y in NDC points up.

...

s_x = ( N_x - epsilon ) / 2
d_x = ( N_x - epsilon ) / 2

s_y = ( N_y - epsilon ) / (-2*a)
d_y = ( N_y - epsilon ) / 2

epsilon = .001
a = N_y/N_x  (physical screen aspect ratio)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!