using the transparency/cutout shader is lowering my fps by 7 frames, isn't alpha test cheap to render? is there any guidelines when using alpha test in Unity? Its even slower than the transparent /diffuse shader which uses much more expensive alpha blending.
As far as I remember, there is no hardware support for alpha testing in OpenGL ES 2.x; thus, Unity adds some code to the fragment program in order to implement it, presumably discard instructions, which are rather expensive on some GPUs (specifically the GPUs in iOS devices) because certain optimizations are deactivated as soon as you use a discard instruction.
So what is the proper way of replacing alpha test if you have no alpha test acceleration hardware and discard is expensive? I find it rather intriguing that there is no way to do alpha test efficiently.
It depends. As royter mentioned, alpha blending is usually more efficient. In some cases, using more complex geometry might be better than using alpha masks.
I recommend a combination. Don't do the 1-quad approach. Instead, model the geometry, use an opaque material for the appropriate areas, and use a blending or cutout one where it can't be opaque. You don't have to go overboard with the vertex count for this to yield a huge performance improvement. (Red material is alpha blended, blue is opaque.)
depends how much screen space in total the plants take up and how many there are. Surely you know this? Jessy's suggestion works best of all for large gui's or large screen fills. Probably medium too. 42.
Hi! Did anyone maybe found a solution for warning: "Shader is using clip instruction (usually caused by alpha test)" I can say, that even with this warning, on Android Samsung Galaxy S and Samsung Galaxy S Advance, scene works fast. By fast I mean as fast as using mobile/diffuse shader. If I use alpha test shader, there is no performance drop. It might happened that on some other Android device FPS drops...
As a workaround you can use an IF statement in the shader. While this has the same negative impact as discard, it doesn't discard the entire occlusion pipeline for tile deferred renderers (so I imagine) so should still be quicker than a discard on Power VR GPUs... Although you'll have to test this! Better still use alpha blend. Fast on desktop (come on, it's desktop), fastest way on mobile. it *WILL* have a performance hit on quite a few droid devices. Anything with a Power VR GPU for a start. Don't forget its not just screen space, but how much is overdrawing, it's probably just one of those things you're going to have to make compromises on.