![](https://csdnimg.cn/release/download_crawler_static/8374417/bg1.jpg)
Improved Alpha-Tested Magnification for Vector Textures and Special Effects
Chris Green
∗
Valve
(a) 64x64 texture, alpha-blended (b) 64x64 texture, alpha tested (c) 64x64 texture using our technique
Figure 1: Vector art encoded in a 64x64 texture using (a) simple bilinear filtering (b) alpha testing and (c) our distance field technique
Abstract
A simple and efficient method is presented which allows improved
rendering of glyphs composed of curved and linear elements. A
distance field is generated from a high resolution image, and then
stored into a channel of a lower-resolution texture. In the simplest
case, this texture can then be rendered simply by using the alpha-
testing and alpha-thresholding feature of modern GPUs, without a
custom shader. This allows the technique to be used on even the
lowest-end 3D graphics hardware.
With the use of programmable shading, the technique is extended
to perform various special effect renderings, including soft edges,
outlining, drop shadows, multi-colored images, and sharp corners.
1 Introduction
For high quality real-time 3D rendering, it is critical that the limited
amount of memory available for the storage of texture maps be used
efficiently. In interactive applications such as computer games, the
user is often able to view texture mapped objects at a high level
of magnification, requiring that texture maps be stored at a high
resolution so as to not become unpleasantly blurry, as shown in
Figure 1a, when viewed from such perspectives.
When the texture maps are used to represent “line-art” images, such
as text, signs and UI elements, this can require the use of very high
resolution texture maps in order to look acceptable, particularly at
high resolutions.
In addition to text and UI elements, this problem is also common
in alpha-tested image-based impostors for complicated objects such
as foliage. When textures with alpha channels derived from cover-
age are magnified with hardware bilinear filtering, unpleasant “wig-
gles” as seen in Figure 1b appear because the coverage function is
not linear.
In this chapter, we present a simple method to generate and ren-
der alpha-tested texture maps in order to minimize the artifacts that
arise when such textures are heavily magnified. We will demon-
strate several usage scenarios in a computer game context, both for
∗
e-mail: cgreen@valvesoftware.com
3D renderings and also user-interface elements. Our technique is
capable of generating high quality vector art renderings as shown
in Figure 1c.
2 Related work
Many techniques have been developed to accurately render vec-
tor graphics using texture-mapping graphics hardware. In [Frisken
et al. 2000], distance fields were used to represent both 2-
dimensional glyphs and 3-dimensional solid geometry. Quadtrees
and octrees were used to adaptively control the resolution of the
distance field based upon local variations. While GPU rendering
of such objects was not discussed, recent advances in the general-
ity of GPU programming models would allow this method to be
implemented using DirectX10 [Blythe 2006].
In [Sen 2004] and [Tumblin and Choudhury 2004], texture maps
are augmented with additional data to control interpolation between
texel samples so as to add sharp edges in a controllable fashion.
Both line-art images and photographic textures containing hard
edges were rendered directly on the GPU using their representa-
tion.
In [Loop and Blinn 2005], implicit cubic curves were used to model
the boundaries of glyphs, with the GPU used to render vector tex-
tures with smooth resolution-independent curves.
In [Qin et al. 2006], a distance based representation is used, with
a precomputed set of “features” influencing each Voronoi region.
Given these features, a pixel shader is used to analytically compute
exact distance values.
Alpha-testing, in which the alpha value output from the pixel shader
is thresholded so as to yield a binary on/off result, is widely used
in games to provide sharp edges in reconstructed textures. Unfortu-
nately, because the images that are generally used as sources for this
contain “coverage” information which is not properly reconstructed
at the subtexel level by bilinear interpolation, unpleasant artifacts
are usually seen for non-axis-aligned edges when these textures are
magnified.