Material Library Generator

The Material Library Generator is a tool to quickly create material libraries for use inside 3ds Max from your Source Game Engine VMT collection. The purpose of this is to allow you to use textures on your geometry that matches the materials you already have in your Source Materials collection.

What the tool does:

  1. Delves through your folders for VMT (Valve Material Files)
  2. Creates Materials based off of these VMTs
  3. Saves the Materials into libraries that can be reused at any time

The following video may be out--of-date. The documentation on this page is more up-to-date.

General Usage

To create a library, you must:

  1. Choose at least one of the three types of libraries that the tool creates: Brush Library, Blend Library and Model Library.
  2. Set a name for the Library Project
Brush Library

A brush library contains Materials that can be applied to World Brushes in Hammer. They will probably be the bulk of your materials.

Blend Library

A blend library contains Blend Materials that blend between two textures and can be applied to Displacements in Hammer. This library is important if you are making Displacements with Anvil.

Model Library

A model library contains Materials that can be applied to models. Mostly this is important for models you may have imported into 3ds Max from an SMD Importer.

Separate Libraries by Type

When on, the exporter will make a separate library for each of the types of libraries checked above. Note that before version 1.2 of the material library generator, that was the default action. Now the default is to generate one single library upon export.

Project Name

This field is where you give the export project a name. You may want to call this something that represents the collection (like cstrike, left4dead or mycustommaterials). This will help you identify the library later.

If Separate Libraries by Type is not checked, the tool will create a single material library named the same as this project name.

When you run the export and Separate Libraries by Type is checked, the tool will make 1-3 material libraries that represent the types of libraries you selected to export. The names will be in the form of Export Project Name + "_" + Library Type + ".mat". For example, if I choose to export Brush Materials and Blend Materials, and I called the export project "cstrike" then the tool will create the following material library files: cstrike_brush.mat and cstrike_blend.mat .

Folder Filter

This field lets you filter the folders used in the creation of the current library. For example, if you want to only include materials that are inside a folder called "brick", enter the phrase *brick*; only folders with the word brick in their path will be included.

  • The asterisk (*) is a wildcard symbol. You must have at least one * in this field. You must wrap your word in asterisks. (This requirement may disappear in future versions).
  • Having just an asterisk in this field may generate very large libraries, and may take very long times to generate (up to several hours).
  • You can enter multiple filters by separating them with a comma. Remember to wrap each in asterisks. For example, you could build a library off of a Bricks and Concrete folders by entering *brick*,*concrete*.
File Filter

This field lets you filter the files used in the creation of the current library. For example, if you want to only include materials that have the word "grass" in their name, enter the phrase *grass*; only folders with the word brick in their path will be included.

  • The asterisk (*) is a wildcard symbol. You must have at least one * in this field. You must wrap your word in asterisks. (This requirement may disappear in future versions).
  • Having just an asterisk in this field may generate very large libraries, and may take very long times to generate (up to several hours).
  • You can enter multiple filters by separating them with a comma. Remember to wrap each in asterisks.For example, you could build a library that only includes VMTs that have the words "wall" or "ceiling" in them by entering *wall*,*ceiling*.
Material Root

This button lets you set the root folder for where your materials are stored. Note that it should not be confused with the material root of Wall Worm Model Tools.

  • This folder and subfolders must be writable by the User group in Windows.
  • For mod teams where you are using WW Pro and the VTF files are not inside a VPK, you should set this to a folder called materials in your game directory; otherwise, set to a folder that packages all folders that would otherwise be found in a Source mod's materials. For example, if you have unpackaged a GCF file with GCFScape to have a collection of materials inside this directory: E:\Textures\source\materials (in which are folders called Brick, Nature, etc). you would make sure to set this to E:\Textures\source\materials and not to directories above or below the materials folder.
  • Choosing a folder at the wrong depth will result in missing materials.
Recursive

This setting will allow the tool to gather materials from subfolders of the root folders.

Force MAXscript

This function will force the VMT parser to use MAXScript instead of the .NET tools that come with WW Pro. The option does nothin in the free version of WW. Generally, this option should be off unless there is a bug with parsing a specific material with the WW Pro version.

Use Game/VPK

This option will force the importer to use the original VMT/VTF files in the current game's material folders and inside the VPK (instead of using extracted materials in the Material Library Generator root). This option only works in 3ds Max 2015+. For Max 2015+, you probably want this option on unless the assets you are using are extracted to the MatGen Root and are not yet in the game folders.

Default Colors

Each library has a default color applied to the diffuse slot of the material. This is will help you quickly differentiate the types of materials in the viewport. This default color will also appear in renders if the texture used by the material is missing and/or of a file type 3ds Max doesn't understand*.

Creating Libraries

You can create libraries by clicking the Create button. When you do this, you will either see a notice that the required info isn't provided above, or a prompt to choose a root material directory.

Note: You should choose the root Material folder where you have VMT files. The root folder should be akin to the "materials" folder of your mod. For example, if I want to make a library of all my textures in Counter-Strike, I would browse to a folder like this:

C:\Program Files (x86)\Steam\steamapps\mySteamName\counter-strike source\cstrike\materials

If you are making a collection from a folder that isn't inside of an active mod, the same rule should apply! For example, if you have unpacked the GCF files containing all the materials for your games/mods into a central location, you should still delve to the root material folder in that directory.

Please be aware that the process can take several minutes if you choose a location that has many directories and/or has a lot of VMT files. It can appear that Max is frozen. You should just wait for the process to finish. (If you feel that it is taking too long, you can hold down ESC to try to break out of the process.)

Considerations and Notes

Library Size

When importing materials, it's a good idea to organize your materials into groups of materials. Do not import your entire Source materials folder into a single material library--because doing so makes material libraries that are unnecessarily slow when opening in the material library. Instead, make libraries of material groups. One strategy is to import each main subfolder in Materials into a single material library (for example, import just the Brick folder as the Brick library).

Texture Support

If you do not have Wall Worm Pro installed, you must also convert all your VTFs into TGAs before running this tool if not using the Use Game/VPK setting. You can do this in VTFEdit by clicking Tools > Convert Folder in VTFEdit and the Output set as To tga From *.vtf. If you do not do this, no textures will import. Wall Worm Pro has native VTF support.

Where are the Material Libraries Saved?

The material libraries are saved into the currently active project's Material Libraries folder. By default (if you haven't changed the project folder inside Max), this is usually inside your Documents Folder > 3ds Max > materiallibraries .

Materials are DirectX Materials with Standard Materials as the Render Material

The material applied is a DirectX Material that allows the textures to be displayed in the viewport more like they will appear in-game. Unfortunately, you may not always see the materials in the viewport.

The textures may not show up if you have made a library that has VMTs that reference textures that were not in the folders that the Library Generator checked. The most likely reason for this is that a custom VMT references a core texture that is packed inside a GCF file.

Some properties are not collected

Some properties are missing when imported. Most VMT parameters are now collected into the materials, but some properties may still be missing. If you have a problem VMT, please send it to us to analyze. Materials that utilize the $include command do not currently get data from the $include. This limitation may change in the future.

Latest Articles

Bitmaps to Materials

Posted on Apr 5, 2016 | Last Updated Dec 19, 2016

Information on creating substance-driven material libraries and generating tri-planar projection textures without need for UV mapping.

Read More

substance, bitmap2material, triplanar, blended mapping, blended projection, uvw, material library

Importing WAD Files

Posted on Feb 10, 2015 | Last Updated May 2, 2016

Instructions on using the WAD importer in Wall Worm to bring WAD files from Goldsrc into 3ds Max.

Read More

wad, xwad, importer

Source Shader Settings

Posted on Jun 9, 2013 | Last Updated May 16, 2017

Control many Source VMT parameters directly inside 3ds Max.

Read More

vmt, parameters, source shader

Brush Materials have incorrect rotation and scale when using the DirectX Shader

Posted on Apr 10, 2012 | Last Updated Apr 10, 2012

The Wall Worm Material Library Generator originally created DirectX Materials for all materials. But updates to the VMF Exporter changed the way materials are interpretted. Whenever possible, you should not use DirectX Materials.

Read More

material, bug, directx shader, rotation, scale