Material Files

From The DarkMod Wiki
Revision as of 06:20, 14 September 2006 by Greebo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Originally written by Fingernail & greebo on http://forums.thedarkmod.com/topic/127

What the Heck is a Material File?

The material files tell the engine, where to find the source files of the specified texture and what features it should have. If you're using the texture textures/darkmod/wall in your map, Doom looks up the name in the material definition and loads the according files.

A single material file can contain multiple material definitions. This is useful as textures that logically belong to each other (e.g. several wall textures) can be summarized in one material file (e.g. materials/darkmod_walls.mtr)

The .mtr files are read upon launching Doom 3 - changing your material file therefore requires restarting Doom.

Create a new Texture Definition

Provided you already saved your texture source file (the .tga or .dds) in the appropriate folder, you can go on and create your texture definition.

Open up or create your personal material file (it's stored in the materials/ folder, extension: .mtr) with your preferred text editor.

First, specify the name of your new material. It must start with 'textures' as the root, for example:

textures/darkmod/custom/wall1

Then, open up a squiggly bracket ({), and start to fill in the texture paths as below, changing the paths and names for your texture.

textures/darkmod/custom/wall1
{
        qer_editorimage  textures/darkmod/custom/wall1_ed.tga     //editor image
        diffusemap       textures/darkmod/custom/wall1_d.tga      //diffuse map
        normalmap        textures/darkmod/custom/wall1_local.tga  //normal map
        specularmap      textures/darkmod/custom/wall1_s.tga      //specular map
}

Use Tabs to seperate the single parts from each other. Close the definition with a close squiggly bracket (}).

Save the file. Now you can load your new texture in DoomEdit or DarkRadiant provided you did it all correctly.

Alternatively you can also have a look a the existing material files and learn from them.

See also