Introduction
A 3DF file holds one texture for the 3dfx Voodoo graphics cards and their Glide
programming interface, with all its mipmap levels, the smaller copies the card picks
from when a surface is far away. 3dfx’s Texus tool made the files from ordinary
pictures, and the Glide utility library read them with gu3dfGetInfo and
gu3dfLoad. Many Glide demos and games from 1996 to 1999 ship their
textures this way.
The file keeps the pixels in the format the card uses, so there are fourteen pixel formats, from 8-bit colour to 32-bit colour with alpha, and two of them are YIQ, a way to store colour in a single byte that Voodoo cards could expand in hardware.
Structure
A 3DF file starts with four lines of plain text, each ended by a line feed. They give the version, the pixel format, the range of mipmap sizes and the aspect ratio. After them comes a colour table for the four formats that need one, then the pixels of every level, largest first, with no gaps and no size fields: the header says how many levels there are and how big, so the reader works out where each level ends.
0Header four lines of text:3df v1.1, the format,lod range: 1 256andaspect ratio: 1 1about 50 bytes…Colour table a YIQ table for yiq and ayiq8422, a palette for p8 and ap88; none for the other formats0, 80 or 1024 bytes…Level 0 the largest level, top row firstwidth × height × pixel size…Level 1 and on each half as wide and half as high, down to the smallest levela quarter each time
All numbers wider than a byte are big-endian, which is unusual for a format made on PCs: 16-bit pixels, the 16-bit numbers of the YIQ table, and the four bytes of a palette entry (alpha first).
A .3df file dropped on any page of this site opens in the explorer, which
shows every mipmap level as a picture, the alpha channel of formats that have one, the
YIQ table or palette, and every pixel with its raw bytes. The viewer was checked
against 212 distinct files and every pixel format found in them; the formats no file
on hand uses (i8, ai44, ai88) follow Glide’s
headers and are not checked against a file.
In this reference
- Header – the four text lines, versions, the LOD range and the aspect ratio
- Pixel formats – every format name, its bit layout and how to decode it
- Colour tables – the 80-byte YIQ table and the 1024-byte palette
- Mipmap levels – how many levels there are, their sizes and where each starts
Links
Software
- Texus – 3dfx’s command-line tool that converts pictures to and from 3DF, part of the Glide SDK (Windows, MS-DOS)
Developers
- Glide utility library –
gu3dfGetInfoandgu3dfLoadread 3DF files into aGu3dfInfostructure (C, in the Glide SDK)
Reference
- Glide 2.x SDK headers (
glide.handglideutl.h) – the texture format numbers, aspect ratios and theGu3dfInfostructure the files map onto