Material is an abstract concept which has been developed to replace the id Tech 1 mechanism of directly associating flat, texture, etc..., texture resources to the map geometry surfaces on which they are to be drawn.
Material abstracts the relationship between texture resource and the surfaces on which they are drawn, by adding two additional levels of indirection. These additional levels serve to isolate texture resources behind the name(s) by which they are referenced, both internally within the engine and publicly, via the DMU API.
During game initialization, the engine dynamically constructs materials for each texture resource. These automatically generated materials are named accordingly to the texture resources they abstract. This creates a name binding where instances of texture resource names are instead interpreted as material URIs. Material names are populated into a indexing scheme specific to the type of texture resource which bore it's name. These scheme names may be used to resolve ambiguous cases where name bindings exist in multiple schemes.
In addition to automatic generation, new materials may be defined in add-ons using material definitions. Definitions can also be used to modify the auto-generated materials.
Any time a texture resource is referenced by name at runtime, the name is instead interpreted as a material resource URI. Each known material name is associated with a unique MaterialBind. Material URIs, GUIDs and pointers are publicly visible entities (utility routines for resolving and translating between material references are available via the Doomsday Public API).
When drawing, the texture(s) to be used are then resolved (by the engine) from the mappings within the material. This includes any additional effects that are associated to the name-bound material.
- A single texture resource may be bound to many materials, however the material name must be unique in it's resource scheme.
- Materials are eternal and name bindings persist after runtime engine resets (no need to update the name bindings).
- All instances where the original texture resource names are used are now interpreted as material names (for example, associations with named texture resources in DEDs and scripts).
- Any texture resource type can be used in any draw situation (e.g., flats on walls, sprites on floors, etc...).
- Material animations are not limited to sequences of the same type of texture resources (e.g., animating from texture to flat), with optional smoothing.