Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

For RenderToTexture/Camera based portal rendering, the basics seems simple enough.

However, with a free camera, most of the time it is going to be looking at such portals at an angle:

view volumes

Now a regular near clipping plane will not always work here, it will either intersect with the wall the portal is sitting on, or possibly with objects in front of the wall.

The desired near clipping plane would be aligned like the portal, producing a view volume more like this:

enter image description here

or this in 3D: enter image description here

So here is my question:

How does one construct or "truncate" a view/projection matrix to achieve such an off-camera-normal (near) clipping plane?

share|improve this question
Would it work to simply contain the room in a bounding box and cull everything not in the box rather than mess with an angled near plane? –  Steve H Nov 6 '12 at 13:23
I don't think so, as the problem is with the near plane intersecting the wall of the room or objects inside it. –  melak47 Nov 6 '12 at 17:17
I don't understand that statement. None of your diagrams show the near plane intersecting a wall. –  Steve H Nov 8 '12 at 0:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.