Why do we need promising separation?

I know that division is done by dividing x, y, and z by w to get the normalized coordinates of the device. But I can not understand the purpose of this. Also, does it have anything to do with pruning?

+9
source share
4 answers

I want to say why do we need this?

In layman's terms: To do work with perspective distortions. In the perspective projection matrix, the Z coordinate becomes β€œmixed” into the output component W. Thus, the smaller the value of the Z coordinate, i.e. The closer to the origin, the more it becomes scaled, that is, more on the screen.

+3
source

Some details that complement the general answers:

The idea is to project the point (x, y, z) onto the screen in order to have (xs, ys, d). The following figure shows this for the y coordinate.

enter image description here

We know from school that

tan (alpha) = ys / d = y / z

This means that the projection is calculated as

ys = d * y / z = y / w

w = z / d

This is enough to apply projection. However, in OpenGL, you want (xs, ys, zs) to be the normalized coordinates of the device in [-1,1] and yes, it has something to do with clipping.

The extremum values ​​for (xs, ys, zs) represent a single cube, and everything outside it will be truncated. Thus, the projection matrix usually takes into account the limits of the cutoff (Frustum), to make one transformation, which, with the separation of perspective, simultaneously applies the projection and converts the projected coordinates along with z into the normalized coordinates of the device.

+8
source

To really translate it to the basic concept and why op is a division (instead of, for example, a square root or some such), think that an object that is twice as large should be displayed with dimensions exactly equal to half. Get 1/2 out of 2 with ... division.

There are many geometric ways to come to the same conclusion. The diagram serves as a clear evidence for this.

+1
source

In fact, using the standard naming convention from the 4x4 perspective matrix with the line of sight in the z direction, the β€œw” is 1 different from the distance ratio. In addition, this ratio, although interpreted correctly, is usually expressed as -z / d, where "z" is negative (therefore, gives the correct ratio), because, again, in conventional conventions, the camera looks in the negative direction "z ", The reason for the offset by 1 needs to be explained. Many links place the origin in the image plane, rather than in the center of the projection. With this agreement (again, when the camera is looking in the negative direction β€œz”), the distance indicated by β€œz” on the similar diagram of triangles is thereby replaced by (d -z). Then, substituting the expression for "w" instead of "z", instead of "z / d" it becomes (d -z) / d = [1 -z / d]. To some, these conventions may seem unorthodox, but they are quite popular among analysts.

0
source

All Articles