PDA

View Full Version : View Frustum Clipping

N64Marin
07-05-2009, 08:10 PM
The OpenGL specification says that a vertex is clipped by the View Frstum:
-wc < xc < wc, -wc < yc < wc, -wc < zc < wc, That's six clip planes for each vertex. The question is, the clipping must be performed per primitive to get the interpolation factor t, but for each vertex, the wc is differenct, the clipplane defination varies per vertex, so it doesn't create clip planes for primitives. So, how the clipping is performed for each primitive? What's the exact algorithm to get the interpolation factor t?
User clip planes doesn't suffer that problem, because the clipplane defination doesn't depend on transformed vertex attribute, so the t can be easily computed by distance to the clip plane.

Xmas
07-06-2009, 03:21 AM
Actually it's no different than user clip planes. The clip planes are fixed: (1 0 0 1), (-1 0 0 1), (0 1 0 1), (0 -1 0 1), (0 0 1 1), (0 0 -1 1). These correspond to the clip distances wc + xc, wc - xc, wc + yc, wc - yc, wc + zc, wc - zc.