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.

The tool is still in development. Please report any problems. Note that it was previously (erroneously) documented that the libraries this tool makes aren't compatible with Convexity. Please see the steps on using these libraries with Convexity.

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

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. This library is important if you are using Convexity.

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 using the Wall Worm Displacement Tool (and an upcoming version of Convexity that integrates with the Wall Worm Displacement Tool).

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.

  • You should set this to a folder called materials in your game directory or 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 materials having names that won't properly export with Convexity.

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

3ds Max 2013 Compatibility

This tool will not work properly in Max 2013 if your library is only composed of VMTs and VTFs. Until Wunderboy's VTF Plugin is available for Max 2013, you must also convert all your VTFs into TGAs before running this tool. You can do this in VTFEdit by clicking Tools > Convert Folder in VTFEdit and the Output set as To tga From *.vtf.

Tool uses two DirectX Shaders that come with 3ds Max

This tool utilizes two files that need to be in your 3ds Max installation. They should reside in your 3ds Max root > maps > fx :

  • blend_dxsas.fx
  • StandardFX.fx

If you do not have them, you may not be able to use this tool.

What textures are used?

At the initial release, the tool read the diffuse and bump textures in VMT files. Future releases will include specular and opacity.

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.

*Textures can also be missing if you try to create materials with Max and you don't have the VTF Plugin installed. (As of the release of this tool, the VTF Plugin is not yet available for Max 2013.)

Some Materials get output into the wrong Libraries

You will sometimes find model materials in the brush library, etc. This is because there are some bad assumptions in my tool to read the VMTs. I will improve this in the future.

Convexity does export the materials from this tool.

When I first built this tool, I erroneously thought that Convexity wasn't compatible with the materials this tool makes when a Bitmap is placed into the diffuse slot. That assumption was wrong. Maple 3D has informed me that the tool does work... and here is what you have to do:

  1. When Exporting VMF in Convexity, click the Options button
  2. Check the option to Use Material Names

Latest Articles

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
Sky WriterConvexity by Maple 3D

Newsletter Subscription