In Part 1 of this series, I provided some simple examples of Anti-Aliasing (AA) with LEGO. Today I will look at how the proper shade for each brick can be determined, for both standard and AA mosaics. I will use the letter ‘A’ mosaic to demonstrate these processes.
In the image above, the red outline is the shape of the letter ‘A’ to be built as a LEGO mosaic. The first step is to superimpose the outline over a grid of the desired size. The smaller the pitch on the grid, the more accurately the ‘A’ can be represented, but the more bricks and effort it will take to complete the project. For this example the ‘A’ will be positioned inside a 9 high by 11 wide grid.
To build a mosaic that is black and white only the rule is that if 50% or more of the grid cell is covered, then that brick is black. Otherwise, it is white. Following this process will result in a mosaic matching the one below.
To build a mosaic that is black and white, plus anti-aliased with one additional color the rules are as follows: If less than 33% of the grid cell is covered, then that brick is white. If between 33% and 67% of the grid cell is covered, then that brick is grey. If more than %67 of the grid cell is covered, then that brick is black. Following this process will result in a mosaic matching the one below.
This same process works with other background and foreground colors, as long as bricks roughly halfway between the two colors are utilized. For Part 1 of this series I built examples of blue on white adding light blue and green on white adding light green. Obviously a limitation is the colors LEGO bricks are produced. Plus, odd colored bricks are more expensive, so this will probably factor in also, especially for larger projects.
Some other ways to extend or fine-tune AA include:
- Use even more colors. For example, if two in-between colors are used, then the rules could be adjusted to create four ranges (< 25%, between 25% and 50%, between 50% and 75%, > %75).
- Adjust ranges for shades that are not exactly in-between. For example, if the grey color above was darker than half-way between white and black the percentage of coverage range for grey could be shifted upward to compensate. Possibly (< 50%, between 50% and %80, > %80)
- Compensate for several nearby bricks that are just over or under the range thresholds by using some bricks from the other side of the threshold. This will prevent an area from getting too light or dark.
- Use trial-and-error to evaluate the use of AA. If the range rules call for many brick changes or additions, make the changes incrementally and compare the results. I recommend doing this type of evaluation on a computer using a graphics program since it is faster than building multiple variations from actual bricks.
These are just a few ideas. There are books and websites that detail algorithms used for AA in computer graphics.
For this article series I used a shareware program Paint.net as an aid for generating plans for all of the small mosaics. I also used it to create the image at the top of this article. Paint.net includes AA, which simpler tools like MS Paint do not. I usually keep the displayed zoomed to either 800% or 1200% with the pixel grid turned ON.
Shown above is a screenshot of Paint.net that illustrates AA (with many more shades of grey than are available in LEGO bricks.) Since I only used one in-between color for my mosaics I had to visually map the full grey-scale spectrum to my three colors. I also did some adjustments for symmetry and some general trial-and-error to achieve results I was happy with.
Sometime in the future I plan to create a large mosaic (between 100 & 200 bricks square) using AA, which of course, I will share here.