Previous | Next --- Slide 49 of 64
Back to Lecture Thumbnails
L100magikarp

Despite it's simplicity, the diamond rule actually seems to work pretty well! I tried to break it by drawing various diagonal and vertical lines, but I found the rasterizations to be consistently reasonable. The only "failures" seem to be thick lines produced by going through the vertices. For example, a horizontal line between two rows would produce a line that is twice as thick.

rbunny

Is the intensity based on how much the line covers the diamond or is it based on the entire pixel itself

jifengy

I wonder what was the thought process behind deciding on a diamond being the shape to use for this rule. I'm sure there are other polygons (or irregular shapes even) that would also work, and may even result in a "better" depiction so to say, so I'm interested in what were all the factors taken into consideration before deciding on the diamond.

graphicstar11

I did not know that some graphics are rendered with the diamond rule, and it makes a lot of sense because it makes the graphic much more accurately and precisely presented. I was wondering why a diamond and not other shapes like a circle?

bepis

This is surprisingly simple but seems to work really well in most cases. The worst case seems to be with horizontal and vertical lines running through the edge of the cell, where it might become a doubly thick line, or perhaps if it were a dotted line entirely in the white space that does not touch the diamonds.

bcagan

There was an interesting video I saw a few days ago about how the PlayStation 1 handled rendering (which I have never really been a fan of so it was nice to find out why).

https://www.youtube.com/watch?v=x8TO-nrUtSI

At 8:27 they bring up that as the PS1 had no floating point support, it could only calculate integer pixel results. Looking at this slide it seems like a method like this would have been impossible on the PS1, as it would have required knowing the fractional location of the line inside a given pixel. Versus later PC graphics cards and systems like (well, starting with) the N64 which had floating point support.

Heisenberg

@jifengy I think for any line with a slope between 0 and 1, the diamond rule can make sure that only one pixel needs to be rasterized with a given X.

penguin

Would it be a better idea to instead have a "fade" effect where the squares closest to the lines have the most intensity of color and those farther away from the line (to a degree) have less color? Perhaps this can give the smooth effect for lines and even curves.

0x484884

How would the fade effect work exactly? Would we give the line a thickness equal to an edge of a pixel and then set the pixel brightness to the portion of the pixel covered by the line?

bpopeck

I am also interested in why the diamond shape was chosen for this rule. Some potential reasons I can think of:

  • The diamond has half the area of the pixel, so in some sense it is the "middle half" of the pixel. If you used a circle inscribed inside of the pixel instead, it would have area $\frac{\pi}{4}$ which is much more than half.

  • The diamond is symmetric, so the chance of the line intersecting the diamond is independent of which side of the pixel the line enters from.

  • The intersection test between a line and the diamond needs to be fast/cheap to implement in GPU hardware. I guess the more edges you add to your shape the more complicated the intersection test would become, but I am not totally sure.