Original Post
Hi all, I want to implement a linearized depth buffer via a vertex shader. My problem: it doesnt seem to work :). I read various resources, namely this gamedev discussion, this article, and the part about linear depth buffers in the paper about shadow mapping. I understand that you multiply z by w, to anticipate the 'unlinearizing' divide, but I must be doing something wrong in the division that is supposed to map z back to [0,1]. the webpage suggests dividing by the farplane; the paper says z' = zl * w; where zl = -(z_eye+near)/(far-near). They both don't work, for some reason. I have taken a look at the opengl perspective matrix and tried some naieve guesses, but that didnt work either, I must be missing something. If anyone does have some ideas or a good explanation, your help would be very welcome. Thanks for reading anyway! bassman