Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why shouldn't the z coordinate be normalized to the [0,1] range instead of [-1,1]? As I understand it, that happens some time after anyways, so what's the catch with this?

share|improve this question

The question could very easily be turned around: why the [0, 1] range? What makes that range special?

NDC space is a cube; every component is on the [-1, 1] range. So it's very nice, neat, and uniform. That's why OpenGL uses that space. It's simple, obvious, and very regular.

What you suggest is to turn that nice, neat, uniform cube into a rectangular prism. There is nothing to gain from such a space. Why be irregular when you can be regular?

As I understand it, that happens some time after anyways

No, it does not. The transform from NDC space to window space uses the current glDepthRange setting. That may be [0, 1], and that's what it is by default. But there's no rule that it must be. It can be anything you want, so long as both values are between 0 and 1. You can even reverse the near and far, using a range of [1, 0].

share|improve this answer
Another good thing is that with a [-1, 1] range it's easier to figure out a negative/opposite direction compared to a [0, 1] range when you need to manipulate something. (At least I find it easier) – Darkwings May 13 '12 at 12:43
I would add that you have an extra bit of information, so before depth value is saved into the 24 bit buffer it could have 1 more right bit in the pre-final calculation (does not matter that much :D) – DarioOO Feb 13 '15 at 11:43

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.