About the calculation of NDC

Hi guys,
From the opengl spec, section 13.8, the NDC is given by the following formula
My question is what will happen if the Wc is zero? Many thank!

Then the obvious happens: undefined behavior.

What Alfonse said.

That’s why OpenGL performs homogenous (4D-space) clipping “before” the perspective divide. So wc is never 0.

See the perspective projection frustum diagram here:

wc = -zeye = 0 (the eyepoint typically) is in the part that’s clipped away.

by clipping, did you mean opengl spec 13.7?
it seems that if Wc is zero, only the origin can survive.

Right. But that means that each component is 0/0, which is undefined behaviour.

Also: It’s impossible for both Zclip and Wclip to be equal to zero with a non-degenerate projection matrix (i.e. with both the near and far distances non-zero).

In homogeneous, a.k.a projective, coordinates, which were invented by Möbius, (a, b, c, 0) is defined as the point at infinity on the direction of the line ax + by + cz = 0.

We can thank a genius by the name of Larry Roberts for combining homogeneous coordinates with matrix algebra to give us the transformation system we all use. Interestingly he came up with it not for rendering but the reverse problem, machine perception of 3D solids. He shared it with fellow MIT PhD student Tim Johnson who used it in Sketchpad III and later described it as “clean (and brilliant)”.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.