<p>3D clipping is usually done in clipspace coordinates, that means the perspective matrix is used for sending the primitives to clipspace before doing the actual perspective projection. You can visualize the clipspace as a view frustum but with the shape of a box. So it is very fast to clip primitives against a AABB. The math is a little involved, but is all explained in this blog post: </p>

<p><a href="https://unspecified.wordpress.com/2012/06/21/calculating-the-gluperspective-matrix-and-other-opengl-matrix-maths/" rel="nofollow noreferrer">Calculating the gluPerspective matrix and other OpenGL matrix maths | Unspecified Behaviour Blog</a></p>

CC BY-SA 3.0
2017-12-29T18:26:48.860Z
Thanks, but the blog post doesn't explain perspective clipping.
chaosink
CC BY-SA 3.0
2017-12-29T18:47:53.493Z
I think it does. What is perspective clipping for you?
Mauricio Cele Lopez Belon
CC BY-SA 3.0
2017-12-28T04:07:40.420Z
2018-03-06T08:42:25.230Z
2018-03-06T08:42:25.230Z
Mauricio Cele Lopez Belon
<p>In the following two graphs,</p>

<ul>
<li>the red lines are borders of the perspective-projection frustum,</li>
<li>the blue lines are to be rasterized,</li>
<li>the green lines are perspective-projection lines, which are wrong.</li>
</ul>

<p>How do modern GPU pipelines do such clipping given only a perspective-projection matrix?</p>

<p><a href="https://i.sstatic.net/A39Hi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/A39Hi.png" alt="enter image description here"></a></p>

<p><a href="https://i.sstatic.net/936y3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/936y3.png" alt="enter image description here"></a></p>

<opengl><gpu><rasterizer><clipping><directx>
Clipping for perspective projection
chaosink
# Clipping for perspective projection

(Asked by: username_0 on 2017-12-23)

In the following two graphs,

* the red lines are borders of the perspective-projection frustum,
* the blue lines are to be rasterized,
* the green lines are perspective-projection lines, which are wrong.

How do modern GPU pipelines do such clipping given only a perspective-projection matrix?

[![enter image description here](https://i.sstatic.net/A39Hi.png)](https://i.sstatic.net/A39Hi.png)

[![enter image description here](https://i.sstatic.net/936y3.png)](https://i.sstatic.net/936y3.png)

**Tags:** opengl, gpu, rasterizer, clipping, directx


---

## 1 answers

### Answer by username_1 on 2017-12-28. Score: 2

3D clipping is usually done in clipspace coordinates, that means the perspective matrix is used for sending the primitives to clipspace before doing the actual perspective projection. You can visualize the clipspace as a view frustum but with the shape of a box. So it is very fast to clip primitives against a AABB. The math is a little involved, but is all explained in this blog post:

[Calculating the gluPerspective matrix and other OpenGL matrix maths | Unspecified Behaviour Blog](https://unspecified.wordpress.com/2012/06/21/calculating-the-gluperspective-matrix-and-other-opengl-matrix-maths/)

> **Comments:**
> **username_0**: Thanks, but the blog post doesn't explain perspective clipping.  
> **username_1**: I think it does. What is perspective clipping for you?  

---

