# pouët.net

## Antialiasing methods

category: general [glöplog]

Hi, I would like to know the best methods of outline-contour antialiasing, I prefer nonrealtime very nice 2d "edge" smoothing, but any useful antialiasing methods in general are useful too. That is all for beginning, Thank you
added on the 2009-06-02 16:24:23 by lilibox
Supersampling sounds like a good way to get started, it's simple and gives better results than multisampling but it's also more expensive.

You can also try to antialias your edges through postprocessing effects but it can quickly become complex and expensive. It will mainly work with 3D stuff since you will have to do various edge detections on the normals and depth variations, not on the colors themselves or else you will blur everything.
added on the 2009-06-02 16:32:03 by keops
lilibox, tell us what do you want to antialiase.
added on the 2009-06-02 16:50:04 by texel
for nonrealtime just use supersampling.
added on the 2009-06-02 16:51:14 by xernobyl
what about AA in deferred shading? what's the state of the art on this subject?
added on the 2009-06-02 16:52:15 by xernobyl
upscale x2 then downscale x2 again :P
random pt scener: depends - dx9 and dx10 users have different options available.
added on the 2009-06-02 17:07:43 by smash
Maybe bit offtopic but a very much realtime software algorithm that does wonders:

1. Write an antialiased line algorithm.

2. Find the part that does:

dest[xi,yi] += (color-dest[xi,yi])*(1-xf)
dest[xi+1,yi] =(color-dest[xi+1,yi])*xf

3: Change it to:

if (xf<0.5) dest[xi,yi] += (dest[xi+1,yi]-dest[xi,yi])*(0.5-xf)
else dest[xi+1,yi] += (dest[xi,yi]-dest[xi+1,yi])*(xf-0.5)

4. After filling polygons, use this on all edges that need smoothing. (texture change, other face culled, etc..)

5. Fight several days getting subpixel accuracy _exactly_ right.

added on the 2009-06-02 17:19:08 by 216
thank you all folks for such fast replies, I'll be kinda precise I need to antialias mainly black line that is original generated as black/white scan - no antialiased yet, and that is 1pixel thin and i need to get the most smoothed-edge but sharp-colour look and second use is for antialiase 2 different colours shapes-areas there i must do the most smooth transit of both colours
added on the 2009-06-02 17:22:43 by lilibox
additional information, I will work with small image sizes, about 70-120 pixels diameter and sources are bitmaps which these are not planed to by put on polygons and then manipulate on OpenGL base routines
added on the 2009-06-02 17:25:40 by lilibox
so then basically what maali said: get the biggest scan possible, then convert to grayscale, then scale it down in photoshop (with default resampling mode, bicubic, it should be fine)
added on the 2009-06-02 18:06:46 by BarZoule
yes, but i must to do it by my own code, no 3rd app to help me are allowed
added on the 2009-06-02 18:18:42 by lilibox
scaling down algos can be simple.
just to the average of all the sub-pixels.
if it's black and white only, then you can add some contrats to make things sharper, but caution tho as too much will reveal the pixels, and no longer look smooth.
added on the 2009-06-02 18:47:41 by BarZoule
When I was a lad we had to do our anti-aliasing by hand. And we only had 32 colours AT MOST. And one of those was 'transparency'. And we had to do it all in DPaint 2 (because 3 wasnt that great and 4 had yet to be invented). And we had to do it using a TV (because monitors were ridiculously expensive). And we had to wear gloves because it was snowing.

So dont come to me with your nancy boy 'sub pixel accuracy' issues.
added on the 2009-06-02 20:10:14 by Mtl
Do you have any examples of what the source images look like?
added on the 2009-06-02 20:48:18 by doomdoom