Computer Graphics Primer


If you've used a product such as Photoshop, you probably already know the terms and general methods of computer graphics and can skim forward, but these terms are so fundamental to progressing with computer graphics that I've supplied a recap of them in the following sections.

Vectors and Pixels

You approach computer graphics in two primary ways: vectors and pixels. Vectors are a connect-the-dots approach; a fixed point on a picture has a connecting line to the next point. After several lines are made, you can close the line and fill in the resulting shape with color. This approach is sometimes called line art. Because the endpoints and lines are at absolute points in space, you can create line art at any scale without loss of quality. This approach is excellent for hard-edged graphics, such as signs and logos, and programs such as Corel Draw and Illustrator use this method. Vector files are only a collection of connect-the-points directions and are usually quite compact.

The pixel (for picture element) approach uses an array of rectangular dots called pixels to make up a bitmap image. The dots can be any of a multitude of colors, and viewed together from a distance, the array of pixels can produce any sort of image or photograph. The more pixels, the more detailed the resulting image, if the image's absolute printed or projected size stays the same. The image's absolute pixel array size is called its resolution, and densely pixeled images are described as high-resolution or sometimes "high-res" (for example, 35mm motion picture film is usually at 2,048 pixels across by 1,536 pixels high). Bitmaps are not scalable like vector art. If you enlarge a bitmap enough, or zoom in far enough, it pixelates; in other words, you can see the squares of solid color that make up the image. Bitmaps are ideal for photographic imagery, and programs such as Adobe Photoshop and Corel Photo Paint are popular software for creating and editing bitmaps. For the most part, vector art is not used in 3D applications, but most vector art programs allow you to rasterize the image turn it into a bitmap at some chosen resolution.

Maya 5's new Vector Renderer allows Maya to create vector art renderings. In essence, similar shades are traced and filled with a solid color, yielding a "paint by number" posterized appearance. This type of graphic is popular for web-based animation, in which bandwidth is at a premium. A Macromedia Flash encoded vector movie is much smaller than a digital movie in MPG or AVI format. Some people also like the cartoonish look of a vector rendering.

The files for bitmaps are usually much larger than vector files. For example, a typical small 640x480 pixel color image contains 307,200 pixels, and each pixel has a data byte for each of its red, green, and blue colors. The raw file size is, therefore, 921,600 bytes! This size issue was a real problem in early computer graphics, but data compression techniques (described in "Image File Formats," later in this chapter) and the ever-larger-capacity computer have solved that problem.

Both types of graphics files come into play in Maya. You might need to create a logo from line art, create text from a font, or import a 2D floor plan from a drafting program like AutoCAD. All have vector files as sources, which is a good thing; you can easily take these 2D shapes and use them as modeling curves for extrusion or other surface generation to make your scene's 3D models. You'll use bitmaps far more often than vector art, mostly to apply to surfaces in a manner similar to decals or wallpaper. Also, Maya's actual output (its renderings) is nearly always a bitmap, a 2D snapshot Maya "shoots" in its 3D world.

2D and 3D

It's possible to confuse 2D and 3D computer graphics because artists often strive for a 3D "look" but use 2D tools exclusively, as with airbrush art and Photoshop simulations of 3D. The term "3D" refers to a fully three-dimensional virtual space in which objects, lights, and cameras can be placed anywhere. You'll see the three dimensions referred to as x, y, and z, taken from the field of geometry. Helpers appear in Maya to indicate these axes, as shown in Figure 1.12. Which direction is represented by which letter? It usually depends on the user's discipline. For animators, the 2D screen had an x-axis going from left to right and a y-axis for up and down. The screen faces the animator, so y was always the up and down vector. When 3D arrived, the z-axis added the factor of depth into or out of the screen.

Figure 1.12. Maya's axes are displayed in the corner of any 3D view, and selected objects can display their own axes.

graphics/01fig12.gif

CAD users saw it differently, however. They were always looking down on their floor plans from above the plan view so x and y were indicators of north/south and east/west. The z axis for these users indicated height. Maya allows the user to switch the up axis between y and z, and you'll find this feature necessary to change to the z-axis when you work on CAD-related scenes. Other 3D programs mix these axes up, too (again, usually based on the program's pedigree drafting versus art), so you might need to change the y/z up setting when importing from other packages.

Input and Output

Much of the time, you work in Maya from a completely blank scene and build up your world from this black empty void. When the scene is finished, a still image or a series of stills is rendered that is, the computer calculates a 2D bitmap of the scene from the camera view, taking into account all lights, objects, and material properties assigned to objects. A series of stills creates animation by playing them back quickly in sequence. Movies can be viewed from sequences by using the computer to play them back or by output to videotape or movie film.

Maya offers four modes for rendering: Maya Hardware, Maya Software, Maya Vector, and Mental Ray. Maya Software rendering and Mental Ray rendering are the usual modes for photo-realistic production output. Maya also offers a hardware rendering mode that's just like the shaded interactive view you work with in Maya's panels. Maya's hardware renderer can be useful for fast rendering of particle systems, cartoon-style renderings, wireframe renderings, previews, and other simple or non-photoreal needs. The hardware renderer primarily uses your system's 3D video card for most of the calculations, so the power and quality of your 3D acceleration will have a big impact on the speed and quality of your hardware renderings. Also, you must take care not to obscure the render window on your computer while hardware rendering, or your video card will stop creating renderings of your scene! Note that the hardware renderer and Playblast both take screen grabs from the active window and might record what passes over them by mistake.

Don't confuse the fast shaded views of Maya's hardware-rendered 3D panels with software rendering. Although a reasonably high-quality image can be produced in real time from a modern 3D accelerated video card (like those Maya requires), the image quality is usually clearly inferior to the slower software render (see Figure 1.13). Beyond the basic hardware rendering slowdowns of shadows, smooth shading and lighting, bump maps, and antialiasing, there are more complex and slower effects that animators demand. Effects such as soft shadows, volumetric lights, blurry reflections, depth of field, caustics, global illumination, and other effects are render killers. Software renderers can handle these and even more complex effects, but of course they require several minutes to calculate the image. Already a considerable difference can be seen with newer video cards. Some cards now boast real-time render quality in certain circumstances. So although it's inevitable that level of quality will be met, it might take a little more time to compare with the software renderer for a typical scene, because it's advancing as well.

Figure 1.13. The interactive shaded view at the bottom looks nice, but it's no match for the quality of actual final renderings.

graphics/01fig13.gif

Often, you need to bring data particularly images into or out of Maya. Every time you apply an image to a surface as part of a material, you need to load the image, and every time you render an image you plan to keep, you need to save it as a file. Also, you can create scenes from real-world objects (known as scanning) or create real physical objects from 3D modeled objects in Maya.

3D Scanners and Printers

Hardware is available for capturing 3D data from the real world to build 3D models based on a physical example. A laser scanner is the fastest and most expensive method, ranging from a few thousand to a few hundred thousand dollars. An array of data called a point cloud is collected from the laser's scan of a region. Multiple scans must be stitched together to create an object's outer surface. The usual result is a huge mesh data file that requires a lot of editing to make it usable in a 3D program. A stylus device uses a pointer to take data from an object. These devices are usually cheaper than laser scanners, but thousands of points must be carefully captured before an object of any real detail emerges. Another option some vendors offer is direct photograph to 3D model translation, based on setting correspondence points between several perspective photos of a real-world object. The resulting 3D models are nearly always crude approximations of a manually modeled object, but could be useful for a minor role in a 3D project.

An even more amazing technology can generate a solid physical object from any object made in a 3D program, a technique sometimes called stereo lithography. The leader of these technologies, laser sintering, involves using a laser to harden specified areas of a photosensitive viscous amber fluid. A small platform in the fluid slowly submerges after each laser pass, pulling the partially completed object down so that the laser can create a new layer on the top. The result is an amber plastic solid model of your object!

Image File Formats

The usual output of your efforts in Maya is in the form of 2D bitmaps. Many different file formats are offered in Maya, and you need to know the basics of how they store data. Some formats discard parts of the image, so you might be disappointed when you see the saved version of the image that seemed so perfect in its raw state from the Maya renderer. These file formats are available in Maya:

  • One bit Pixels are either on or off, either black or white. These images look like a fax.

  • Grayscale No color information; only the value component of the color is used (as in HSV color). Grayscale depth is important, too; typically, 256 shades of gray are possible.

  • Paletted A limited number of colors are used to create the image. Think "paint by number." Sometimes, the colors are dithered (randomly scattered in a controlled way) to achieve a better approximation of the image.

  • Truecolor An 8-bit byte that allows 256 shades is allocated for each of a pixel's RGB components. This format allows 16 million colors and is a good-quality mode to reproduce nearly any image. The three 8-bit bytes for red, green, and blue are 24 bits combined, so this format is sometimes called 24-bit color.

Images can be compressed in several ways, but you need to be aware of whether the compression is lossy, which means some image degradation is allowed to achieve a smaller file size. Non-lossy compression schemes can reduce file size by minimizing redundant data, but files are always retained at the original quality.

Maya images that are added to other images later might have an alpha channel, an optional attribute for each pixel that defines the transparency. The file formats TIF and TGA save in 24-bit for just the color channels. When an alpha channel is needed, you must save the 32-bit (TIF or TGA), and the extra 8 bits contain the alpha channel. For example, if you want to render a character in Maya and then have him cavort around in the real-world video footage, it would be a pain to cut the character out from each frame by hand. The alpha channel lets you instantly cut the mask for the character. Make sure you save the image sequence using an image file format that supports an alpha channel, or it will be lost when you render the character.

The following lists review the image file formats offered by Maya's software and hardware renderers. (Mental Ray and Maya Vector are discussed in Chapter 13.) These are the popular truecolor output formats, used for most production work:

  • Targa A truecolor format, usually the rendered output format of choice. This format has few variations and is almost guaranteed to work with anything that reads Targa (TGA) files. Optionally includes an alpha channel.

  • TIFF A truecolor noncompressed format. Maya saves TIFF only in truecolor and high-color format, but the TIFF image file can be almost any type of file format paletted, one-bit, and so on. Usually the compression schemes are non-lossy, but newer TIFF formats sometimes use a JPG-like lossy compression mode. If you get a TIFF file from a source other than Maya, it might be in a mode Maya can't read. Typically, you convert it to a compatible format with Photoshop or another bitmap editor. Optionally includes an alpha channel.

  • TIFF16 A high-color format of TIFF. Optionally includes an alpha channel.

  • Windows BMP A truecolor noncompressed format. BMP is like TIFF, with many variants allowed. Does not offer support for an alpha channel.

In addition, this special format is used for compositing:

  • RLA This truecolor format supported by many compositors can embed extra information, such as depth, and is sometimes used when the image from Maya needs special editing, such as blurring objects in the background. Optionally includes an alpha channel.

These lossy compressed formats are for evaluation or web use:

  • GIF A paletted (usually 256 colors) image used for the web. GIFs can be made to animate crudely, but Maya doesn't support this kind of GIF. It supports only still image output to GIF.

  • JPEG A truecolor format with a lossy compression scheme. Does not support an alpha channel.

  • AVI A movie format that's usually truecolor but has a lossy compression scheme. Don't use movie file formats when you are rendering and saving only one frame. Other popular movie formats are MPG and QuickTime MOV. They are not supported by Maya, so you need other software to import or export these formats.

These are the legacy or rarely used truecolor formats:

  • Alias PIX

  • Cineon

  • EPS

  • Maya IFF

  • Maya 16 IFF

  • Quantel YUV

  • SGI

  • SGI16

  • Softimage pic

Using a movie file format, such as AVI, for final output to video is usually a bad idea because these formats often have lossy compression schemes. For output of animations to video or film, the usual route is sequential TIFF or TGA. Thousands of individual numbered files are rendered and saved on the hard disk. Later, these images are loaded by specialized hardware that can output to video at full speed or burn the images to movie film.



Maya 5 Fundamentals
Maya 4.5 Fundamentals
ISBN: 0735713278
EAN: 2147483647
Year: 2006
Pages: 198

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net