# Is clipping done before or after projection?

Is clipping applied after projection or before?

How can it be applied after projection when a vertex is behind the camera and projected therefore mirrored?

At this time I clip the triangle before projection. For this I create _ a plane which represents the screen and check whether the sides of a triangle intersect with the plane (Basically a ray plane intersection test).

If true then I calculate the intersection point between side and plane and project this new point instead of the vertex behind the plane. This works though but I just wanted to know whether this is a wrong or right method to do it.

The projection matrix describes the mapping from 3D points of a scene, to 2D points of the viewport. It transforms from eye space to the clip space, and the coordinates in the clip space are transformed to the normalized device coordinates (NDC) by dividing with the w component of the clip coordinates. The NDC are in range (-1,-1,-1) to (1,1,1).
Every geometry which is out of the clippspace is clipped.

So clipping is done on the Homogeneous clipspace coordinates after the "projection" but before the perspective divide.

The condition for a homogeneous coordinate to be in clip space is

-w <=  x, y, z  <= w.

• Thank you for your response. The problem with this concept is that projecting a vertex which is behind the camera will be mirrored. What would be the start and end point of the side of a triangle, when the vertex is mirrored? Thanks. May 20, 2018 at 18:37

If I remember correctly, clipping is usually done on homogeneous coordinates, so when you've transformed your vertices to a cube with a center of (0, 0, 0) and extending by 1 in all directions, because it is faster that way, since transforming vertices is very cheap to an average GPU.

This also solves the issue if one vertex is behind the camera, since you can clip on the cube, on it's side pointing towards -Z.

At the end of the day, if your method works, and it's not terrible performance-wise, there is not much reason not to use it.