Implementing a deferred shading, I’d like to don’t store myself position to avoid to saturate the memory bandwith.
If I understand well, after the multiplication by the perspective matrix, the z part should be between -1 (near plane) and 1 (far plane).
Until there, it is okay, my problem is the depth buffer contains value between 0 and 1. So there is two possibilities : The first one is : value are converted from [-1, 1] to [0, 1]. The second one values are clamped (and there we lose a lot of information (the range between -1 and 0)…)
When I tried to store value with gl_FragDepth (-1 until 0 give me the same value : 0. I thought i’d have 0 and 0.5), it seems that the second solution was the good one. So I don’t understand why OpenGL wants to lose this information…