Compute Shader to read textures in a fast way

I am currently hard-stuck trying to read entires textures in a fast way with UE5, and since reading pixel-per-pixel values from the CPU is extremely slow I thought compute shaders could be the way.

My idea is to input the texture and fit the values into an array (like an array of float4) with the same length as the number of pixels of the texture.

I wanted a shader that works with varying size textures, but I would have to change the number of threads dynamically depending on texture size, so I am not sure I can do that.

Then: can I return the array containing those pixel values in a way? How do I set it up?

Thanks for anyone who will respond :smiley:

1 Like