|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> wrote:
> > (Of course in practice you seldom clip individual points. In practice
> > what get clipped are lines and polygons, which is a whole different
> > issue which can certainly not be solved via a single matrix multiplication.)
> I think on the *graphics* card, the individual points might get clipped if
> the triangle goes from inside the frustum to outside.
It's not that simple. In order to get the individual points (ie. the points
on the polygon which correspond to the pixels on screen, once the polygon
has been projected to the view plane) the polygon has to be projected first,
after which the individual points can be interpolated.
The near-clipping plane is used to avoid the problem that happens when
a vertex point of the polygon is behind the camera or extremely close to it
(even if the vertex point is in front of the camera, if it's too close to
the camera plane it will be projected to such a large value that the floating
point coordinates will overflow, screwing up the projected coordinates, which
is why the near-clipping plane has to be at some sensible distance from the
projection point).
Thus the near-clipping has to be done *before* the vertex points are
projected. It cannot be done after. This means that if you are clipping
a triangle, you will end up slicing the triangle (usually resulting in a
quadrilateral which has then to be converted into two triangles).
Clipping a triangle with a plane is not a completely trivial operation.
(Far-clipping is done for an entirely different reason, ie. to cut down
the number of polygons being rendered, and could conceivably be done after
the projection to the individual interpolated points. However, since you
already have a triangle-clipping algorithm set up for the near-clipping
plane, you could as well use it for the far-clipping plane as well, which
is probably what most engines/cards do. They might also do it for the
side planes of the view frustum as well, to cut down the amount of points
that need to be interpolated.)
> > If what you are asking is whether a 4x4 matrix could carry clipping
> > plane coorinates inside itself without affecting the transformation
> > otherwise, I'd say that's not possible. I don't think it could carry
> > that much information.
> That was my suspicion too, but I wanted to confirm I was right.
Note that I don't have first-hand experience on this. It wouldn't be the
first time that people have come up with clever tricks to squeeze information
in such places. (For example, there was a time that I didn't know that you
could actually perform perspective projection with a simple multiplication
with a 4x4 matrix, as I had always thought that matrix multiplication could
only be used for affine transformations.)
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |