Miptex: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎top: clean up, replaced: {{goldsrc → {{gldsrc)
mNo edit summary
Line 1: Line 1:
{{todo|Provide structs for paletted and paletteless versions of miptex.}}
'''Miptex''' is an 8-bit texture format used by {{quake|4.1}} and {{gldsrc|4.1}}. They can be stored individually with a {{code|.mip}} file, but most tools and engines expect them to be embedded in a [[BSP]] or [[WAD]].
'''Miptex''' is an 8-bit texture format used by {{quake|4.1}} and {{gldsrc|4.1}}. They can be stored individually with a {{code|.mip}} file, but most tools and engines expect them to be embedded in a [[BSP]] or [[WAD]].


Line 6: Line 5:
Half-Life extends the miptex format to add a dedicated palette, instead of relying upon an external shared palette. This is an uncompressed 768 byte array of 256 24-bit RGB values, like {{quakewiki|Quake palette|Quake's palette.lmp}}.
Half-Life extends the miptex format to add a dedicated palette, instead of relying upon an external shared palette. This is an uncompressed 768 byte array of 256 24-bit RGB values, like {{quakewiki|Quake palette|Quake's palette.lmp}}.


{{quake2|4.1}} encapsulates miptex in a file format called [[WAL]], which is always stored individually per texture and contains additional surface metadata for compilers. Variations of [[WAL]], such as Daikatana WALs, M8, and M32, are used in other {{quake2engine|4.1}} games, and add some additional features.
== Technical ==
=== WAD2 ===
{{License|type=gpl|version=2}}
The header of a WAD2 miptex lump can be represented by the following C struct (from {{path|client/bspfile|h}} in the Quake I source code release):
<source lang=c>
#define MIPLEVELS 4
typedef struct miptex_s
{
char name[16];
unsigned width, height;
unsigned offsets[MIPLEVELS]; // four mip maps stored
} miptex_t;
</source>
{{note|{{mono|unsigned}} is 32-bits.}}
It is then followed by raw 8-bit image data for each mipmap, at the offsets relative to the start of the file.
 
=== WAD3 ===
{{todo|Provide structs for paletted version of miptex.}}
 
== Derivatives ==
{{quake2|4.1}} encapsulates a modified version of miptex in a file format called [[WAL]], which is always stored individually per texture and contains additional surface metadata for compilers. Variations of [[WAL]], such as Daikatana WALs, M8, and M32, are used in other {{quake2engine|4.1}} games, and add some additional features.


[[Category:Glossary]]
[[Category:Glossary]]
[[Category:File formats]]
[[Category:File formats]]

Revision as of 09:20, 28 July 2024

Miptex is an 8-bit texture format used by Quake Quake and GoldSrc GoldSrc. They can be stored individually with a .mip file, but most tools and engines expect them to be embedded in a BSP or WAD.

Miptex are always a multiple of 16, and contains the full-size texture plus 3 smaller mipmaps, although these mipmaps are only used by the software renderer (the OpenGL renderer uses the GPU to generate 32-bit mipmaps). Some programs also will use these mipmaps, such as TrenchBroom TrenchBroom.

Half-Life extends the miptex format to add a dedicated palette, instead of relying upon an external shared palette. This is an uncompressed 768 byte array of 256 24-bit RGB values, like Quake1-16px.png Quake's palette.lmp.

Technical

WAD2

The header of a WAD2 miptex lump can be represented by the following C struct (from 🖿client/bspfile.h in the Quake I source code release):

#define	MIPLEVELS	4
typedef struct miptex_s
{
	char		name[16];
	unsigned	width, height;
	unsigned	offsets[MIPLEVELS];		// four mip maps stored
} miptex_t;
Note.pngNote:unsigned is 32-bits.

It is then followed by raw 8-bit image data for each mipmap, at the offsets relative to the start of the file.

WAD3

Todo: Provide structs for paletted version of miptex.

Derivatives

Quake II Quake II encapsulates a modified version of miptex in a file format called WAL, which is always stored individually per texture and contains additional surface metadata for compilers. Variations of WAL, such as Daikatana WALs, M8, and M32, are used in other Quake II Engine Quake II Engine games, and add some additional features.