<p>It's not possible to cut a hole in the image by altering the projection matrix, no. However, you can mask out rendering in that region by using the depth test or stencil test.</p>
<p>For example, before rendering your scene, you could render a depth-only quad at the near plane to define the excluded region. Then any subsequent rendering will be clipped to outside of that region, because it will fail the depth test. The region doesn't have to be a rectangle with this approach, either; it can be any shape.</p>

CC BY-SA 4.0
2022-05-19T20:46:03.047Z
2022-05-19T20:46:03.047Z
Nathan Reed
<p>I have the following projection matrix:
<a href="https://i.sstatic.net/XMDwq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XMDwq.png" alt="Projection matrix overview" /></a></p>
<p><a href="https://i.sstatic.net/mxmvj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mxmvj.png" alt="Projection matrix formula" /></a></p>
<p>and I need to make a hole in the center of my matrix, something like that: (I don't want to project a custom W and H)
<a href="https://i.sstatic.net/f0KiC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/f0KiC.png" alt="Example of projection matrix wihout center" /></a></p>
<p>Is that possible ? Thanks.</p>

<mathematics><projections><matrix><camera-matrix><directx>
Is it possible to make a projection matrix to not project in the center?
Cosma Eduard
# Is it possible to make a projection matrix to not project in the center?

(Asked by: username_0 on 2022-05-19)

I have the following projection matrix:
[![Projection matrix overview](https://i.sstatic.net/XMDwq.png)](https://i.sstatic.net/XMDwq.png)

[![Projection matrix formula](https://i.sstatic.net/mxmvj.png)](https://i.sstatic.net/mxmvj.png)

and I need to make a hole in the center of my matrix, something like that: (I don't want to project a custom W and H)
[![Example of projection matrix wihout center](https://i.sstatic.net/f0KiC.png)](https://i.sstatic.net/f0KiC.png)

Is that possible ? Thanks.

**Tags:** mathematics, projections, matrix, camera-matrix, directx


---

## 1 answers

### Answer by username_1 on 2022-05-19. Score: 4 | Accepted answer

It's not possible to cut a hole in the image by altering the projection matrix, no. However, you can mask out rendering in that region by using the depth test or stencil test.

For example, before rendering your scene, you could render a depth-only quad at the near plane to define the excluded region. Then any subsequent rendering will be clipped to outside of that region, because it will fail the depth test. The region doesn't have to be a rectangle with this approach, either; it can be any shape.


---

