Graphics / Models
Image showing different use of M2 models
M2 files contain model objects. Each M2 file describes the vertices, faces, materials, texture names, animations, and properties of one model.
Models are used for doodads (decoration objects), players, monsters, and really everything in the game except for Terrain and WMOs.
M2 file mostly contains technical information about the model, animations, textures, bones, particles, rendering info, lights, cameras, etc.
Each new expansion is always accompanied by changes in the file format from Blizzard. Modders cannot use new models from new expansions due to these changes. That's why we need to use converters (e.g., Adspartan's Multiconverter), file exporters (convert m2s to obj/fbx), 3D software add-ons (e.g., Blender WoW Studio), etc.
Due to the lack of full-fledged programs and tools, people who just started modding had to make all changes to models and data manually with the 010 Editor. Despite this, in the current circumstances, there is always room for manual research or editing models.
Due to changes in the format, the tools lose their relevance. Community developers have to work together to implement updates for the tools that allow the community to work with the newest models and data. But this is not always possible.
Geosets (geometry sets)
Geoset is an individual object that makes up complex models. Let's analyze how geosets work on the model of humanmale.m2
In the image above, you can see different options for the appearance of gloves, boots, hairstyles, and various other model parts. Each part is a separate object. Each one of them has it's own material (one per geoset, it's strictly limited).
Geosets determine the appearance and form factor of objects, external character traits (hairstyle, beard, jewelry), and the way how they are displayed.
For each material, there is only one texture. That's a strict limitation too.
You can define textures in a two ways: directly for geoset or through the DBCs.
Unlike WMO, for M2s, there is a possibility of using animated textures. Textures can be animated in different ways, such as transformations (X and Y coordinates) and texture animation itself (per frame animation).
We will cover these topics more in-depth in the next lessons about M2.
Like any animated game model, the character is very complex and filled with various technical objects.
To make a model move, it needs a skeleton. The skeleton consists of bones, each of which gives a motion for a specific part of the model.
Bones can create various dependencies and hierarchies to create the correct structure and movement of the model.
Bones (highlighted) are used to animate the mesh.
Attachments (outlined black spheres; see previous images above) are used to attach other objects to mesh. E.g., weapons, shields, shoulders, helmets, etc.
There are lots of different places where attachments are used, such as mounts, particle impacts, footprints, and other (not so obvious!) game mechanics.
M2s can contain animations inside the .m2 file. It also can be put inside the separate .anim files, which are used to hold all the additional animations (if there is too much to contain inside .m2).
Animation refers to the temporal description of an object (i.e., how it moves and deforms over time; popular methods include keyframing and inverse kinematics). These techniques are often used in combination. As with animation, physical simulation also specifies motion.
In WoW, there are just usual keyframing without any motion capture or realistic physics simulations.
Effects wiki link
In WoW modding effects are:
Texture Transformations (texture animation)
Particles wiki link
A particle system is an engine subsystem that uses a large number of tiny sprites, 3D models, or other graphic objects to simulate certain kinds of "fuzzy" phenomena. All of these are very hard to reproduce with conventional rendering techniques - usually highly chaotic systems, natural phenomena, or processes caused by chemical reactions.
Typically a particle system's position and motion in 3D space are controlled by what is referred to as an emitter. An emitter acts as the source of the particles, and its location in 3D space determines where they have generated and their movement direction. A regular 3D mesh object, such as a cube or a plane, can be used as an emitter.
An emitter contains a set of particle behavior parameters. These parameters can include the spawning rate (how many particles are generated per unit of time), the particles' initial velocity vector (the direction they are emitted upon creation), particle lifetime (the length of time each particle exists before disappearing), particle color, and much more.
Spells are magic incantations or effects conjured up by whatever game mechanism the developers allowed. Spells can do different kinds of damage, or healing. They can also cause beneficial effects (aka buffs) on friendly characters or harmful effects (aka debuffs) on hostile mobs.
In WoW modding spells are particle emitters with different settings and parameters, such as ribbons (trails), sounds, etc.
M2 models can be used not only for characters but also for static objects (doodads, weapons, objects on the map, etc.).
In addition to simple static objects, M2 is used to create skyboxes and scenes.
Skyboxes are M2 models that are used for maps to display it as the sky above the character’s head.
This is how the skybox model usually looks - 3d sphere with the texture planes inside it
Scenes - M2 models used in non-game areas of the game, for example, login screen, character selection and creation screen, etc.
Horde character screen M2 scene
Models: WMO - World Model Object
What is World Model Object?
World Model Object or just a WMO is a special compound 3D structure used in the game World of Warcraft for making buildings, dungeons, and other big complicated 3D objects. It does not only contain traditional 3D model parts as geometry, UV maps, materials and so on; but it does also support features like liquids, complex lighting system, portal culling system and much more.
There are two types of WMO files, actually:
WMO root file - lists textures (BLP Files), doodads (M2 or MDX Files), etc., and orientation for the WMO groups
WMO group file - 3d model data for one unit in the world map object
The root file and the groups are stored with the following filenames:
There is a hardcoded maximum of 512 group files per root object.
World of Warcraft WMO supports two group types - indoor and outdoor.
Outdoor is used for exterior objects and is influenced by the zone lighting.
Indoor is used for interior models, interior parts of models. It is not getting influenced by the external light.
If you are planning to use indoor groups in your scene, you will have to create portals for them.
Each WMO group has various settings:
Name - Object's name is saved into the files and is only used for development purposes, for example, when you inspect your model using a 010 editor. Please do not name as "Antiportal", an internally reserved name that actually makes sense for the game.
Description - group description, which is also used only for development purposes. Name it whatever you want or leave blank.
Place Type - select type for your group: indoor or outdoor.
Flags - enable/disable different flags for your model.
DBC GroupID - connected with AreaID for WMO. Used to detect indoor groups, for example, so the server can dismount you when you enter them.
LiquidType - fills this WMO group with selected liquid.
Materials are an enhancement of texture mapping (and a pre-requisite for advanced shading effects) that allows for objects in 3D modeling packages and video games to simulate different types of materials in real life. They are typically used to enhance the realism of polygon meshes and other forms of 3D model data.
They associate additional properties such as advanced rendering parameters (e.g., specularity) or sound triggers alongside texture information for surfaces. For example, if a texture makes an object look like wood, it will sound like wood (if something hits it or is scraped along a surface), break like wood, and even float like wood. If it was made of metal, it will sound like metal, dent like metal, and sink like metal.
A materials system allows a digital artist or game designer to think about objects in a different way. Instead of the object just being a model with a texture applied to it, the object, or part of the object, is made up of material.
Examples of major materials might be wood, concrete (or stone), metal, glass, dirt, water, and cloth (such as carpeting, curtains, or clothing on a character).
Here is the list of WoW material parameters:
used for producing special WoW render effects
used for producing footsteps sounds and footprints
used to control texture blending on rendering
diffuse texture (object)
environment texture (blending)
used for defining special render options for the texture
(see list of Material Flags below)
the color of the object when no light falls on it
base color of the object
Flags are toggleable options of individual material
disable world lighting effect
disable world fog effect
render from both sides
ignore local WMO lighting, use world lighting instead
used for windows to glow at nighttime
has no description yet, used for windows
A portal is a plane that, in most cases, contains only four vertices and one face. Portals are created as separate objects (you can see them in the outliner if you import some original WMO as I did with the human farm)
Portals are polygon planes (usually quads, but they can have more complex shapes) that specify where separation points between groups in a WMO are - these are usually doors or entrances, but can be placed elsewhere. Portals are used for occlusion culling and are a known rendering technique used in many games (see Portal Rendering on Wikipedia and Antiportal on Wikipedia for more information)
Portals are used to connect indoor groups to outdoor groups or other indoor groups. If the portal is not set, but the indoor group is used, you will have the indoor group rendered only while standing in it; everything else will look like emptiness.
Batch Types. Lightmaps. Blendmaps
Demonstration from Blender how batches and maps managing process looks for human farm
Batches are groups of faces which are used to accelerate rendering. World of Warcraft WMO supports two batch types - Batch A and Batch B.
Batches are usually used only for interior groups.
Batch A is influenced by the outdoor (zone) lighting. Batch B is not getting influenced by the external light from outdoor groups.
Lightmaps - used to accelerate light rendering. They are normally used in Batches A in order to blend the geometry with world lighting. See the entrance of the human farm in order to see how it works.
Blendmaps - used to accelerate texture blending. If your material is using one of the TwoLayer shaders, you enter a second environment texture path, which will blend with the diffuse texture according to lightmap values.
You can see how the far objects are getting 'flat-colored'
The fog effect mimics the scattering of light in a fog. Objects in the distance become less contrasting and acquire a fog color. In night scenes fog is usually dark, in daytime - whitish or slightly bluish, just like real fog.
The fog has some simple options to work with:
(probably) makes fog global
a radius of fog starting to fade
anything further away from the eye than the far clipping distance isn't displayed (it's too far away)
anything closer to the eye than the near clipping distance isn't displayed (it's too close)
same as Farclip, but under the water
same as Nearclip, but under the water
fog color under the water
Water - used to make the liquid in your model. The liquid group has own options:
LiquidType - type of liquid in WoW. There are lots of variants to work with:
Color - water color
WMO Group - parent group for this liquid
Flags - with the vertex paint you will be able to set flags to quads that control the rendering of the water. We do not yet know what most of them mean, so if you figure that out, please tell me or Skarn about it
You can paint vertex colors on WMO groups. It is used for lighting and coloring particular places of a group.
Demonstration of vertex color painting in Blender
Demonstration of doodads placement in Blender with WoW Model Viewer
Doodads in WoW are M2 model files. Doodad sets specify several versions of "interior decoration" for a WMO. Like, a small house might have tables and a bed laid out neatly in one set, and have a horrible mess of abandoned broken things in another set called "Set_Abandoned01".
DoodadSets are used to group doodads on your scene into sets. The model can have multiple sets that can be chosen in the map editor to be displayed in one particular WMO instance. Normally they are used to create different furniture blocks to add some variations to the appearance of the model. See the human farm once again as an example. Another common usage is to create the normal set of furniture and the broken set of furniture, see Westfall packs of human buildings.
DoodadSets are exclusive except for the very first one, "Set_$DefaultGlobal" which is additive and is always displayed. The client determines that set by index, not name though. Up to 8 doodad sets can be enabled at the same time, e.g. via destructible buildings or garrisons.
There is always one global doodad set that is displayed along with the selected set. Global doodad set cannot be turned off, however, it may be empty. See the global doodad set in human farm - it contains a few crates, some barrels, and smoke coming from the chimney. Those doodads are displayed on all the sets available.
ADT files contain terrain and object information for map tiles. They have a chunked structure just like the WDT files.
A map tile is split up into 16x16 = 256 map chunks.
Map size, blocks, chunks
All maps are divided into 64x64 blocks for a total of 4096 (some of which may be unused). Each block is divided into 16x16 chunks.
Each block is 533.33333 yards (1600 feet) in width and height. The map is divided into 64x64 blocks so the total width and height of the map will be 34133.33312 yards, however, the origin of the coordinate system is at the center of the map so the minimum and maximum X and Y coordinates will be ±17066.66656).
Since each block has 16x16 chunks, the size of a chunk will be 33.3333 yards (100 feet).
The basic running speed of a player (without any speed modifying effects) is 7.1111 yards/s (21.3333 feet/s). The player is able to reach one border of an ADT tile from another in 75 seconds. Thus, the fastest mounts (310%) can get over ADT size in 24.2 seconds.
ADT files and blocks
There is an .adt file for each existing block. If a block is unused it won't have an .adt file. The file will be: World/Maps/<InternalMapName>/<InternalMapName>_<BlockX>_<BlockY>.adt.
<InternalMapName> - MapRec::m_Directory
<BlockX> - Index of the tile on the X-axis
<BlockY> - Index of the tile on the Y-axis
Converting ADT co-ords to block X/Y can be done with the following formula (where the axis is x or y): floor((32 - (axis / 533.33333)))
An important note about the coordinate system used
Wow's main coordinate system is right-handed; understanding it is very important in order to correctly interpret the ADT files.
It's important to remember that:
The positive X-axis points north, the positive Y-axis points west.
The Z-axis is vertical height, with 0 being sea level.
The origin of the coordinate system is in the center of the map.
The top-left corner of the map has X = 17066, Y = 17066
The bottom-right corner of the map has X = -17066, Y = -17066
The bottom-left corner of the map has X = -17006, Y = 17066
The top-right corner of the map has X = 17006, Y = -17066
WDT files specify exactly which map tiles are present in a world, if any, and can also reference a "global" WMO.
WDL files contain a low-resolution heightmap for a world. This is probably what the WoW client uses to draw the solid-colored mountain ranges in the background ('in front of' the sky, but 'behind' the fog and the rest of the scenery). It can also be conveniently used to construct a minimap - however, since no water level information is present, the best guess is 0 (sea level) - this results in some lower-than-sea-level areas being blue on the WoWmapview minimap.
Textures: BLP - Blizzard Picture
BLP files store textures with precalculated mipmaps.
Demonstration of mipmaps in BLP Lab
In computer graphics, mipmaps (also MIP maps) are pre-calculated, optimized sequences of images, each of which is a progressively lower resolution representation of the same image. The height and width of each image, or level, in the mipmap is a power of two smaller than the previous level. Mipmaps do not have to be square. They are intended to increase rendering speed and reduce aliasing artifacts. A high-resolution mipmap image is used for high-density samples, such as for objects close to the camera. Lower-resolution images are used as the object appears farther away.
How it works:
Each bitmap image of the mipmap set is a downsized duplicate of the main texture but at a certain reduced level of detail. Although the main texture would still be used when the view is sufficient to render it in full detail, the renderer will switch to a suitable mipmap image when the texture is viewed from a distance or at a small size.
Rendering speed increases since the number of texture pixels (texels) being processed per display pixel can be much lower for similar results with the simpler mipmap textures. If using a limited number of texture samples per display pixel (as is the case with bilinear filtering), then artifacts are reduced since the mipmap images are effectively already anti-aliased. Scaling down and up is made more efficient with mipmaps, as well.
Image showing how mipmaps reduce aliasing at large distances. Note the moire pattern on the left image
Mipmaps are used for:
Level of detail (LOD)
Improving image quality. Rendering from large textures where only small, discontiguous subsets of texels are used can easily produce moiré patterns
Speeding up rendering times, either by reducing the number of texels sampled to render each pixel, or increasing the memory locality of the samples taken
Reducing stress on the GPU or CPU
BLP files are capable of storing data in a few different formats. The RGB formats are stored using DXT compression (DXT1 for 0-bit alpha and DXT3 for the others), and thus conversion to these formats is somewhat lossy. Here is a list:
Palettized, 0-bit alpha - Example: character skins, clothing
Palettized, 1-bit alpha - Example: clothing (relatively rare)
Palettized, 8-bit alpha - Example: clothing
RGB, 0-bit alpha - Example: Sansamroot.blp
RGB, 1-bit alpha - Example: Peaceflower.blp
RGB, 8-bit alpha - Example: Sungrass.blp
Alpha Bit DepthsThis is the amount of detail allowed in the transparency of your image.
0-bit - No transparency at all
1-bit - Simple transparency, similar to GIFs. It's either transparent or not
4-bit - Slightly better range of transparency, but will turn smooth fades into visible "steps"
8-bit - This is the same level of transparency you'll ordinarily see in PNG/TGA formats, with 256 levels of transparency
Indexed (256 Color) - Very similar to a GIF, as it uses a palette that can fit up to 256 colors, but BLP files have independent transparency. Indexed BLPs can make use of all four types of alpha.
DXT - This is the defacto compression type used in modern games, with the most popular format that uses this, being .dds. DXT compression gives you a better color range, with a slightly larger size than indexed. It also supports all four levels of transparency.
DXT-5 - Would generally be lumped in with the above category. However, it's the second DXT type that supports 8-bit alpha. The result is a bit better color and slightly larger file size than the 8-bit alpha under the DXT category.
Uncompressed - Very much like a Bitmap, but without compression. It can support either 0-bit or 8-bit alpha. Blizzard only uses this version for sky textures, where every bit of color detail is necessary.
TODO: Liquids, DBC