Material System/Materials

From Equilibrium Engine Wiki
Jump to navigation Jump to search

A material is a .mat key-values text file that defines a two-dimensional surface. It contains all of the information needed for engine to simulate the surface visually, aurally, and physically.

The contents of a material will fall into some or all of these categories:

  1. Texture names
  2. Physical surface types
  3. Shader parameters
  4. Special compile properties
  5. Fallbacks
  6. Proxies

Simple Example

"Base" 
{ 
	BaseTexture 	"grass/grass_lawn" usage:diffuse;
	surfaceprops 	"grass"; 
};

This is a very basic grass ground material.

  1. The Base shader is used, which means that the material is for use on surfaces of static models.
  2. The { character opens a set of parameters
  3. The BaseTexture parameter is given with grass/grass_lawn, which is the location of a texture. This is what will be drawn on the screen.
  4. surfaceprops gives the material the physical properties of grass.
  5. The } character closes a set of parameters

It's important to remember that this material can only be used on static world models. If it needed to be used on models, for instance, another version would need to be created using the BaseSkinned shader.

Most of the time switching materials from one shader to another is as simple as changing their first line, since a great number of parameters are shared between them. Some params only work with certain shaders, like Variation effects, which are only available with Base, but unfortunately you won't encounter any critical errors if a param isn't understood by the shader. It just won't have any effect.

See also

Creating a material

Supported texture formats

Shaders