Screen melt

From DoomWiki.org

Revision as of 00:13, 4 March 2018 by 99.46.176.64 (talk) (Updating the explanation based on the one I wrote for the old wikia site)


Animation of the screen melt effect.

The screen melt is an effect seen when Doom changes scene, for example, when starting or exiting a level. The screen appears to "melt" away to the new screen.

The effect is not particularly complicated. After the first frame of the new screen has been loaded, the old screen to be "melted" is turned into a set of uniform vertical slices, two pixels wide in most executables and source ports. Each slice travels down the screen at a uniform speed, though they do not all begin moving at the same time, with each slice given a random delay.

Some source ports, such as Doomsday and ZDoom, add optional alternate effects for screen transitions, such as an effect that "burns" away the old screen, or simply fades the old screen into the new ("crossfade").

Because of the nature of the effect (relying on raster graphics), it is non-trivial to implement in OpenGL source ports. As a result, many OpenGL ports did not implement the screen melt effect; however several do so now, including at least Doom64 EX, Doomsday, EDGE, GLBoom+, and GZDoom.

Heretic and Hexen do not feature screen melt or any other sort of transition. Strife uses a crossfading instead.

Technical

The code responsible for the screen melt effect can be found in f_wipe.c, although the code is invoked from d_main.c. A wipe occurs whenever the gamestate variable changes in Doom. This controls what is currently being displayed on the screen (for example, a normal level view, intermission screen or the title screen). The D_Display function which draws the screen detects if this variable has changed. If so, the current contents of the screen buffer are saved before drawing the new screen.

D_Display then draws the new screen which shows the new game state. However, this is not immediately displayed to the user. The melt effect then runs in a loop, moving the old contents of the screen down to reveal the new screen.

The screen is subdivided into "snakes" of texture, one for each column of the screen. The position of each of these differs from its adjacent snakes by up to one pixel. Because of this, although there is a random element to the screen melt, it nonetheless appears connected along its whole length.

See also