by Chris Woodford. Last updated: September 20, 2017.
If Rembrandt were alive today, would he still paint with oil on canvas... or sit calmly at a desk, hand on mouse, and draw dazzling graphics on a computer screen? Most of us would happily admit to having less talent in both hands than a great painter like this had in a millimeter of his pinkie, but computers can turn us into reasonably competent, everyday artists all the same. Whether you're an architect or a web designer, a fashion student or a scientist, computer graphics can make your work quicker, easier, and much more effective. How? Let's take a closer look!
Photo: Computer graphics, early 1980s style! Arcade games like Space Invaders were how most 30- and 40-something computer geeks first experienced computer graphics. At that time, even good computer screens could display only about 64,000 pixels—hence the relatively crudely drawn, pixelated graphics.
What is computer graphics?
Photo: Oil paints like these can produce magical results in the right hands—but only in the right hands. Thankfully, those of us without the talent and skill to use them can still produce decent everyday art with computer graphics.
Computer graphics means drawing pictures on a computer screen. What's so good about that? Sketch something on paper—a man or a house—and what you have is a piece of analog information: the thing you draw is a likeness or analogy of something in the real world. Depending on the materials you use, changing what you draw can be easy or hard: you can erase pencil or charcoal marks easily enough, and you can scrape off oil paints and redo them with no trouble; but altering watercolors or permanent markers is an awful lot more tricky. That's the wonder of art, of course—it captures the fresh dash of creativity—and that's exactly what we love about it. But where everyday graphics is concerned, the immediacy of art is also a huge drawback. As every sketching child knows too well, if you draw the first part of your picture too big, you'll struggle to squeeze everything else on the page.... and what if you change your mind about where to put something or you want to swap red for orange or green for blue? Ever had one of those days where you rip up sheet after sheet of spoiled paper and toss it in the trash?
That's why many artists, designers, and architects have fallen in love with computer graphics. Draw a picture on a computer screen and what you have is a piece of digital information. It probably looks similar to what you'd have drawn on paper—the ghostly idea that was hovering in your mind's eye to begin with—but inside the computer your picture is stored as a series of numbers. Change the numbers and you can change the picture, in the blink of an eye or even quicker. It's easy to shift your picture around the screen, scale it up or down, rotate it, swap the colors, and transform it in all kinds of other ways. Once it's finished, you can save it, incorporate it into a text document, print it out, upload it to a web page, or email it to a client or work colleague—all because it's digital information. (Find out more about the benefits of digital in our main article about analog and digital.)
Raster and vector graphics
All computer art is digital, but there are two very different ways of drawing digital images on a computer screen, known as raster and vector graphics. Simple computer graphic programs like Microsoft Paint and PaintShop Pro are based on raster graphics, while more sophisticated programs such as CorelDRAW, AutoCAD, and Adobe Illustrator use vector graphics. So what exactly is the difference?
Stare hard at your computer screen and you'll notice the pictures and words are made up of tiny colored dots or squares called pixels. Most of the simple computer graphic images we come across are pixelated in this way, just like walls are built out of bricks. The first computer screens, developed in the mid-20th century, worked much like televisions, which used to build up their moving pictures by "scanning" beams of electrons (tiny charged particles inside atoms, also called cathode rays) back and forth from top to bottom and left to right—like a kind of instant electronic paintbrush. This way of making a picture is called raster scanning and that's why building up a picture on a computer screen out of pixels is called raster graphics.
Photo: Raster graphics: This is a closeup of the paintbrushes in the photo of the artist's paint palette up above. At this magnification, you can clearly see the individual colored pixels (squares) from which the image is built, like bricks in a wall.
You've probably heard of binary, the way that computers represent decimal numbers (1,2,3,4 and so on) using just the two digits zero and one (so the decimal number 5678 becomes 1011000101110 in binary computer speak). Suppose you're a computer and you want to remember a picture someone is drawing on your screen. If it's in black and white, you could use a zero to store a white area of the picture and a one to store a black area (or vice versa if you prefer). Copying down each pixel in turn, you could transform a picture filling an entire screen of, say, 800 pixels across by 600 pixels down into a list of 480,000 (800 x 600) binary zeros and ones. This way of turning a picture into a computer file made up of binary digits (which are called bits for short) is called a bitmap, because there's a direct correspondence—a one-to-one "mapping"—between every pixel in the picture and every bit in the file. In practice, most bitmaps are of colored pictures. If we use a single bit to represent each pixel, we can only tell whether the pixel is on or off (white or black); if we use (say) eight bits to represent each pixel, we could remember eight different colors, but we'd need eight times more memory (storage space inside the computer) to store a picture the same size. The more colors we want to represent, the more bits we need.
Raster graphics are simple to use and it's easy to see how programs that use them do their stuff. If you draw a pixel picture on your computer screen and you click a button in your graphics package to "mirror" the image (flip it from left to right or right to left), all the computer does is reverse the order of the pixels by reversing the sequence of zeros and ones that represent them. If you scale an image so it's twice the size, the computer copies each pixel twice over (so the numbers 10110 become 1100111100) but the image becomes noticeably more grainy and pixelated in the process. That's one of the main drawbacks of using raster graphics: they don't scale up to different sizes very well. Another drawback is the amount of memory they require. A really detailed photo might need 16 million colors, which involves storing 24 bits per pixel and 24 times as much memory as a basic black-and-white image. (Do the sums and you'll find that a picture completely filling a 1024 x 768 computer monitor and using 24 bits per pixel needs roughly 2.5 megabytes of memory.)
Photo: How a raster graphics program mirrors an image. Top: The pixels in the original image are represented by zeros and ones, with black pixels represented here by 1 and white ones represented by zero. That means the top image can be stored in the computer's memory as the binary number 100111. That's an example of a very small bitmap. Bottom: Now if you ask the computer to mirror the image, it simply reverses the order of the bits in the bitmap, left to right, giving the binary number 111001, which automatically reverses the original pattern of pixels. Other transformations of the picture, such as rotation and scaling, involve swapping the bits in more complex ways.
The maximum number of pixels in an image (or on a computer screen) is known as its resolution. The first computer I ever used properly, a Commodore PET, had an ultra-low resolution display with 80 characters across by 25 lines down (so a maximum of 2000 letters, numbers, or punctuation marks could be on the screen at any one time); since each character was built from an 8 × 8 square of pixels, that meant the screen had a resolution of 640 × 200 = 128,000 pixels (or 0.128 Megapixels, where a Megapixel is one million pixels). The laptop I'm using right now is set to a resolution of 1280 × 800 =1.024 Megapixels, which is roughly 7–8 times more detailed. A digital camera with 7 Megapixel resolution would be roughly seven times more detailed than the resolution of my laptop screen or about 50 times more detailed than that original Commodore PET screen.
Displaying smoothly drawn curves on a pixelated display can produce horribly jagged edges ("jaggies"). One solution to this is to blur the pixels on a curve to give the appearance of a smoother line. This technique, known as anti-aliasing, is widely used to smooth the fonts on pixelated computer screens.
Photo: How anti-aliasing works: Pixelated images, like the word "pixelated" shown here, are made up of individual squares or dots, which are really easy for raster graphics displays (such as LCD computer screens) to draw. I copied this image directly from the italic word "pixelated" in the text up above. If you've not altered your screen colors, the original tiny text probably looks black and very smooth to your eyes. But in this magnified image, you'll see the letters are actually very jagged and made up of many colors. If you move back from your screen, or squint at the magnified word, you'll see the pixels and colors disappear back into a smooth black-and-white image. This is an example of anti-aliasing, a technique used to make pixelated words and other shapes smoother and easier for our eyes to process.
There's an alternative method of computer graphics that gets around the problems of raster graphics. Instead of building up a picture out of pixels, you draw it a bit like a child would by using simple straight and curved lines called vectors or basic shapes (circles, curves, triangles, and so on) known as primitives. With raster graphics, you make a drawing of a house by building it from hundreds, thousands, or millions of individual pixels; importantly, each pixel has no connection to any other pixel except in your brain. With vector graphics, you might draw a rectangle for the basic house, smaller rectangles for the windows and door, a cylinder for the smokestack, and a polygon for the roof. Staring at the screen, a vector-graphic house still seems to be drawn out of pixels, but now the pixels are precisely related to one another—they're points along the various lines or other shapes you've drawn. Drawing with straight lines and curves instead of individual dots means you can produce an image more quickly and store it with less information: you could describe a vector-drawn house as "two red triangles and a red rectangle (the roof) sitting on a brown rectangle (the main building)," but you couldn't summarize a pixelated image so simply. It's also much easier to scale a vector-graphic image up and down by applying mathematical formulas called algorithms that transform the vectors from which your image is drawn. That's how computer programs can scale fonts to different sizes without making them look all pixelated and grainy.
Photo: Vector graphics: Drawing with Bézier curves ("paths") in the GIMP. You simply plot two points and then bend the line running between them however you want to create any curve you like.
Most modern computer graphics packages let you draw an image using a mixture of raster or vector graphics, as you wish, because sometimes one approach works better than another—and sometimes you need to mix both types of graphics in a single image. With a graphics package such as the GIMP (GNU Image Manipulation Program), you can draw curves on screen by tracing out and then filling in "paths" (technically known as Bézier curves) before converting them into pixels ("rasterizing" them) to incorporate them into something like a bitmap image.
Real life isn't like a computer game or a virtual reality simulation. The very best CGI (computer-generated imagery) animations are easy to tell apart from ones made on film or video with real actors. Why is that? When we look at objects in the world around us, they don't appear to be drawn from either pixels or vectors. In the blink of an eye, our brains gather much more information from the real-world than artists can include in even the most realistic computer-graphic images. To make a computerized image look anything like as realistic as a photograph (let alone a real-world scene), we need to include far more than simply millions of colored-in pixels.
Really sophisticated computer graphics programs use a whole series of techniques to make hand-drawn (and often completely imaginary) two-dimensional images look at least as realistic as photographs. The simplest way of achieving this is to rely on the same tricks that artists have always used—such things as perspective (how objects recede into the distance toward a "vanishing point" on the horizon) and hidden-surface elimination (where nearby things partly obscure ones that are further away).
If you want realistic 3D artwork for such things as CAD (computer-aided design) and virtual reality, you need much more sophisticated graphic techniques. Rather than drawing an object, you make a 3D computer model of it inside the computer and manipulate it on the screen in various ways. First, you build up a basic three-dimensional outline of the object called a wire-frame (because it's drawn from vectors that look like they could be little metal wires). Then the model is rigged, a process in which different bits of the object are linked together a bit like the bones in a skeleton so they move together in a realistic way. Finally, the object is rendered, which involves shading the outside parts with different textures (surface patterns), colors, degrees of opacity or transparency, and so on. Rendering is a hugely complex process that can take a powerful computer hours, days, or even weeks to complete. Sophisticated math is used to model how light falls on the surface, typically using either ray tracing (a relatively simple method of plotting how light bounces off the surface of shiny objects in straight lines) or radiosity (a more sophisticated method for modeling how everyday objects reflect and scatter light in duller, more complex ways).
Photo: NASA scientists think computer graphics will one day be so good that computer screens will replace the cockpit windows in airplanes. Instead of looking at a real view, the pilots will be shown a computerized image drawn from sensors that work at day or night in all weather conditions. For now, that remains a science fiction dream, because even well-drawn "3D" computer images like this are easy to tell from photographs of real-world scenes: they simply don't contain enough information to fool our amazingly fantastic eyes and brains. Photo courtesy of NASA Langley Research Center (NASA-LaRC).
What is computer graphics used for?
Photo: Computer graphics can save lives. Medical scan images are often complex computerized images built up from hundreds or thousands of detailed measurements of the human body or brain. Photo by courtesy of Warren Grant Magnuson Clinical Center (CC) and US National Institutes of Health (NIH).
Obvious uses of computer graphics include computer art, CGI films, architectural drawings, and graphic design—but there are many non-obvious uses as well and not all of them are "artistic." Scientific visualization is a way of producing graphic output from computer models so it's easier for people to understand. Computerized models of global warming produce vast tables of numbers as their output, which only a PhD in climate science could figure out; but if you produce a speeded-up animated visualization—with the Earth getting bluer as it gets colder and redder as it gets hotter—anyone can understand what's going on. Medical imaging is another good example of how graphics make computer data more meaningful. When doctors show you a brain or body scan, you're looking at a computer graphic representation drawn using vast amounts of data produced from thousands or perhaps even millions of measurements. The jaw-dropping photos beamed back from space by amazing devices like the Hubble Space Telescope are usually enhanced with the help of a type of computer graphics called image processing; that might sound complex, but it's not so very different from using a graphics package like Google Picasa or PhotoShop to touch up your holiday snaps).
And that's really the key point about computer graphics: they turn complex computer science into everyday art we can all grasp, instantly and intuitively. Back in the 1980s when I was programming a Commodore PET, the only way to get it to do anything was to type meaningless little words like PEEK and POKE onto a horribly unfriendly green and black screen. Virtually every modern computer now has what's called a GUI (graphical user interface), which means you operate the machine by pointing at things you want, clicking on them with your mouse or your finger, or dragging them around your "desktop." It makes so much more sense because we're visual creatures: something like a third of our cortex (higher brain) is given over to processing information that enters our heads through our eyes. That's why a picture really is worth a thousand words (sometimes many more) and why computers that help us visualize things with computer graphics have truly revolutionized the way we see the world.