Westwood Fading Table

From ModdingWiki
Jump to navigation Jump to search

The .MRF files found in Command & Conquer, officially called fading tables, are sets of remap tables that are used for colour manipulation effects in a 256-colour environment. The applied effects include gamma, saturation, luminance, brightness and contrast changes, and are applied by remapping affected pixel indices to new indices so they use different colours on the same palette.

Uses for these tables include the unit and structure shadows, the flashing effect on selected targets, the 'greyed out' filter on the build icons, and the fade to black on the map shroud edges.

The same system is used in Command & Conquer: Red Alert, but the game generates the fading tables in memory, and does not have them in the game files. The only exception to this are the fading tables used for the chrono vortex effect, which are written to disk when they are generated as part of the theater-loading logic, as one ????_VTX.PAL file per theater, with the start of the theater name for ????. Each file contains 16 progressively darker filters which are used in the chrono vortex's whirlpool-like effect.

File format

The fading table files are made up of one or more blocks of 256 bytes. Normally, each block is a table that remaps palette entries on the screen to different entries to apply the effect, but some files have an extra block at the start that acts as a mapping table to determine which indices on the game graphics will be used as one of the following filters inside the fading tables file, rather than showing the colour on that index on the palette. This mapping table will have value 0xFF on all unmapped indices.

For example, ?UNITS.MRF (where ? is the start letter of the theater) contains two blocks. The second is the unit shadow filter. The first is a mapping table on which all values are set to 0xFF except for index 4, which is set to 0x00 to refer to the filter at index 0 after the mapping table. If you look at the game's unit, structure and terrain object graphics, index 4 on the palette is indeed the bright green colour used to indicate the shadow under the object.

The same system can be seen on the game's shroud graphics, which look very strange when seen on the game's normal palette, unless you know that each of the colours seen in the graphics is mapped to a filter in the ?SHADOW.MRF file.

The unit shadow fading table filter (right) showcased on a screenshot, next to the unmodified screenshot (left), on the Filter Creator tool. Note how the actual shadows are 'invisible' on the right side; the shadow colours are just mapped back onto themselves, to avoid double-darkening where multiple shadows overlap.

Tools

The following tools are able to work with files in this format.

Name PlatformView images in this format? Convert/export to another file/format? Import from another file/format? Access hidden data? Edit metadata? Notes
Filter Creator WindowsYesYesYesN/AN/A Can't edit the files, but it can generate them from the combination of a set of colour filters and the targeted palette.