Jump to content

Plasma effect

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 209.6.237.104 (talk) at 07:09, 22 December 2014 (Added first hand technical knowledge of plasma effect being used in the Demoscene.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The plasma effect is a computer-based visual effect animated in real-time. It uses cycles of changing colours warped in various ways to give an illusion of liquid, organic movement.

A still screenshot of a typical plasma effect.
Animated color cycling feature as in Fractint

Plasma was probably invented by demo coders for use in their demos where the effect was heavily used, especially in the early 1990s. The effect was particularly common on the Commodore Amiga where it could be implemented very efficiently by using the features of the proprietary display hardware. Plasma can also be implemented easily in software rendering by using sinus tables and pseudocolor palettes, and it has also been the first true demo effect for many beginning PC democoders.

The fractal software Fractint also incorporates an algorithm known as "plasma", which, when combined with the color cycling feature of the software, can provide a result which resembles a typical plasma effect used in demos. The technical basis, however, is completely different, and a color cycling plasma is somewhat less dynamic than a demo plasma.

Synopsis

A plasma effect rendered in ANSI art by the AAlib library.

As there are many "hacked" approaches for implementing a plasma effect, this outline of an algorithm will just describe the theoretical basis for the effect. In order to achieve a sufficiently fast and good-looking real-time implementation (especially on the limited hardware available at the time this effect was at the height of its popularity in the 1990s), one would often do "non-correct" approximations to this algorithm. This, however, can often be done without noticeable visual differences.

This algorithm is given in two dimensions, but could easily be adopted to any number of dimensions for any number of color channels.

Let be a multi-frequency noise function of two 2 variables (e.g., a perlin noise function). Let each color component at the pixel be a linear function of the expression .

Technical Difficulty

It should be noted that a correctly executed plasma effect in the demoscene days is demonstration of great skill in low-level hardware hacking. Difficulty comes from the requirement of developers to select and use a "screen mode" available on the most common video cards of the day having significant limitations on screen resolution and color palette. The well know "Mode 13h" gave the programmer the ability to display a (mind-blowing at the time) 256 different colors on the screen at the same time picked from a global palette of about 262 thousand displayable colors. Mode 13h had a screen resolution of 320 x 200 pixels, its trade off was that the colorful graphics had a very pixelated look and half the resolution of the other screen modes.

Demoscene and other hackers used various advanced techniques to get around this limitation and be able to display the full 262,144 color palette on the screen at double or better the resolution of Mode 13h or Mode X. In some cases, a higher resolution monochrome screen mode was selected and it's 16 colors were reprogrammed to be 16 shades of red, green, or blue. The hardware hack used the vertical blank interrupt signal to time the start and end timings for each line the electron gun scans across the monitor. This master timing system along with a several other parts is used to remap the display colors used for each scan line as the electron gun fires across it! Depending on the exact video mode and/or VGA card used, only one color gun would be activated at a time. This forced hackers to display alternating red, green and blue shades on alternating lines. This was done in such a way that after 3 screen refreshes the phosphor of the CRT along with persistence of vision effects causes the viewer to see the monitor displaying 4,096 colors simultaneously on the a 600 x 200 screen with an effective refresh rate of about 20Hz. The slow refresh rate limited the speed of any motion could occur on the screen while it was in this intensely modified mode. The idea of displaying a slowly changing and very colorful plasma fits the roll naturally.

This technique is quite similar to ZX Spectrum Computer and similar to techniques used in California Games.

See also

Plasma fractal is a fractal to which the plasma effect can be applied with nice results.