#point no.1
after transforming points via the projection matrix , we end up with the point in the range [-1,1],
but, in the depth testing chapter , the author mentions that
F_depth = 1/z-1/far /(1/near - 1/far) converts the view space coordinates i.e. z=zeye is transformed from [-1,1] to [0,1] .
I've followed this thread, and one of the members tell me that the formula F_depth
is actually a composition for a series of steps done, and outlines this step:
z_Clip = C*z_eye+D*W_eye
w_Clip = -z_eye
where C=-(f+n)/(f-n), D=-2fn/(f-n).
Projective division:
z_ndc = z_clip/w_clip
Depth range:
depth = a + (a-b)*(z_ndc+1)/2
where glDepthRange(a,b) .
I tried composing the formula as he had suggested, but this is completely different from the F_depth
formula given in learnopenGL.
#point no. 2
Also another member tells me that [-1,1] to [0,1] is the window viewport transformation, which has a different formula itself.
So, all of this is not making any sense to me(having 3 different formulas and explanations for the same thing that also for openGL), I'll bullet the queries I have regarding these contradicting ideas:
- Is F_depth a composition of transformations from view space to window space.
- Are the depth range transformation and viewport transformation the
same? Why do they have different forumulas(one in
Point no.1
and another in this link - How is the F_depth formula obtained? Or how is does the composition
of transformations done to convert the world space point to [0,1]
result in
F_depth
?