views:

149

answers:

3

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

+4  A: 

"Anti-aliasing" can refer to a broad range of different techniques. None of those would typically be something that you would do in advance to a texture.

Maybe you mean mip-mapping? http://en.wikipedia.org/wiki/Mipmap

Alan
No, i'm not looking for this, i'm looking to make jagged edges look smooth
Milo
If the artifacts are already in your texture, then try downsizing them to a smaller size. Or load them into photoshop and try to use the blur tools to improve the look. There's no magic algorithm to remove aliasing errors after they've been rendered.
Alan
jagged edges are the result of a "rasterization". Proper antialiasing is done in "the middle" rather than after. If you do it after on the already generated jagged pixel, you likely obtain blurring rather than correct antialiasing.
ShinTakezou
A: 

It's not very meaningful to ask about antialiasing in terms this vague. It all depends on the nature of the textures and how they will be used.

Generally though, if you don't have control over the display environment and your textures might be scaled, rotated, or composited with other elements you don't have any control over, you should use transparency to indicate where your image ends and where it only partially fills a pixel.

It's also generally good to avoid sharp edges and features that are small relative to the amount of scaling that might be done.

ddyer
+2  A: 

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.

Grant