AlphaState setTestFunction

Is there a place where I could understand what does it means to set AlphaState.TF_ALWAYS or AlphaState.TF_GREATER or any other?



found it on http://www.jmonkeyengine.com/doc/com/jme/scene/state/AlphaState.html

but didnt understand what is reference alpha

It talks about how to stack alpha effects, for instance, you might want have alpha blending only when some object is more opaque than the one rendered before in the same spot (because the camera is looking through more than one (semi-)transparent object).



These values set the policy for passing the depth test, and thus, being rendered.

Erm, no.

It's not the depth test, it's the alpha test; alpha test discards fragments which fail it. If you set the function to GREATER and reference value to 0.1, then it will only draw fragments which have alpha greater than 0.1, if you set to LEQUAL and reference value 0.8 it will only draw fragments with alpha less than or equal to 0.8, etc.

ooooh, now I see.

I can set the reference in alfaState.setReference();

so let me see if I got it:

if I setReference(0.8 ) with TF_GREATER then my transparent object will be rendered if it has an alfa value greater than 0.8?

Momoko_Fan said:

Erm, no.


That is what I said  :P... only more opaque object will be displayed... It is just that they are termed a depth-test policy, which is "redefined" as having a greater alpha value.