Screen fade

From SRB2 Wiki
Jump to: navigation, search
Test.png This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
ToDoIcon.png 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.

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 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.

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)

Sizes

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

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.

Example:

Wipes
Level_ToBlack = 32
TitleScreen_Final = 69

Header

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.

Parameters

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.

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 255 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 255 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)
  Sonic Object Configuration [view]
General ClearMainCfg
Objects ObjectStateSoundFreeslot
Unlockable content EmblemExtraEmblemUnlockableConditionSet
Miscellaneous WipesCharacterLevelCutscene / SceneHudItem
Related links ActionsConstantsObject creation tutorial