# Depth buffer and multiple projections

This topic is 3030 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a question regarding the depth buffer and near/far clip planes. If I define an ortho projection with a certain near and far clip plane, do some rendering, then define a new ortho projection with a different near and far clip plane and do some further rendering, what happens with the depth buffer? I am under the impression that the depth buffer is by default '1.0' deep, and that represents the range of nearplane->farplane in the viewport. But if the near and far planes change within a single render (i.e without clearing depth buffer between ortho's), what happens to the depth range, etc? Would it be that something half way between near and far planes in ortho projection one gets the same depth buffer value as something half-way between the near and far planes as ortho projection two? for example, would the following be true (all based from 0.0)?: ortho 1: near = 10.0, far = 20.0, render depth = 15.0, depth buffer depth = 0.5 ortho 2: near = 6.0, far = 7.0, render depth = 6.5, depth buffer depth = 0.5 Cheers!

##### Share on other sites
The orthographic projection maps the Z-value linear between the near and the far clipping plane. So, if something is exactly in the middle between these two it will get the depth value of 0.5. The both of your examples are correct.

One should remember that the points multiplied by the orthographic projection matrix have their depth values within the range of -1 to 1. However these values get again mapped to (0,1) before being passed further to the depth buffer.

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 29
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631740
• Total Posts
3001959
×