Vector textures

These days it is hard to come by a technique that is extremely flexible, produces very good results and doesn’t even need a shader. The 3 screen shots below are screen shots zoomed in to a glyph and show what is achievable using vector textures.

Original 4096×4096 texture Original texture resized to 128×128 Vector texture resized to 128×128

The demo I have made is an implementation of notes from a SIGGRAPH Course by Valve [1]. The paper describes methods to improve text rendering (or any vector shape) using very simple techniques that would work on a GPU that does not support shaders. If you read the notes from Valve you will realize that you can implement a variety of effects quite easily.

This is what I consider to be a working example with rough edges. The demo below has 2 modes – 1 that uses the fixed function pipeline and another which attempts to anti-alias edges using a very simple shader. So far my distance field generator is pure brute force and takes excessively long to generate vector textures. Secondly and may be more importantly, I haven’t been able to generate sharp edges. The Valve paper describes a method of generating a distance field in 2 channels and I plan to investigate this further. After extracting the file, open readme.png to see how to use the demo.

As usual, please contact me if you have suggestions or questions.

Updates – 29 Sept 2011

I recently came across a very simple and very fast algorithm to approximate a signed distance field (SDF). The algorithm called Signed Sequential Euclidean Distance Transforms (SSEDT) was first presented in a paper by Leymarie & Levine [2]. The algorithm involves convolving a pre-initialized distance field using 4 masks in a specific order and directions. While it is not 100% accurate, the algorithm generates a signed distance field at least 100 times faster than the brute force approach and is accurate enough for most purposes such as the one here. Leymarie & Levine present two variations of the algorithm: 4SSEDT and a more accurate 8SSEDT which is slightly slower. Full details can be found in the paper below [2]. My vector texture generator now uses the 8SSEDT algorithm to generate a SDF. I have also included the source code below for anyone who is interested.

References

  1. C. Green, “Improved alpha-tested magnification for vector textures and special effects,” in ACM SIGGRAPH 2007 courses, 2007, 9–18.
  2. F. Leymarie and M.D. Levine, “Fast raster scan distance propagation on the discrete rectangular lattice,” CVGIP: Image Understanding 55, no. 1 (1992): 84–94.

Downloads