Why clip before dividing?
A triangle crossing behind the camera can fold into a false image when you divide by w too early.
Explore a case
Perspective view volume · side view
Eye coordinates (y–z plane); camera looks down −Z. A and B overlap in this view.
Canonical view volume (NDC)
Drag to rotateThe wire cube is −1 ≤ x, y, z ≤ 1. Out-of-bounds geometry is shown too.
Divide first
IncorrectNormalized device coordinates · x–y view
Divide each original vertex, then reconnect and clip in NDC.
Clip first
OpenGLNormalized device coordinates · x–y view
Clip the primitive in homogeneous coordinates, then divide.
Follow the coordinates
Eye → clip → NDC| Vertex | Eye (x, y, z) | Clip (x, y, z, w) | NDC (x/w, y/w, z/w) | Clip test |
|---|