For each pixel written by a shader in Unity3D I would like to add it to a global variable somewhere so that I can read it back later. So, if the shader program iterates over 1000 pixels writing the color (1,0.5,0) the result I want back to my program would be (1000,500,0).
The actual calculation is much more complex of course, and very time consuming as it has to be done millions of times, doing calculations using multiple textures. So, I need to take advantage of the parallel computing ability of the GPU.
I read somethings about compute shaders that allows shaders to write numbers that can be read back, but I have a hard time to find any relevant example.
Any pointers would be useful.