Performance for fully transparent pixels in Sprite

Just a question that I got today and that I am not really sure about the answer to.

If I create a sprite (that is a quad with a texture on it) that uses the Unlit Transparent shader and then have a completely transparent texture (0% opacity), will the performance cost be the same as if I had semi-transparent pixels in that texture? Can OpenGL tell that it is fully transparent so no alpha-blending calculations need to be made?

Thank you for any answers!

It will be equivalent to a semi-transparent pixel.

Normally you could enable Alpha Testing, however iOS hardware doesn’t handle alpha testing very well at all, and if you turn that on you can potentially take a large hit with a loss of early out operations in other areas, such as Depth Testing.

That being said, PowerVR hardware handles opaque pixels, which should make up the large majority of pixels, magnitudes more performant than any desktop card because it does z depth testing before processing anything for the pixel, preventing it from doing any work, while desktop gpus are stupid enough to calculate the whole shaders which is pretty heavy with todays engines and then at the end it realizes ‘oh it was behind’ and drops it after wasting potentially hundreds of ops on that pixel.

think if you really need transparent pixels and if you don’t want to use real geometry instead cause it can handle geometry pretty easily on 3GS+ to a relatively high degree for mobiles and geometry removes all those off object ‘alpha 0’ areas completely from existance :wink:

Very interesting guys, thank you very much for this information! I guess the the hunt for badly trimmed sprites may begin :wink: