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.

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

1 Answer 1

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
2  
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

Your Answer

 
discard

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.