Get distance to camera with shaders and buffers

Just make a reservation I am a noob in shaders, but I remember a similar topic.