I'm a bit new to graphics rendering and APIs and wanted to ask anyone experienced with rendering APIs for some opinions. I have my own sprite API for pushing quads into a buffer. The quads are sorted on the CPU.
What is generally the preferred method for implementing transparency for 2D sprites, where the transparency of individual sprites can be adjusted over time? Would it be preferred to set a shader uniform on different draw calls, and try to sort sprites into calls? This might work if the transparency was quantized to say 0-255.
Or perhaps it's generally best to just place some alpha values into the vertex attributes of sprite quads directly? I am kind of shy about this idea since it seems a bit wasteful to place an alpha attribute 6 times into a single quad (I'm drawing quads with two triangles each).
Does anyone have any feedback or opinions to share?
Note: I've applied pre-multiplied alpha to all textures so complicated sorting shouldn't be necessary.