<p>One good reason to do clipping in homogeneous space is that the perspective division loses the distinction between regions behind the camera and in front of the camera. Points in front of the camera have $w &gt; 0$, and behind the camera $w &lt; 0$. After dividing by $w$, points behind the camera get mapped (with a sign flip) to the same $x, y, z$ NDC space as those in front of the camera. So it is no longer possible to tell the difference; the original sign of $w$ is lost.</p>

<p>This implies that at least the $w$ clipping must be done in homogeneous space. For instance, triangles that have one vertex behind the camera must get clipped by the $w = 0$ plane to form a quad. Otherwise, you end up with a bizarre object called an "external triangle"—a triangle that appears in two pieces, both extending to infinity, originating from the in-front-of-camera and behind-camera regions of the original homogeneous triangle. </p>

<p>And I suppose that once you have to apply <em>one</em> of the clipping planes in homogeneous space, you might as well apply <em>all</em> of them there.</p>

<p>For further reading on this, here are a couple of good articles:</p>

<ol>
<li><a href="http://www.gamasutra.com/view/news/168577/Indepth_Software_rasterizer_and_triangle_clipping.php" rel="nofollow noreferrer">In-depth: Software rasterizer and triangle clipping</a> by Simon Yeung</li>
<li><a href="https://fgiesen.wordpress.com/2011/07/05/a-trip-through-the-graphics-pipeline-2011-part-5/" rel="nofollow noreferrer">A trip through the Graphics Pipeline 2011, part 5</a> by Fabian Giesen</li>
</ol>

CC BY-SA 3.0
2016-11-05T17:34:26.580Z
2016-11-05T17:34:26.580Z
Nathan Reed
<p>Is it just so you avoid unnecessary divisions or are there other advantages as well?</p>

<p>I've just implemented the Sutherland–Hodgman clipping algorithm and read online that you should do homogenization after clipping to avoid divisions and to "avoid messy special cases". Now I wanted to ask if someone knows what they mean by "messy special cases".</p>

<clipping>
Why should you do homogenization after clipping?
donutboy
# Why should you do homogenization after clipping?

(Asked by: username_0 on 2016-11-05)

Is it just so you avoid unnecessary divisions or are there other advantages as well?

I've just implemented the Sutherland–Hodgman clipping algorithm and read online that you should do homogenization after clipping to avoid divisions and to "avoid messy special cases". Now I wanted to ask if someone knows what they mean by "messy special cases".

**Tags:** clipping


---

## 1 answers

### Answer by username_1 on 2016-11-05. Score: 3 | Accepted answer

One good reason to do clipping in homogeneous space is that the perspective division loses the distinction between regions behind the camera and in front of the camera. Points in front of the camera have $w > 0$, and behind the camera $w < 0$. After dividing by $w$, points behind the camera get mapped (with a sign flip) to the same $x, y, z$ NDC space as those in front of the camera. So it is no longer possible to tell the difference; the original sign of $w$ is lost.

This implies that at least the $w$ clipping must be done in homogeneous space. For instance, triangles that have one vertex behind the camera must get clipped by the $w = 0$ plane to form a quad. Otherwise, you end up with a bizarre object called an "external triangle"—a triangle that appears in two pieces, both extending to infinity, originating from the in-front-of-camera and behind-camera regions of the original homogeneous triangle.

And I suppose that once you have to apply *one* of the clipping planes in homogeneous space, you might as well apply *all* of them there.

For further reading on this, here are a couple of good articles:

1. [In-depth: Software rasterizer and triangle clipping](http://www.gamasutra.com/view/news/168577/Indepth_Software_rasterizer_and_triangle_clipping.php) by Simon Yeung
2. [A trip through the Graphics Pipeline 2011, part 5](https://fgiesen.wordpress.com/2011/07/05/a-trip-through-the-graphics-pipeline-2011-part-5/) by Fabian Giesen


---

