I need to read the depth information of the scene on the cpu every frame, which I use to generate a new texture that gets sent to a final image effect shader. How can I read the depth data outside of the shader? I think I have to render it to a rendertexture, but will I be able to read the data from a rendertexture (no GetPixel() function in RenderTexture, only Texture2D)?
be sure you need to do this. any reading of the GPU output by the CPU will incur a GPU pipeline stall, possibly hurting the frame-rate. that might be fine in your situation, but it might not be.
You can then use GetPixels() as normal, but, as @elenzil points out, this is slow to do every frame. If you're sending this back to an image effect anyway, do you really have to retrieve it to the CPU? Can you do all the remaining processing on the GPU side?
I need the depth info on the cpu because I can't set neighbor pixel values in the shader. I could use multiple passes on the gpu, but I would probably need about ten passes (im guessing its faster to just do it on the cpu, I will have to test it).