Search code examples
c++calgorithmantialiasing

Antialiasing algorithm?


I have textures that i'm creating and would like to antialias them. I have access to each pixel's color, given this how could I antialias the entire texture?

Thanks


Solution

  • The basic method for anti-aliasing is: for a pixel P, sample the pixels around it. P's new color is the average of its original color with those of the samples.

    You might sample more or less pixels, change the size of the area around the pixel to sample, or randomly choose which pixels to sample.

    As others have said, though: anti-aliasing isn't really something that's done to an image that's already a bitmap of pixels. It's a technique that's implemented in the 2D/3D rendering engine.