Do you want it to fade out when you're close to it? Then you need the depth at a certain pixel. For what you're wanting, learn up on the worldposition uses in shaders. This allows you to access an opaque shader's position in the world in x,y,z. For the fog, have a plane/shape/(could define a form in the shader), and sample…