Screen fade

From SRB2 Wiki
Jump to: navigation, search

Screen fades (also known as wipes) are a type of special effect commonly used in SRB2 for transitioning from one screen to another. In most cases, screen transitions make use of two separate screen fade effects each – one to gradually change the initial screen into a solid black screen, and one to gradually change the solid black screen into the third and final screen.

Customization of screen fades is a feature specific to SRB2 – because of this, most WAD editors, with the exception of SLADE, do not support viewing of screen fade-related graphics in WAD files.

Technical specifics

Screen fades are made up of multiple graphic lumps known as "fading masks". Fading masks are stored as lumps of raw data, similarly to flats. Instead of storing the color value of each pixel directly, fading masks simply store an index number that corresponds to an entry in the game's palette of 256 colors. Therefore, changing the palette that is used by the game will also change the appearance of all screen fades.

Unlike flats however, the palette index numbers assigned to pixels in a fading mask do not directly determine the colors used by the fade effect at the corresponding frame in-game, but instead determine the alpha level of translucency the new screen's pixels have when displayed over the previous screen at the corresponding frame during the transition. Specifically, the amount of red (a number from 0 to 255) in the RGB data for a palette index's actual color determines the alpha level of a pixel on the screen – a red value of 0 is completely invisible, whereas 255 is completely opaque. Note that in the Software renderer, there are actually only eleven different alpha values. For convenience and ease of use, screen fade graphics are commonly colored with the grey-scale range of colors from SRB2's palette, which are found at indexes 0 to 31.

The table below shows how palette indexes 0 to 31 map to alpha levels in a screen fade graphic in Software, assuming SRB2's normal palette is being used. Also given are the amounts of red needed to get each alpha level.

Index #(s) 0-1 2-4 5-7 8-10 11-13 14-16 17-19 20-22 23-25 26-28 29-31
Red (Decimal) 255 - 232 231 - 209 208 - 185 184 - 162 161 - 139 138 - 115 114 - 92 91 - 69 68 - 45 44 - 22 21 - 0
Red (Hex) 0xFF - 0xE8 0xE7 - 0xD1 0xD0 - 0xB9 0xB8 - 0xA2 0xA1 - 0x8B 0x8A - 0x73 0x72 - 0x5C 0x5B - 0x45 0x44 - 0x2D 0x2C - 0x16 0x15 - 0x00
Alpha level 100% (opaque) 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% (invisible)


SRB2 supports a small selection of screen fade sizes, all of which are multiples/fractions of the default screen ratio (320:200).

Fade dimensions Lump size (bytes) Lump size (kb)
80×50 4000 3.90625
160×100 16000 15.625
320×200 64000 62.5
640×400 256000 250

Importing screen fades to a WAD file

NoteIcon.png Note
As SLADE is the only WAD editor that supports the fading masks graphic type, this section will assume you are using that editor.

To use an image as a fading mask, its dimensions must be one of the following listed above. Important note: due to a bug in the current version of SLADE, only 320×200 fading masks can be converted to the right format; fading masks of the other three sizes will remain in their original format unchanged.

Before you start importing fading masks for your screen fade, you need to add the FA_START and FA_END marker lumps; these will allow SLADE to properly identify your imported graphics as fading mask lumps, if they are located between these markers. To create these lumps, click Archive → New → Entry in the menu bar and type in FA_START as the name. You should now see a new lump with the file type "Marker". Do the same thing for the FA_END.

Now you can import the images. Click Archive → Import Files in the menu bar, browse to the folder where your images are located, select them and hit enter. The name of a fading mask lump must have the format FADExxyy", where xx is a two-digit ID number of the screen fade (an arbitrary number from of your choice from 00 to 99; see below for pre-existing IDs), and yy is the two-digit frame number the mask is used at within the screen fade (starting from frame 0, or "00"). If necessary, you can rename the lumps by right-clicking on them and selecting Rename. Now select all imported lumps at once, right-click on them, and select Gfx → Convert to.... The conversion window will pop up. Select "Doom Flat (Paletted)" as the format to convert to and make sure SRB2's palette (which should be "Existing/Global" if you have set up srb2.srb as your Base Resource, otherwise use "Sonic (SRB2)") is selected. Press Convert to convert the images.

For a single screen fade, all fading masks for the screen fade's ID should be placed in order by frame number. After the last of these, create a marker lump and name it the same way, but with a frame number one higher than the last frame's – e.g.: if a screen fade with an ID of 5 has 30 frames (the fading masks for which would be named FADE0500 to FADE0529), the marker following them should be named FADE0530. This marker lump marks the end of the screen fade in-game.

Due to bugs in the current version of SLADE, fading masks will not be immediately recognised as the "Fading Mask" type after being converted as described above (they may be displayed as a totally unrelated graphic type, such as "Doom Gfx (Jaguar Fx)"). In order to fix this, save your WAD file, close the WAD file and then re-open it. Your fading mask lumps, provided they are between the FA_START and FA_END lumps, will now appear as the correct type.

List of screen fades

These are the screen fade IDs that exist in srb2.srb for unmodified SRB2:

ID # No. of frames Description
0 22 Standard fade; the whole screen fades evenly and simultaneously; default screen fade used for most events in SRB2
1 11 Standard fade (short)
69 36 Fades outwards to sides of screen
99 33 Standard fade (long); used by the intro cutscene and credits

Screen fade events

SOCs allow a selection of globally-occuring events in which screen fades occur to be modified – in particular, they can be made to run different screen fade IDs from the defaults.


Level_ToBlack = 32
TitleScreen_Final = 69


The screen fade events block must start with a single line that reads Wipes. Unlike most other SOC blocks, it contains no slot number, since the data it modifies is global and exists only once.


The values determined by these parameters are the ID numbers of the fades to use (see above). If an ID of -1 is given, no fade will be used for the corresponding event. Note that the "Final" fade events as well as Level_ToBlack and SpecLevel_ToWhite cannot be disabled.

Note: "ToBlack" and "Final" fade events run screen fades in the same order as each other, except that "Final" fade events invert the translucency that would be seen for "ToBlack" fade events.

Fade event Default Description
Level_ToBlack 0 Level introduction (fading to black)
Level_Final 0 Level introduction (fading from black)
Intermission_ToBlack -1 Intermission screen (fading to black)
Intermission_Final 0 Intermission screen (fading from black)
SpecInter_ToBlack 0 Special Stage intermission screen (fading to black)
SpecInter_Final 0 Special Stage intermission screen (fading from black)
MultInter_ToBlack 0 Multiplayer intermission screen (fading to black)
MultInter_Final 0 Multiplayer intermission screen (fading from black)
Continuing_ToBlack -1 Continue screen (fading to black)
Continuing_Final 0 Continue screen (fading from black)
TitleScreen_ToBlack 0 Title screen (fading to black)
TitleScreen_Final 0 Title screen (fading from black)
TimeAttack_ToBlack 0 Record attack screen (fading to black)
TimeAttack_Final 0 Record attack screen (fading from black)
Credits_ToBlack 99 Credits (fading to black)
Credits_Final 99 Credits (fading from black)
Credits_Intermediate 99 Unused
Evaluation_ToBlack 0 Game evaluation screen (fading to black)
Evaluation_Final 0 Game evaluation screen (fading from black)
GameEnd_ToBlack 0 Game end (fading to black)
GameEnd_Final 0 Game end (fading from black)
SpecLevel_ToWhite 0 Entering a Special Stage (fading to white)
  Sonic Object Configuration [view]
General ClearMainCfg
Objects ObjectStateSoundFreeslot
Unlockable content EmblemExtraEmblemUnlockableConditionSet
Miscellaneous WipesCharacterLevelCutscene / SceneHudItem
Related links ActionsConstantsObject creation tutorial