Screen fade

From SRB2 Wiki
Jump to navigation Jump to search

Screen fades (also known as screen 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 levels.

The table below shows how the amount of red in a palette index maps to alpha levels in a screen fade graphic in Software.

Red (Decimal) Red (Hex) Translucency
255–232 0xFF0xE8 0% (Opaque)
231–209 0xE70xD1 10%
208–185 0xD00xB9 20%
184–162 0xB80xA2 30%
161–139 0xA10x8B 40%
138–115 0x8A0x73 50%
114–92 0x720x5C 60%
91–69 0x5B0x45 70%
68–45 0x440x2D 80%
44–22 0x2C0x16 90%
21–0 0x150x00 100% (Invisible)

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 these palette indexes map to alpha levels in a screen fade graphic in Software, assuming SRB2's normal palette is being used.

Index # Red (Decimal) Red (Hex) Translucency
0 255 0xFF 0% (Opaque)
1 239 0xEF 0% (Opaque)
2 231 0xE7 10%
3 223 0xDF 10%
4 215 0xD7 10%
5 207 0xCF 20%
6 199 0xC7 20%
7 191 0xBF 20%
8 183 0xB7 30%
9 175 0xAF 30%
10 167 0xA7 30%
11 159 0x9F 40%
12 151 0x97 40%
13 143 0x8F 40%
14 135 0x87 50%
15 127 0x7F 50%
Index # Red (Decimal) Red (Hex) Translucency
16 119 0x77 50%
17 111 0x6F 60%
18 103 0x67 60%
19 95 0x5F 60%
20 87 0x57 70%
21 79 0x4F 70%
22 71 0x47 70%
23 63 0x3F 80%
24 55 0x37 80%
25 47 0x2F 80%
26 39 0x27 90%
27 31 0x1F 90%
28 23 0x17 90%
29 15 0x0F 100% (Invisible)
30 7 0x07 100% (Invisible)
31 0 0x00 100% (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.

In order for SLADE to properly identify your imported graphics as fading mask lumps, they must be placed between empty marker lumps called FA_START and FA_END. To create these lumps, select 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 FA_END.

Now you can import the images. Select 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.pk3 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 recognized 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.pk3 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
88 30 Fades from the top to the bottom of the screen
99 33 Standard fade (long); used by the intro cutscene and credits

Screen fade events

SOCs allow a selection of globally-occurring 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 ObjectStateSoundSprite2SpriteInfoSprite2InfoFreeslot
Unlockable content EmblemExtraEmblemUnlockableConditionSet
Miscellaneous WipesCharacterLevelCutscene / ScenePromptMenuHudItem
Related links ActionsConstantsCustom Object tutorial