|This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki bythis article.|
| To do|
Explain how to add a screen fade to WAD files
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 fade graphics are stored as lumps of raw data, similarly to flats. Instead of storing the color value of each pixel directly, screen fade graphics 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 screen fade graphic 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)|
List of screen fades
These are the screen fade IDs that exist in
srb2.srb for unmodified SRB2:
|ID #||No. of frames||Description|
|0||21||Standard fade; the whole screen fades evenly and simultaneously; default screen fade used for most events in SRB2|
|1||10||Standard fade (short)|
|69||35||Fades outwards to sides of screen|
|99||32||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 255 is given, no fade will be used for the corresponding event.
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)|
||255||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)|
||255||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)|
|Sonic Object Configuration||[view]|
|Unlockable content|| |
|Related links||Actions • Constants • Object creation tutorial|