Antialiased, as requested.
There are really four different kinds of antialiasing. These are:
- Supersampling: Draw a really, really big image, and then scale it down for the final display. Requires lots of extra memory to store that really big image, and lots of extra fill rate to draw all those extra pixels.
- Multisampling: Draw normally, but check several different points within each pixel, to see whether that pixel is part of more than one triangle. If so, calculate the pixel colour separately for each triangle, and average those colours together to get the final display colour for that pixel. This is basically like supersampling, but only affects the pixels at the edges of polygons. This makes multisampling much faster and much less memory-hungry than supersampling.
- Accumulation buffer: Draw the scene several times each frame, with a subpixel jitter between each draw. Uses no extra memory, but can result in a subtle blurring to the overall image, and requires lots of extra draws.
- Find edges, blur: With a simple pair of image space filters, it’s easy to find all the edges in an image, and then blur just those edges without blurring the rest of the image. This gives a similar result to multisampling, but requires several fullscreen passes over the final rendered image. This was a relatively common approach on some game consoles in the past, but is much rarer, these days.
I’ve only implemented multisampling, since it seems to be the best tradeoff in terms of GPU cost and memory usage. These days, when folks talk about antialiasing, multisampling is usually what they mean.
Anyhow, in the screen above I’m using 4x multisampling (the maximum that my poor little laptop will support), which smooths out the jagged edges nicely. But yes, it does noticeably increase the amount of time that it takes to render the scene.
On the other hand, this is an unoptimised debug build, and it’s still happily chugging along at 60fps on my little laptop.
On the other other hand, it’s drawing a mostly empty world, with very little going on within it, beyond a few subscribers who are becoming annoyed that I haven’t created any monsters for them to fight. I suspect this build won’t hold 60fps once it’s actually simulating and drawing a busier world. Though I could well be wrong about that. Only one way to find out, I guess!
I find it interesting that most of the extra cost has gone into copying the rendered game screen from its multisampling buffer into the regular buffer, so that I can perform the glowing “bloom” effect; calculating the multisampling itself isn’t nearly as expensive as I’d expected!