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.
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.
|Red (Decimal)||255 - 232||231 - 209||208 - 185||184 - 162||161 - 139||138 - 115||114 - 92||91 - 69||68 - 45||44 - 22||21 - 0|
|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)|
Importing screen fades to a WAD file
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_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
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
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_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.
Wipes 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
SpecLevel_ToWhite cannot be disabled.
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.
||0||Level introduction (fading to black)|
||0||Level introduction (fading from black)|
||-1||Intermission screen (fading to black)|
||0||Intermission screen (fading from black)|
||0||Special Stage intermission screen (fading to black)|
||0||Special Stage intermission screen (fading from black)|
||0||Multiplayer intermission screen (fading to black)|
||0||Multiplayer intermission screen (fading from black)|
||-1||Continue screen (fading to black)|
||0||Continue screen (fading from black)|
||0||Title screen (fading to black)|
||0||Title screen (fading from black)|
||0||Record attack screen (fading to black)|
||0||Record attack screen (fading from black)|
||99||Credits (fading to black)|
||99||Credits (fading from black)|
||0||Game evaluation screen (fading to black)|
||0||Game evaluation screen (fading from black)|
||0||Game end (fading to black)|
||0||Game end (fading from black)|
||0||Entering a Special Stage (fading to white)|
|Sonic Object Configuration||[view]|
|Unlockable content|| |
|Related links||Actions • Constants • Object creation tutorial|