Tuesday, March 30, 2010

Computer Graphics

GenXTechno Tags: , , , , ,
Computer displays are made up from grids of small rectangular cells called pixels. The picture is built up from these cells. The smaller and closer the cells are together, the better the quality of the image, but the bigger the file needed to store the data. If the number of pixels is kept constant, the size of each pixel will grow and the image becomes grainy (pixellated) when magnified, as the resolution of the eye enables it to pick out individual pixels.
Vector graphics is the use of geometrical primitives such as points, lines, curves, and shapes or polygon(s), which are all based on mathematical equations, to represent images in computer graphics.
Vector graphics files store the lines, shapes and colours that make up an image as mathematical formulae. A vector graphics program uses these mathematical formulae to construct the screen image, building the best quality image possible, given the screen resolution. The mathematical formulae determine where the dots that make up the image should be placed for the best results when displaying the image. Since these formulae can produce an image scalable to any size and detail, the quality of the image is only determined by the resolution of the display, and the file size of vector data generating the image stays the same. Printing the image to paper will usually give a sharper, higher resolution output than printing it to the screen but can use exactly the same vector data file.
3D Graphics

A picture that has or appears to have height, width and depth is three-dimensional (or 3-D). A picture that has height and width but no depth is two-dimensional (or 2-D).
clip_image002
Take a look at the triangles above. Each of the triangles on the left has three lines and three angles -- all that's needed to tell the story of a triangle. We see the image on the right as a pyramid -- a 3-D structure with four triangular sides. Note that it takes five lines and six angles to tell the story of a pyramid -- nearly twice the information required to tell the story of a triangle.

What Are 3-D Graphics?

For many of us, games on a computer or advanced game system are the most common ways we see 3-D graphics. These games, or movies made with computer-generated images, have to go through three major steps to create and present a realistic 3-D scene:
  1. Creating a virtual 3-D world.
  2. Determining what part of the world will be shown on the screen.
  3. Determining how every pixel on the screen will look so that the whole image appears as realistic as possible.

What Is Animation?

What is animation? To put it simply, animation is the illusion of movement. When you watch television, you see lots of things moving around. You are really being tricked into believing that you are seeing movement. In the case of television, the illusion of movement is created by displaying a rapid succession of images with slight changes in the content. The human eye perceives these changes as movement because of its low visual acuity. The human eye can be tricked into perceiving movement with as low as 12 frames of movement per second. It should come as no surprise that frames per second (fps) is the standard unit of measure for animation. It should also be no surprise that computers use the same animation technique as television sets to trick us into seeing movement.

Types of Animation

Frame-Based Animation
Frame-based animation is the simpler of the animation techniques. It involves simulating movement by displaying a sequence of static frames. A movie is a perfect example of frame-based animation; each frame of the film is a frame of animation. When the frames are shown in rapid succession, they create the illusion of movement. In frame-based animation, there is no concept of an object distinguishable from the background; everything is reproduced on each frame. This is an important point, because it distinguishes frame-based animation from cast-based animation.
Cast-Based Animation
Cast-based animation, which also is called sprite animation, is a very popular form of animation and has seen a lot of usage in games. Cast-based animation involves objects that move independently of the background. At this point, you may be a little confused by the use of the word "object" when referring to parts of an image. In this case, an object is something that logically can be thought of as a separate entity from the background of an image. For example, in the animation of a forest, the trees might be part of the background, but a deer would be a separate object moving independently of the background.
Each object in a cast-based animation is referred to as a sprite, and can have a changing position. Almost every video game uses sprites to some degree. For example, every object in the classic Asteroids game is a sprite moving independently of the other objects. Sprites generally are assigned a position and a velocity, which determine how they move.

Sprite Animation

Sprite animation involves the movement of individual graphic objects called sprites. Unlike simple frame animation, sprite animation involves considerably more overhead. More specifically, it is necessary not only to develop a sprite class, but also a sprite management class for keeping up with all the sprites. This is necessary because sprites need to be able to interact with each other through a common interface.
Shading

Shading is a process used in drawing for depicting levels of darkness on paper by applying media more densely or with a darker shade for darker areas, and less densely or with a lighter shade for lighter areas.
Flat shading
  • Entire surface (polygon) has one colour
  • Cheapest to compute, and least accurate (so you need a dense triangulation for decent-looking results)
  • OpenGL – glShadeModel(GL_FLAT)
Phong shading
  • Compute illumination for every pixel during scan conversion
  • Interpolate normal at each pixel too
  • Expensive, but more accurate
  • Not supported in OpenGL (directly)
Gouraud shading
  • Just compute illumination at vertices
  • Interpolate vertex colours across polygon pixels
  • Cheaper, but less accurate (spreads highlights)
  • OpenGL - glShadeModel(GL_SMOOTH)
Phong illumination
  • Don’t confuse shading and illumination!
  • Shading describes how to apply an illumination model to a polygonal surface patch
  • All these shading methods could use Phong illumination (ambient, diffuse, and specular) or any other local illumination model
Anti-Aliasing
anti-aliasing is the technique of minimizing the distortion artifacts known as aliasing when representing a high-resolution signal at a lower resolution. Anti-aliasing is used in digital photography, computer graphics, digital audio, and many other applications.
Anti-aliasing means removing signal components that have a higher frequency than is able to be properly resolved by the recording (or sampling) device. This removal is done before (re)sampling at a lower resolution. When sampling is performed without removing this part of the signal, it causes undesirable artifacts such as the black-and-white noise near the top of figure 1-a below.
clip_image003 clip_image005 clip_image007
Aliasing Anti-Aliased Anti-Aliased
Another method for reducing jaggies is called smoothing, in which the printer changes the size and horizontal alignment of dots to make curves smoother.
Antialiasing is sometimes called oversampling.
Morphing
Morphing is a special effect in motion pictures and animations that changes (or morphs) one image into another through a seamless transition.
Morphing is an image processing technique used for the metamorphosis from one image to another. The idea is to get a sequence of intermediate images which when put together with the original images would represent the change from one image to the other. The simplest method of transforming one image into another is to cross-dissolve between them. In this method, the color of each pixel is interpolated over time from the first image value to the corresponding second image value. This is not so effective in suggesting the actual metamorphosis. For morphs between faces, the metamorphosis does not look good if the two faces do not have the same shape approximately.
clip_image009 clip_image011
clip_image013
The following examples show some of the uses of warping. The first set of images shows how facial features and/or expressions can be manipulated. The second set shows how the overall shape of the image can be distorted (e.g., to match the shape of a second image for use in the morphing algorithm).

2 comments:

Search This Blog