Question about Memory Usage + Performance Evaluation on Animated Textures

Lets say I have 64 frames of 256x256 animated texture, would it be better if I pack them in one 2048x2048 texture and animate it with uv, or would it be better if I send them individually from C# using Shader.SetGlobalTexture()?
What does the hardware do exactly to handle both cases? What are the pros and cons for each of them?

In the case of using a 2K atlas, you will pay some extra cost of shading, the UV could be calculated per-vertex so the cost would be negligible in my opinion.
In the case of sending the textures, the shader will be super simple, but you will have some CPU cost of sending the tex per frame, which I would say is also negligible.

I use Shader.SetGlobalXXX in a lot of scrips, and I didn’t see any issues with it. So I guess you would need to have a ton of these to see a difference, and if you only have one, I would go with the one that is more convenient. But it would be interesting to try it out.

The first way is more efficient. There is overhead (on both the CPU and GPU, but mostly on the CPU side) for every texture you have. Also, by doing it with the UVs, you can do the animation on the GPU in a vertex shader instead of modifying any UVs on the CPU.

Because of the way that texture memory is structured (it basically expects there will be tons of cache misses, and there’s like 8 KiB of texture cache on most GPUs), I believe there won’t actually be any more cost to sampling a 256x256 region of a 2048x2048 texture than just a 256x256 texture. But don’t quote me on that. So the shading is identical.

Another option is a 3D texture where each frame is a slice. This will let you blend between frames. This isn’t good for a lot of animations, but works well for certain effects (eg a burning torch which can be done with a little animated texture instead of particles)