Random shader performance question

Hi,

Curious about the shader cost of a sprite “flip book” shader compared to basic vertex animation shader.

I am testing out a flame shader, and unsure whether to go with vertex animation, or a sprite sheet, which method would be faster & why? Need to squeeze every ounce of performance on mobile.

Thanks in advance if anyone can provide some insight!

Depend on what you want, and how the effect look.

A flipbook is actually a vertex trick, we change the UV coordinate to sample different part of the texture.

So what will really matter isn’t the technique but the implementations as:

  • what’s the shader complexity
  • what’s the size of the texture (affect memory and bandwidth)
  • what’s the screen coverage of the effect (fillrate)
  • is there overdraws
  • opaque or transparent (relative to fillrate and overdraws)
  • which platform (desktop and mobile have different requirement due to different gpu architecture)

But ultimately, it doesn’t matter if you don’t hit the budget you have.

For mobile, it depend on what mobile but generally mobile use tile base system, overdraws, fillrate will be huge problem, if you cover weaker phone texture size might a problem (doesn’t matter if flipbook or not).

Hey, thanks for the reply! I am familiar with those performance bottle necks, I was more curious about the performance of each operation. From my understanding both are very cheap so the difference may be negligible, and I imagine it depends on the GPU architecture like you said, but in this case I suppose I am asking in general for modern ish mobile GPUs (which I imagine also vary quite a bit).

I don’t like using this term, but “all things being equal” is manipulating UVs, or manipulating vertex position a more expensive operation, given the shaders/memory were identical besides the former.

Most likely you won’t see any difference. Only if you’re bound by vertex shader ALU, which means that your vertex shader should be really complex.

1 Like