Belphegor
Belphegor

Reputation: 1843

Anti-aliasing - Unweighted Area Sampling

I am currently trying to incorporate anti-aliasing into my line drawing algorithms (DDA and Bresenham), I have been instructed by the professor that any anti-aliasing technique is allowed so I did some research and it seems that Unweighted Area Sampling is a good route to go.

I read through the basics of how it works and I'd say I have about 70-80% of it understood, but I don't understand the fundamental concept of deciding how "far" one should look for potential pixels to anti-alias or just shade to give that anti-alias effect.

With Unweighted Area Sampling, we "imagine" a 1 pixel width rectangle surrounding the line that we wish to draw and any pixels that fall within that imaginary rectangle will be shaded with a color proportional to the area it covers.

So my specific questions then are:

  1. If I am currently on pixel (x1, y1) and I decide that I want to light up the pixel at (x1+1, y) how do I "discover" the pixels around that new pixel that should be anti-aliased?

  2. Following up on question 1, how do I know if a pixel is inside or outside the range of the rectangle we have imagined?

[EDIT]

I've read somewhere hinted by a user that you can incorporate the midpoint algorithm used in Bresenham's to do this Unweighted Sampling, but I wasn't able to catch on how.

Upvotes: 6

Views: 995

Answers (0)

Related Questions