PDA

View Full Version : ZNear Clipping and clipping planes in the projection matrix in opengl



d123
08-27-2003, 07:32 AM
How does opengl handle clipping exactly ?
I mean the DirectX standard is after applying the composite world - view - projection matrix
any vertexes that do not satisfy the following formulas are clipped:
-w < x < w &#0124; &#0124; -w < y < w &#0124; &#0124; 0 < z < w. Well a few days ago nvidia has released 2 examples of how you can have user clipping planes for free emulated with projection matrix. The ideea is that on matrix column/raw (depending if u got directx matrix style or opengl style) of the z you put a litle plane that force the z to be clipped where you want but the projection to screen space is still right because w is generated ok. Well the directx example makes exactly what I was expecting. No more ZNear clipping since the z are somewhere else (still is weird that no back projection appear) weird zbuffer (obvious because the z is the distance to a user plane that can have arbritrary orientation). The ZBffer can be solved with a w-buffer. BUT and there is a big BUT the opengl example does not do this. The z-problem is still there but no z turning when the plane normal is orientated to the view and the znear clipping is still working. If the opengl does the clipping as the directx how can this be happening ?

Nervus
09-02-2003, 12:45 PM
I believe OpenGL does W clipping because when the teapot from the NVidia example hits the near Z plane you can see the difference between user clip-planes and the projection clip-planes. Seems like it's W buffer http://www.opengl.org/discussion_boards/ubb/wink.gif

Keep it alive http://www.opengl.org/discussion_boards/ubb/wink.gif by n3rvu5