Material Types

 

Version 1.00 – Friday 13th June 2003 – John J Scott

 

Materials are defined by .mtt files in the base/materials/ folder. The name of the file is the name of the material (eg. “materials/sand.mtt” is called “sand”).

 

A .mtt file looks like this –

 

materialType

{

            description        “A phrase that describes this material type”

            rgb                   r,g,b

}

 

The r, g and b components are defined as 0 to 255. (eg. 255,0,0 would be bright red)

 

The material type can be defined in the material in 2 ways –

  1. The keyword “materialType”

 

The following material would have the material type of “concrete”

 

textures/wall/texture

{

qer_editorimage            textures/wall/texture_d

 

            materialType              concrete

 

bumpmap                     addnormals ( textures/wall/texture_local, heightmap ( textures/wall/texture_h, 1 ) )

diffusemap                    textures/wall/texture_d

specularmap                 textures/wall/texture_s

}

 

  1. The keyword “materialImage” can be used to specify an image to indirect into. The rgb values in the material image are compared with the rgb values defined in the .mtt files to define the material type. Eg. A window frame would have material type wood wherever the frame was, and material type glass wherever the glass was.

 

The following material will use the hit image map “textures/wall/texture_hit” to work out the material type, but return metal should the hit image not yield a valid material.

 

textures/wall/texture

{

qer_editorimage            textures/wall/texture_d

 

            materialType              metal

            materialImage            textures/wall/texture_hit

 

bumpmap                     addnormals ( textures/wall/texture_local, heightmap ( textures/wall/texture_h, 1 ) )

diffusemap                    textures/wall/texture_d

specularmap                 textures/wall/texture_s

}

 

The currently defined materials are –

 

Material Type

RGB Value

 

 

None

0,0,0

Solidmetal

178,178,178

HollowMetal

102,102,102

Sand

255,255,0

Flesh

204,102,102

 

 

Notes -

  1. There are no limits to the dimensions of the material type image. However, using half the width and height would be a good balance of accuracy vs. memory. If more accuracy is required, go up to the same size. There is no gain (and hence no point) in going larger than the material the hit image will be applied to.
  2. If the exact rgb values are used, loading up the hit images will be quick. It will check for the nearest match, but this takes a little longer.
  3. Generally, use a realistic colour for the material type. This way, the diffuse map will work naturally as a quick and dirty starting point. For example, flesh is pink so that any pink found on a hit material image will return a material type of flesh.
  4. Try to keep a good separation of material type rgb values. Having two very close together makes the hit images harder to edit.