Smoothing / Antialiasing sprites

Started by
1 comment, last by Cthulhu 24 years, 6 months ago
I don't know how exactly it is done in games. Maybe like you say, maybe not. As far as smoothing is concerned they use filters. like

[1 4 1]
[4 20 4] : 3 × 3
[1 4 1]

[1 1 1 1 1]
[1 4 4 4 1]
[1 4 12 4 1] : 5 × 5
[1 4 4 4 1]
[1 1 1 1 1]

i don't think this is a fast way of doing it in games, since it takes a whole image (640x480x24) about 1 second to use such a filter......it's the way i do things on my PictureShop.

------------------
Dance with me......

Advertisement
Some games like Rage of Mages 2 or The Reap use some kind of smoothing on sprite borders to make them look antialiased. How can this be done fast?

Method I'd figure out is to have 2 images per sprite, other blit normally and other transcluent (the one that only contains some pixels around sprite borders). Anyone got better ideas?

------------------
"Tank, I need an exit. Fast!"

A better approach is to rely on "alpha blending" or "edge blending"

Beyond the naming BS , this is a question of having patially transparent pixel around the edges of your sprites. If sprites a rendered in a 3D package, this is easily achieved by rendering on a transparent background, if not, it requires a seriously talented 2D artist .

Anyhow, you need to set each color channel of the destination pixel according to the following eq. (assuming a true color (no palette) mode):

d=(1-a)*d+a*s

where "a" is transparency (1.0 for opaque, 0.0 for transparent), "d" is the destination pixel and "s" is the source pixel.

With respect to performance; it's not a major hit if you only use it for edges, but you can't use HW blitting (and that's a real pain )...

(Note: For real-world use you don't wanna use the eq. above, instead you pre-multiply the transparency on the source image, and then invert it, giving the following equation: d=a*d+s)

/Niels

<b>/NJ</b>

This topic is closed to new replies.

Advertisement