- Home /
What's faster? Two draw calls or a black/white alpha blend?
What would be faster? Using the shader I posted here, or using two meshes with this shader?
If this question is about shaders in Unity iPhone, please use the iPhone tag and make it clear from the question that you are talking about iPhone.
It's not. I tested it in Unity iPhone, and gave my results as it pertains to Unity iPhone, but the question itself is not related to batching.
Answer by Jessy · Dec 21, 2009 at 07:14 AM
No, there's no sorting necessary, because this isn't about blending with what's on-screen already.
I did a test tonight after I got home. With 30 visible instances of that eyeball thing from the first link, broken into two pieces (60 draw calls), I got about 33 fps on my iPod touch 2G. With the black/white vertex color blended shader (30 draw calls), I got about 36 fps.
On my iPhone 3GS, it was about 40 versus 41.
So the difference doesn't appear to be great. If you have two meshes that are always going to be visible on screen together, using the black and white "blending" route might be worth doing. Otherwise, probably not.
EDIT: I did two another test with 25 eyeballs, but with duplication of one material per part. Using the blending shader (1 draw call, 25 batched), I got 45 fps. But with two meshes (2 draw calls, 50 batched), I got 46 fps.
Seems like a balancing act that's not really worth bothering with. I think it's probably best to use two meshes, and try to batch the component parts with other things in the scene with similar color.
Answer by Peter Alexander · Dec 21, 2009 at 04:52 AM
It's hard to say. Alpha blending is typically pretty fast, but then it has to be sorted in order to get semi-correct draw ordering.
I'd guess alpha blending, but the only way you're going to find out is by trying it and seeing what works best.