Manually antialiased primitives using texturing

For triangles, you're right. You inset the border 0.5 px and draw strips around it which outset 0.5 px as well (currently that's not what I'm doing, but I ought to be.) That gets you a 1 px strip fading from full to zero alpha.

But, what if you don't want a 1 px strip? What if you want 17 px? or 59.034 px? How big is your texture then? What if you don't want a linear fade on the strip?

Just look at the point case. How do you draw a 3 px point? I do it with trilinear mipmapping, so it blends the 4 px and 2 px mipmaps. There is some blur as I mention on the page but this is cheaper and easier algorithmically than keeping textures for sizes 1..N. (I did try it that way too, at first.)

The implementation details will be up in a while. The details are actually not as simple as you'd think-- there are a lot of edge cases to consider. Think about what happens to the 0.5 px inset when the triangle is only 0.9 px wide.

arekkusu Wrote:For triangles, you're right. You inset the border 0.5 px and draw strips around it which outset 0.5 px as well (currently that's not what I'm doing, but I ought to be.) That gets you a 1 px strip fading from full to zero alpha.

But, what if you don't want a 1 px strip? What if you want 17 px? or 59.034 px? How big is your texture then? What if you don't want a linear fade on the strip?

I assume, that since anti-aliasing is considered, the border strip is always 1px, and you always want a linear fade. I don't see where you would use other widths, because it would just blur. And besides, if you can generate a 1px border, you can also do 17px or whatever.

arekkusu Wrote:Just look at the point case. How do you draw a 3 px point? I do it with trilinear mipmapping, so it blends the 4 px and 2 px mipmaps. There is some blur as I mention on the page but this is cheaper and easier algorithmically than keeping textures for sizes 1..N. (I did try it that way too, at first.)

I would personally draw a point by drawing a polygon disk with the mentioned 1px border around the disk. Maybe not as fast as a textured quad, but guaranteed more accurate.

In fact, I would draw lines the same way, by making them polygons, not by using textures.

arekkusu Wrote:The implementation details will be up in a while. The details are actually not as simple as you'd think-- there are a lot of edge cases to consider. Think about what happens to the 0.5 px inset when the triangle is only 0.9 px wide.

Of course, you could use a general bordering algorithm which is basically independent of border and inset width (but you set it to 1px anyway), and can deal with degenerate cases, where the border has to be changed as int the above case. All I can say is Voronoi spaces. I am fairly certain it would not be hard even to come up with such an algorithm and less so to implement it.

DoG Wrote:I would personally draw a point by drawing a polygon disk with the mentioned 1px border around the disk. In fact, I would draw lines the same way, by making them polygons, not by using textures.

That works, just using a 1 px texture everywhere. But my original intention is to use these antialiased shapes in a paint program. So I decided to turn the workaround for lack of antialiasing into another feature... using variable sized textures allows fuzzy shapes with spherical falloff:

arekkusu Wrote:After spending a day testing 12 different video cards, I can tell you that you're wrong on both counts. The FSAA on the 9800 pro looks identical to the 9600 (x2 = 1 shade, x4 = 3 shades, x6 = 5 shades...)

It still eats fillrate too. Here's some meaningless numbers applicable only to my limited test app (thousands of points/lines/triangles drawn per second):

You neglect to mention SmoothVision 2.1 which the 9800 has and the 9600 has not. SV2.1 makes a helluvalot of performance difference, and if you didn't test with it your results are skewed. Go figure out how to turn it on before making broad statements about 9800 and 9600 Radeons.