Material Files: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
m added note about file extension
Line 8: Line 8:
  textures/darkmod/custom/wall1
  textures/darkmod/custom/wall1
   {
   {
           qer_editorimage  textures/darkmod/custom/wall1_ed.tga   
           qer_editorimage  textures/darkmod/custom/wall1_ed
           diffusemap      textures/darkmod/custom/wall1_d.tga     
           diffusemap      textures/darkmod/custom/wall1_d    
           normalmap        textures/darkmod/custom/wall1_local.tga  
           normalmap        textures/darkmod/custom/wall1_local   
           specularmap      textures/darkmod/custom/wall1_s.tga     
           specularmap      textures/darkmod/custom/wall1_s    
   }
   }


 
If you're using the texture called '''textures/darkmod/custom/wall1''' in your map, Doom looks up the name in the material definition and loads the according files. Note that you '''don't''' need to specify the file extension, the engine is automatically adding it (depending on your quality setting) and finds the according texture file.
If you're using the texture called '''textures/darkmod/custom/wall1''' in your map, Doom looks up the name in the material definition and loads the according files.  


A single material file contains lots of 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''')
A single material file contains lots of 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''')
Line 34: Line 33:
  textures/darkmod/stone/brick/redbrick_wall1
  textures/darkmod/stone/brick/redbrick_wall1
  {
  {
         qer_editorimage  textures/darkmod/stone/brick/redbrick_wall1_ed.tga    //editor image
         qer_editorimage  textures/darkmod/stone/brick/redbrick_wall1_ed   //editor image
         diffusemap      textures/darkmod/stone/brick/redbrick_d.tga           //diffuse map
         diffusemap      textures/darkmod/stone/brick/redbrick_d          //diffuse map
         normalmap        textures/darkmod/stone/brick/redbrick_local.tga       //normal map
         normalmap        textures/darkmod/stone/brick/redbrick_local      //normal map
         specularmap      textures/darkmod/stone/brick/redbrick_s.tga           //specular map
         specularmap      textures/darkmod/stone/brick/redbrick_s          //specular map
  }
  }



Revision as of 20:28, 30 May 2007

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

What the Heck is a Material File?

The material files (extension .mtr) contain lists of 'material definitions' that tell the engine where to find the source files for the specified textures and what features it should have. All material files should be located in the darkmod/materials folder.

Material definitions apply to a single 'texture', though it may be made up of multiple texture files blended together. A simple material definition looks like this:

textures/darkmod/custom/wall1
 {
         qer_editorimage  textures/darkmod/custom/wall1_ed
         diffusemap       textures/darkmod/custom/wall1_d     
         normalmap        textures/darkmod/custom/wall1_local  
         specularmap      textures/darkmod/custom/wall1_s     
 }

If you're using the texture called textures/darkmod/custom/wall1 in your map, Doom looks up the name in the material definition and loads the according files. Note that you don't need to specify the file extension, the engine is automatically adding it (depending on your quality setting) and finds the according texture file.

A single material file contains lots of 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. You cannot use your textures without this step.

Open up or create your personal material file with a text editor. There are existing guidelines for where texture definitions should go, for the sake of organization, but the engine doesn't care what the filename is as long as it's in the materials folder and has a .mtr extension.

First, specify the name of your new material. If it is not a model texture, then the name should include the path to the texture files used. Example:

textures/darkmod/stone/brick/redbrick_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/stone/brick/redbrick_wall1
{
        qer_editorimage  textures/darkmod/stone/brick/redbrick_wall1_ed    //editor image
        diffusemap       textures/darkmod/stone/brick/redbrick_d           //diffuse map
        normalmap        textures/darkmod/stone/brick/redbrick_local       //normal map
        specularmap      textures/darkmod/stone/brick/redbrick_s           //specular map
}

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