<p>I am trying to implement clipping in my simple renderer, but i have a trouble with setting the boundaries. I used the same projection matrix that is in OpenGL. The problem is, the vertices that are behind the camera(z&lt;near) when mapped to NDC are bigger than 1(but they should be less than -1), so i can't use vertex.z &gt; w. <img src="https://i.sstatic.net/HZEAg.png" alt="enter image description here" /></p>

CC BY-SA 4.0
2020-07-29T12:43:22.153Z
This is the expected behavior of a perspective transformation. Anything beyond the far plane is mapped to the range (1, 2f/(f-n)) and anything behind the camera gets mapped to (2f/(f-n), infinity). If you want test for "behind the camera", you can check to see if the value is greater then 2f/f-n. Once an object has been transformed into clip space it is usually not examined further. Are you implementing a software pipeline?
pmw1234
CC BY-SA 4.0
2020-07-30T13:06:45.463Z
I decided to clip near plane in world space and for other planes in NDC. Works quite well. Thanks for reply, though!
traksatov123
<3d><clipping>
Clipping 3D Perspective matrix
traksatov123
# Clipping 3D Perspective matrix

(Asked by: username_0 on 2020-07-26)

I am trying to implement clipping in my simple renderer, but i have a trouble with setting the boundaries. I used the same projection matrix that is in OpenGL. The problem is, the vertices that are behind the camera(z<near) when mapped to NDC are bigger than 1(but they should be less than -1), so i can't use vertex.z > w. ![enter image description here](https://i.sstatic.net/HZEAg.png)

**Tags:** 3d, clipping

> **Comments:**
> **username_1**: This is the expected behavior of a perspective transformation. Anything beyond the far plane is mapped to the range (1, 2f/(f-n)) and anything behind the camera gets mapped to (2f/(f-n), infinity). If you want test for "behind the camera", you can check to see if the value is greater then 2f/f-n. Once an object has been transformed into clip space it is usually not examined further. Are you implementing a software pipeline?  
> **username_0**: I decided to clip near plane in world space and for other planes in NDC. Works quite well. Thanks for reply, though!  

---

## 0 answers

