When we clip in homogeneous clip space, we have to generate a new vertex located at the intersection between the edge and the clip plane. We thus have to interpolate the $(x , y, z , w)$ position of both vertices to generate the new vertex position. It seems all well and good, but what should I do when the generated vertex after interpolation has a w of 0?
It doesn’t work because the w-divide makes the point go to infinity (division by zero).
So should I ensure that I never generate vertices with a w of 0 (how?)? Or should I just deal with the null w (how?)?
You might say that this situation never happen, but it actually does happen, especially when the z of the vertices are set to their w, for skyboxes for example. In this case, when we clip against the near plane (z = 0 in clip space) and interpolate the position, we will end up with a z of 0 but also a w of 0...