On character models, is it a good idea to join the transparent parts of the mesh (that needs alpha discarding) with the opaque parts when possible (i.e when they use the same texture) to reduce draw calls, or I better keep transparent and opaque parts separate?
One draw call versus two… but depending on the amount of transparency it still could be an even trade, I guess.
I would tend to split them out but that’s because I often find the need to tweak shaders that use transparency to not do dumb things when farther away. But I have also experienced cases where transparent rendering on some cards was a real pig… but this was 8+ years ago now.
Also, on some level it’s good to have some of these “maybe” optimizations in your back pocket for later. The swapping is easy enough later if it turns out to be worth it.
It’s nice to have this list of things that might be performance wins down the road. Keep development easy now and then look forward to being able to boost performance a bit when things are feeling like they are dragging and then get a nice win.
…though on this topic, I really doubt it will sway things significantly one way or the other.
Anyway, by leaving these potentially easy wins for later, I usually figure I have at least a 10% and sometimes 20% improvement waiting for me when I have time to go and implement all of them. In the mean time, I get closer to a working game and keep things simpler.
My understanding is that “discard” prevents certain types of optimizations but I don’t know how significant that really is. And if you discard early and your fragment shader is otherwise doing a ton of work after then to me discard could be better.
…but even then, it’s hard to say if the ‘discard’ would be immediate in terms of calculations or would be on a parallel branch.
And older cards will behave different than newer ones, blah blah, etc.