By far the most well known improvement, it promised a paradigm shift in the way texture assets are managed and used by the engine. Put simply a MegaTexture is a very big texture; with a typical MegaTexture in the game measuring 32.768 pixels by 32.768 pixels.

John Carmack created MegaTexture to solve a very simple problem: how to get good looking terrain without burning through the texture memory budget. In an interview Carmack described it thus: "MegaTexture technology is something that addresses resource limitations in one particular aspect of graphics. The core idea of it is that when you start looking at outdoor rendering and how you want to do terrain and things in general, people almost always wind up with some kind of cross-fade blended approach where you tile your textures over and blend between them and add little bits of detail here and there."

Carmack continues: "A really important thing to realize about just generally tiling textures, that we're so used to accepting it in games, is that when you have one repeated pattern over a bunch of geometry, the texture tiling and repeating is really just a very, very specialized form of data compression where it's allowing you to take a smaller amount of data and have it replicated over multiple surfaces, or multiple parts of the same surface in a game since you generally don't have enough memory to be able to have the exact texture that you'd like everywhere."

MegaTexture covering an entire island

Part of the same map, showing the different mip-map levels.

So, with regular texture mapping, no matter how big the textures may be or how many blends you use repetition is still noticeable unless liberal use of props such as vegetation or other geometry to break the patterns is employed.

The basic idea of MegaTexture is quite simple: instead of tiling a number of discrete textures across a terrain, why not store those textures on a single file and have the terrain surface point to the coordinates on this single texture. For a time, this was all that was known about MegaTexture and many people begun questioning what made this so different from texture atlases that have already been used by other games.

The main difference is that atlases are still loaded as a regular texture so they will take up as much memory as if they were separate. Since they are used as a means to reduce batch count; their contents are purely different textures sharing the same "file". Incidentally, ETQW also uses atlases for non-terrain textures to improve batching performance. MegaTexture stores a completely unique representation of texture data while atlases store the data of individual textures. It's a subtle difference but in practice the two techniques have vastly different uses.

Unique texture detail in a Norway-based map

As well as in the south-west of the United States

To explain MegaTexture it's useful to know how they are built. Firstly, the level designer creates a terrain model and then distributes a series of common (discrete and tileable) textures throughout using certain rules like altitude, slope inclination, etc. When the map is saved two textures are created, one for diffuse data and another for normal map data. For ETQW's 32k x 32k sizes, this creates two 4Gb textures, in standard Targa image format.

These two textures are now unique for that particular terrain model and the level designer can now go and add as many texture details as he wants. He can put a crater where there was once a road, he can splash a bit of grass where dirt was, or put cracks in rock faces. All of this gets saved into the two files.

In the end, the level designer lights the megatexture with the lighting conditions of his map. This process is two-fold. Firstly, the light is baked using the 4Gb normal map and diffuse maps into a new merged file, broken up into 128 x 128 tiles and then compressed to acceptable distribution sizes using a proprietary format. The megatextures for the twelve maps in ETQW range from 140mb to 400mb even though their pixel area is the same.