Open main menu

UESPWiki β

Daggerfall Mod:Image formats/Colour Translation

< Mod / Daggerfall: Daggerfall Mod: File Formats: Image formats(Redirected from Daggerfall:Image formats/Colour Translation)

Colour Translation files are used by Daggerfall to permit what moderns API's such as Direct3D or OpenGL call "fogging". They work by translating one palette index to another palette index, and thus there is no need for palettes with more than 256 colours, no need to swap palettes, nor any need to create multiple images differing only by palette. The SkyFiles make ample use of this, as do the light sources, and the "swimming under water" effect also uses Colour Translation files.

ColourTranslationEdit

The ColourTranslation structure is the heart of the translation process. It is a contiguous list of 256 UInt8 values.

ColourTranslationFileEdit

A ColourTranslationFile consists of a contiguous list of 64 ColourTranslation structures.

The following are valid ColourTranslationFile files:

  • HAZE.000
  • HAZE.001
  • SHADE.000
  • SHADE.001

Reading ColourTranslationFilesEdit

One simply reads the 64 ColourTranslation structures.

Working with ColourTranslationFilesEdit

 
Actual data from SKY00.DAT showing palette indexes changing as the character approaches an object.

Daggerfall's renderer computes which of the 64 translations to use based on the character's distance to the flat (also called "Billboards" or "Decals" in Direct3D or OpenGL), or to a surface's central point and the player's view distance. This value, ranging from 0 to 63, is the index of which ColourTranslation structure to use from within a ColourTranslationFile. Index 0 is invariably most "fogged", whereas index 63 is enjoys very little "fogging". Any objects of interest which are closer to the character than index 63 are simply drawn w/o any translation.

Once a ColourTranslation structure is selected, one merely replaces the image's palette indexes according to the index specified. Whereas w/o translation one would merely use "palette[ image.Pixel[ x, y ] ]" for the colour, one would use "palette[ xlat[ image.Pixel[ x, y ] ] ]" for the colour with translation.