"Discard" CG fragment

Hello,

in order to some perf tests, and because AlphaTest has been totally removed from OpenGL ES 2.0 (was already deprecated in 1.1),

I would need a basic Alpha Test replacement, with the use of Discard function or anything else, in a CG fragment.

How could it be achieved ?

Thanks for your attention :slight_smile:

Unity doesn’t support fragment shaders on the iPhone yet, even ones supporting OpenGL ES 2.0.

However, even once support is implemented, using the discard keyword carries a similar performance penalty to alpha testing. See the bottom of this page for more information.

Hello Daniel, thank you for your quick answer.

Damn, too bad CG aren’t supported, as it was the main highlight for ES 2.0 :frowning:

As for Discard performance being the same as AlphaTest, I saw that too, but strangely, some people in other forums (iDevGames,opengl.org) are stating that Discard is faster than AlphaTest (and some others don’t).

Here is one thread example.