I’m trying to get the underwater distance when rendering water.
I only have refraction map’s depth buffer texture (a bit distorted though - I’m scaling vertices in the projection matrix to avoid problems near the borders of viewport with distorted texture coordinates) and the water pixel data.
The question is - how to convert them all to a linear space to get the underwater depth? (Actually I can get the distance from camera to water plane easily so the only thing I can’t do at the moment is getting something useful out of that depth buffer texture).
I’ve tried different variables and combinations but I guess I haven’t learned enough about all the spaces and thus they’re confusing to me…
EDIT: I thought about this again myself and used different keywords in google so I found this: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=234519
I tried some more combinations and so I finally got it to work. So you can close the topic now or even delete it.