Good Afternoon,
I am trying to write a shader using the refract pass that compares the depth at a given screen position with the depth at the same screen position from the previous passes. The goal being that I find the difference in depth between the object I am rendering and all others in the scene. Currently, this is what I am trying to do.
//this retrieves the previous depth at location
texture2D(sDepthBuffer, vScreenPos.xy).r;
//this retrieves the depth at the current fragment (this is done in the vertex and interpolated to the fragment)
GetDepth(gl_Position);
Perhaps this is not the correct way to achieve this. Could someone point me in the right direction? Thanks!