Note:In this article I will distinguish between pixels on the screen, and the Wupixels we are trying to render. I shall use the term 'Pixels' to refer to pixels on the screen. 'Particles' will refer to the Wupixels we are trying to render using 'pixels'.
On the left we have the particles in the positions we would like to render them. On the right
are the antialiased versions.
Properties
The Wupixels have the following properties:
Method
Unit Squares
Pseudocode to render a Wupixel at (wx, wy) with brightness wb
Variables:
INTEGER: x, y ' Integer coordinates of Wupixel
FLOAT: fx, fy ' The fraction part of the coordinates
INTEGER: btl, btr, bbl, bbr ' Brightness of the 4 pixels covered by particle
' (top left, top right, bottom left, bottom right)
x = int(wx) ' Calculate the coordinates of the top left pixel
y = int(wy) '
fx = wx - x ' Calculate the
fy = wy - y '
btl = (1-fx) * (1-fy) * wb ' Calculate the brightness of each of the 4 pixels
btr = (fx) * (1-fy) * wb ' and multiply bu the brightness
bbl = (1-fx) * (fy) * wb '
bbr = (fx) * (fy) * wb '
plot pixel with brightness btl at (x, y) ' Plot those pixels
plot pixel with brightness btr at (x+1, y) '
plot pixel with brightness bbl at (x, y+1) '
plot pixel with brightness bbr at (x+1, y+1) '
Other Shapes and Sizes