Comment 11 for bug 1458694

Revision history for this message
Loïc Molinari (loic.molinari) wrote :

Daniel, relying on HW texture minification (or magnification) filters is fast but quite ugly in terms of contour anti-aliasing quality. Using distance fields instead allows for instance to have a 16x16 contour texture that can be rendered at 256x256 at perfect quality. It just requires a texture lookup and a smoothstep(). Retrieving the standard derivatives is almost free since the 4 texels required for the subtraction have already been fetched during the texture lookup (so still cached). It is the perfect thing for the shape since we need to get the shape mask under any scale factor as required by our grid unit system.

This technique has been used for a decade now and is efficient, easy to implement and lightweigth in terms of texture usage. This is for instance also used by QML for text rendering. More info can be found there : http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf