Can anyone explain me the attched picture from Angel's book

Hello,
Can any one explain me the attached picture on Angel’s book? How znear = -1 works here, I don’t understand? Shouldn’t be it equal to znear = +1 and zfar = -1?
[ATTACH=CONFIG]1299[/ATTACH]

Please help me with some clarification.

Thanks in advance.

This shows how EYE-SPACE (left) is transformed to NDC-SPACE (right).

The znear = -1, zfar = +1 is part of the definition of the NDC-SPACE. Check it out in your favorite OpenGL book.

[QUOTE=Dark Photon;1279871]This shows how EYE-SPACE (left) is transformed to NDC-SPACE (right).

The znear = -1, zfar = +1 is part of the definition of the NDC-SPACE. Check it out in your favorite OpenGL book.[/QUOTE]

I understand that, but shouldn’t be znear = +1 and zfar = -1 ?

I understand what you’re asking. I just don’t understand why you’re asking it.

That could have been chosen as the convention. It just wasn’t.

Are you asking because EYE-SPACE znear > EYE-SPACE zfar, so you’re expecting NDC znear > NDC zfar? If so, consider WINDOW-SPACE znear < WINDOW-SPACE zfar (by default), so the convention had to flip at some point. Might as well be for NDC.

All of the legacy OpenGL functions which are typically used for constructing a projection matrix (i.e. glOrtho, glFrustum, gluOrtho2D and gluPerspective) construct a matrix which “flips” the Z direction, i.e. increasing eye-space Z maps to decreasing NDC Z, and the initial values of glDepthRange(), glDepthFunc() and glClearDepth() are appropriate for this convention.

If you wish, you can use a projection matrix which preserves the Z direction. But then you would need to either use e.g. glDepthRange(1, 0) or use glDepthFunc(GL_GREATER) and glClearDepth(0) so that closer objects obscure farther ones.

Thank you both Dark Photon and GClements for trying to help me out. I understand but still a bit confused. I understand znear is smaller near the eye and perspective division produces the result at the right (top view). Am I right? But which coordinate system does the picture at the right follow? Here it seems that zmin and zman are the depths from the eye respectively which may not comply with the sign of near and far clipping plane.

Thanks again in advance!

The picture on the right is a top-down (-Y) view of normalised device space.

The picture on the left is a top-down view of eye space. To use conventional OpenGL terminology, Zmin=-zNear and Zmax=-zFar.