View Full Version : Clip space volume in opengl

10-29-2003, 06:45 AM

How is the clip space volume defined in OpenGL?

I would expect it to be defined as x\in[-1,1], y\in[-1,1] and z\in[0,1] - this is what is used in foley if i remember correctly.

Now what bugs me, is that when I do shadowmaps, I use a matrix to go from the clip space volume into the coordinates of the texutre, as suggested in some
nvidia presentation

[0.5 1 1 0 ]
[ 0 0.5 1 0 ]
[ 0 0 0.5 0.5 ]
[ 0 0 0 1 ]

The third row tells me that clipspace must be defined as z\in[-1,1].

What is true? Any references to where in the standard, that this is stated are also very welcome.


Eric Lengyel
10-29-2003, 07:39 AM
Yes, z lies in [-1,1], but in normalized device coordinates. This is implicitly stated at the beginning of section 2.11 of the OpenGL 1.4 spec where it says that -w <= z <= w in clip space.

10-29-2003, 08:45 AM
Great, thanks.