Jump to content

  • Log In with Google      Sign In   
  • Create Account

Smoothing / Antialiasing sprites


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Cthulhu   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 October 1999 - 02:02 AM

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!"


Sponsor:

#2 CJ   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 October 1999 - 10:27 PM

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......


#3 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 October 1999 - 02:02 AM

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





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS