Classic Computer Magazine Archive COMPUTE! ISSUE 38 / JULY 1983 / PAGE 221

Atari Artifacting

Judson Pewther

These tools for exploring artifacting can create some of the most beautiful graphics you've ever seen from your Atari.

Even if you are not already familiar with the phrase television artifacts, you have probably noticed that the colors of points and lines drawn in Atari's graphics mode 8 are not always what they are supposed to be. (False colors may also appear in graphics mode 0.) These comments apply unless you are using a high resolution color monitor with digital input.

Although the BASIC Reference Manual claims that only "one color and two different luminances" are available in GRAPHICS 8, in actual fact six distinguishable color/luminance combinations are possible because of TV artifacting.

While the BASIC Reference Manual does not mention this very interesting fact, it is fully documented in De Re Atari, Appendix IV, which gives the definition: "The term TV artifacts refers to a spot or 'pixel' on the screen that displays a different color than the one assigned to it." And as further explained, TV artifacts are caused by the way in which color and luminance information is modulated onto an NTSC television signal.

Let's summarize the effects of artifacting in GRAPHICS 8:

  1. The effect is maximized by plotting a light color (high luminance) on a dark background, or dense dark patterns on a light background.
  2. The color of a pixel is not affected by its Y-coordinate.
  3. The color displayed by a pixel depends not only on its assigned color, but also on whether its X-coordinate is even or odd, and on the color assigned to its horizontal neighbors.
  4. Horizontal resolution has a practical limit of 160 rather than 320. Thus, two horizontally contiguous pixels tend to form a single pixel of uniform color.

What colors are actually produced? This can depend on the particular TV monitor being used, and on the exact setting of its controls. The setting of the tint control will make the biggest difference.

The major effects of plotting white (the assigned color) pixels on a black background are summarized in the following table. N is the number of horizontally contiguous white pixels. X is the X-coordinate(s) of these pixels in terms of "even" and "odd." COLOR is the approximate actual color displayed by these pixels, assuming normal settings on the TV monitor.

N X Color
1 even green
1 odd blue
2 even-odd orange
2 odd-even light blue
3 nearly white
4 white

The Table Illustrated

The short program below illustrates artifacts by drawing two series of nearly vertical white lines on a black background. Colored horizontal bands are produced in accordance with the rules in the previous table. No actual white is produced in this example, because there are at most only pairs of horizontally contiguous "white" pixels. Notice in particular that the solid-color bands are created either because all the "even" pixels give a solid green, or all the "odd" pixels give a solid blue.

Lines 199 to 250 can be added to allow the user to easily step the assigned hue through all 16 possibilities, while preserving the 0 luminance setting for the background and the 14 luminance setting for the plotted lines. The background color may be nearly invisible because it is at 0 luminance, but the colors in the horizontal bands will change greatly. Remember that in GRAPHICS 8 the hue associated with the COLOR 1 statement and with the lines that were drawn is the background hue as determined in the SETCOLOR 2, hue, 0 statement. Even when we are not seeing the assigned hue because of TV artifacting, changing the assigned hue changes the displayed hues.

Best results are obtained by adjusting TV brightness and contrast to a low or minimum value. TV color may be boosted somewhat, but too much boost blurs the picture. However, the tint control may be adjusted freely from one extreme to the other to vary the colors. These comments apply generally to any program where TV artifacts are used.

Program 1: TV Artifacts

10 GRAPHICS 8:COLOR 1
20 SETCOLOR 1,0,14:SETCOLOR 2,0,0
30 FOR X=0 TO 318 STEP 4
40 PLOT X,0:DRAWTO X+1,159:NEXT X
50 FOR X=0 TO 308 STEP 4
60 PLOT X,0:DRAWTO X+9,159:NEXT X
199 REM *** CHANGE HUE ***
200 H=0:OPEN #1,4,0,"K:"
210 ? :? "ASSIGNED HUE IS NOW";H
220 ? "HIT H KEY TO CHANGE HUE"
230 GET #1,X:IF X<>72 THEN 230
240 H=H+1:IF H=16 THEN H=0
250 SETCOLOR 2,H,0:GOTO 210

TV artifacts are really a failure of resolution, but a very interesting failure. And the colors produced can add dazzle to graphics art programs. Although these false colors may at times be annoying, and although the failure in horizontal resolution is certainly an annoyance, TV artifacts compensate considerably for the fact that only two intensities of a single color are officially available in GRAPHICS 8.

Moiré Patterns

Program 2 is a graphics art program which relies on artifacts for its beauty. It also makes use of a technique for creating enhanced moiré patterns.

You are probably already familiar with the simple type of moiré pattern produced by a program like the following:

Program 2: Simple Moiré

10 GRAPHICS 24
20 SETCOLOR 1,0,14:SETCOLOR 2,0,0
30 FOR X=0 TO 318 STEP 3
40 COLOR 1:PLOT 159,0:DRAWTO X,191
60 NEXT X
70 GOTO 70

To see a somewhat different moiré pattern with a more uniform distribution of light and enhanced contrasts in the details, add the following line and run the program again:

50 COLOR 0:PLOT 159,0:DRAWTO X +1,191

This program step draws a black line which cancels out half (or more) of the "white" pixels which were plotted in the previous step, line 40. This basic idea is varied and elaborated in Program 3: Pyramid.

Program 3 is designed so that slow typists (like myself) will not have to type in the whole thing just to see what it does. The first half of the program (lines 100 through 470) is almost entirely for the purpose of letting the user control the parameters of the pattern in order to see better how the various effects are achieved. To eliminate some typing, replace the first half of the program with the single line: 100 GRAPHICS 24. Then begin typing at line 500.

The program is essentially self-explanatory, but it might be worthwhile to point out a few things. Lines 500 to 540 select a set of random parameters for the pattern that is about to be drawn. WHITE and BLACK are associated with the subroutine for drawing a set of vertical lines at line 1000 in the program. They are dual purpose variables: if equal to 0 or 1, then a set of "even" or "odd" lines will be drawn, but if greater than 1 the subroutine will not be called. So, the probability is .25 that WHITE will call the subroutine, since it is a random integer ranging from 0 to 7. The same applies to BLACK.

WHITE lays down a colored background for the pattern, but has a slightly different effect if the old pattern has not been wiped out by line 730. BLACK erases all colors in the pattern except for black and another color, just before the program recycles to select a new set of random parameters.

Line 535 works in conjunction with line 740 to insure that the new values of MODE, APEX, and SPACE are not exactly the same as the old values.

Line 550 prevents the attract mode from setting in as long as the program continues to recycle through new variations.

Except for the user option to hold a pattern indefinitely (lines 450 and 720), there are no forced time delays. It takes about a minute for the program to make one cycle, which should be more than enough time to observe a variation of the pattern. If you wish to freeze a particular pattern, program execution may be stopped and restarted by hitting CTRL 1.

Finally, although the program isn't especially fast, I think you will find that many of its variations are as spectacular as anything you have yet seen on your Atari.