Implementation of the alpha distribution methods.
This file includes an implementation of the alpha distribution methods using alpha pyramid and error diffusion used for pre-computing textures to be used with alpha testing or sampleMask-to-alpha.
Alpha testing using the original alpha values of a texture cannot handle semi-transparent regions and often leads to problems with mipmapping. Alpha distribution is a pre-processing approach that modifies the alpha values of mipmap levels, such that they can properly handle semi-transparent regions.
The AlphaDistribution class provided in this file implements two methods that can be used for alpha distribution: error diffusion and alpha pyramid. Both methods produce similar results with minor differences.
More details can be found in the original publication:
Cem Yuksel. 2017. Alpha Distribution for Alpha Testing. PACM on CGIT (I3D 2018). http://www.cemyuksel.com/research/alphadistribution/