Sprite (computer graphics)

This is an old revision of this page, as edited by 141.153.235.115 (talk) at 19:56, 29 September 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The term sprite is used in computer graphics to refer to a two dimensional image or animation that is integrated into a larger scene.

Sprites were originally invented as a method of quickly compositing several images together in two-dimensional video games using special hardware. As computer performance improved, this optimization became unnecessary and the term evolved to refer specifically to the two dimensional images themselves that were integrated into a scene. That is, figures generated by either custom hardware or by software alone were all referred to as sprites. As three-dimensional graphics became more prevalent, the term was used to describe a technique whereby flat images are seamlessly integrated into complicated three-dimensional scenes.

File:SpriteExamplefromZelda.jpg
An example of sprite animation from the popular game The Legend of Zelda: The Wind Waker. In this frame the brown puffs of smoke and the grass are integrated into the scene using sprites. Other objects in the frame such as the character (Link), the flower just behind his feet, and the rock walls and ground are more complicated three dimensional objects that employ texture mapping. (Notice that one sprite at the bottom of the largest puff of smoke is actually cutting into the ground, revealing its actual geometry.)

More often a sprite now refers to a partially transparent two dimensional animation that is mapped onto a special plane in a three dimensional scene. Unlike a texture map, the sprite plane is always perpendicular to the axis emanating from the camera. The image can be scaled to simulate perspective, it can be rotated two dimensionally, it can overlap other objects and be occluded, but it can only ever be viewed from the same angle. This rendering method is also referred to as billboarding.

Sprites create an effective illusion when:

  • the image inside the sprite already depicts a three dimensional object
  • the animation is constantly changing or depicts rotation
  • the sprite exists only for a short period of time
  • the depicted object has a similar appearance from many common viewing angles (such as something spherical)
  • the viewer accepts that the depicted object only has one perspective. (such as small plants or leaves)

When the illusion works viewers will not notice that the sprite is flat and always faces them. Often sprites are used to depict phenomena such as fire, smoke, small objects, small plants (like blades of grass), or special symbols (like "1-Up"). The sprite illusion can be exposed in video games by quickly changing the position of the camera while keeping the sprite in the center of the view.

Sprites have also occasionally been used as a special effects tool in movies. Most notably, the creators of the fire breathing Balrog in The Lord of the Rings: The Fellowship of the Ring used sprites to simulate fire emanating from the surface of the demon. Small bursts of fire were filmed in front of a black background and made transparent using a luma key. Many bursts were then attached to the surface of the animated Balrog model and mixed with simulated smoke and heat waves to create the illusion of a monster made from fire.

Billboarding

Billboarding is one term used to describe the use of sprites in a 3D environment. In the same-way that a billboard is positioned to face drivers on a highway, the 3D sprite always faces the camera.

Rationale

There is both a performance advantage and an aesthetic advantage to using billboarding. Most 3D rendering engines can process "3D sprites" much faster than other types of 3D objects. So it is possible to gain an overall performance improvement by substituting sprites for some objects that might normally be modeled using texture mapped polygons. Aesthetically sprites might be desirable because polygons might never be able to realistically reproduce phenomenon such as fire. Sprite images of fire might provide a more attractive illusion.

Alternative Terms

  • 3D Sprite is a term often used to refer to sprites that are essentially texture mapped 3D facets that always have their surface normal facing into the camera.
  • Z-Sprite is a term often used for 3D environments that contain only sprites. The Z-parameter provides a scaling effect that creates an illusion of depth. For example in adventure games such as Kings Quest VI the camera never moves, normal 2D sprites might suffice, but Z-sprites provide an extra touch.

Hardware Sprites

In early video gaming, sprites were a method of integrating unrelated bitmaps so that they appear to be part of the a single bitmap on a screen.

Rationale

During most of the 1980s, hardware speed was in the low, single-digit megahertz and memory was mere kilobytes. With these constraints video game programmers resorted to extreme measures to speed up the process of writing bitmaps onto the display. A sprite engine is hardwired into a computer or videogame system's architecture. The central processor can instruct the engine to fetch source images and integrate them into the main screen using direct memory access channels. (This is related to what a genlock does with video sources and to a playfield). Calling up sprite hardware, instead of using the processor alone, greatly improved graphics performance. Because the processor is not occupied by the simple task of transfering data from one place to another, software can run faster; and because the hardware provided certain innate abilities, programs that used sprites were also smaller.

Separate locations in memory were used to hold the main display and the sprites, which were composited together into the display in two passes. This placed the sprites on the display without interferring with the "background" image, making them easy to move around the display. Examples of such systems include the Atari 8-bit machines (which referred to them as player/missile graphics) and the Commodore 64.

In contrast, bit blitting (short for "bit block transfer") drew sprite-like figures into the same memory as the background, with the main display hardware rendering the entire image at once. Moving a bit blit object on the screen requires several steps; the original background to be painted over must be stored, the image drawn, then when it moves the original image painted back into the blit's ___location to "repair" the display and the process repeated for the new ___location. The upside to this approach is that there is no need for custom hardware and any number of images can be composited. The downside is that, in the era of severely limited processor performance, the time needed to repair the images and redraw them was considerably more expensive than using a sprite system.

Sprites are rare in most video hardware today. More commonly, bit blitting is employed or more complicated rendering algorithms are used. For extreme graphics performance, graphics accelerators now have a similar role.

Capabilities

Sprite engines were varied in their capabiliies. The various parameters included:

  • collision detection (see Atari Lynx)
  • scaling images (The first game that used this technique to give the illusion of perspective was The Secret of Monkey Island.)
  • rotating images
  • sprite image size
    • fixed
    • arbitrary (see Amiga)
  • transparency

Sprites are typically used for characters and other moving objects in video games. They have also been used for mouse pointers and for writing letters to the screen.

Alternative Terms

For on-screen moving objects larger than one sprite's extent, sprites may sometimes be scaled and/or combined.

  • Player-Missile Graphics was the term used by the Atari 400/800 to refer to sprites. The term reflected the usage for both characters ("players") and other objects ("missiles") These graphics were very narrow and of limited use.
  • Movable Object Block, or MOB was used in MOS Technology's graphics chip literature (data sheets, etc). However, Commodore, the main user of MOS chips and the owner of MOS for most of the chip maker's lifetime, applied the common term "sprite".
  • On the Nintendo Entertainment System, Super Nintendo Entertainment System, and Game Boy, sprites were referred to as OBJs (short for "objects"), and the region of RAM used to store sprite attributes and coordinates was known as OAM (Object Attribute Memory). This still applies today on the Game Boy Advance and Nintendo DS handheld systems.
  • Software sprites were used to refer to subroutines that used bit blitting to accomplish the same goal on systems such as the Atari ST and the Apple II whose graphics hardware had no sprite capability. (This was of course oxymoronic)

Notable Implementations

See also