The fact is that there was no autoparam for alpha rejection value, so I added it to Ogre (https://ogre3d.atlassian.net/browse/OGRE-166) because the 2 other solution have huge drawbacks:
- the first one is to set a custom param on each renderable with alpha rejection passes, and use it in the shader for comparison, but changing the value on a pass dynamically is a problem, as we have to find all the renderable that uses this (material) pass, and set the custom parameter again -> unmanageable in real situation...
- the second is to generate a shader for each possible value of alpha rejection -> memory waste, almost identical shaders with only a different const value, that should be a variable value...
So I named this new auto param ACT_SURFACE_ALPHA_REJECTION_VALUE, or 'surface_alpha_rejection_value' in programs scripts.
It binds the alpha rejection value stored in the material pass converting it to a [0.0; 1.0] floating point value:
Code: Select all
autoParamValue = 255.0f / Ogre::Pass::getAlphaRejectionValue();