From Pragma
Jump to: navigation, search


Materials in Pragma have the extension ".wmi" ("Weave Material Information") and can be found in the "materials" sub-directory. They can be opened and edited in a text-editor.
Material files contain a reference to at least 1 texture, as well as additional meta-information depending on the shader.
In general all textures on models, world geometry, particles and GUI elements have to be defined through a material.

A material file generally looks like this:

"particle" // The shader to use. This also depends on the context of where the rendering with the textures from this material takes place
	$texture diffusemap "particles/fire_sprites_v1" // The main texture
	animation // This block is to define an animated texture
		$int offset 0
		$int frames 64
		$int fps 46
		$int columns 8
		$int rows 8

There are no limitations on the resolution of the images, however it is highly recommended to only use resolutions of powers of two. (e.g. 128x128, 1024x512, etc.)

It is also worthy to note that you cannot use .png or .vtf-textures for cubemaps (e.g. skybox-textures, see the $cubemap material-parameter).


A texture is an actual image-file. It contains the actual image, and, depending on the format, the mipmaps for the image.
Supported image formats are: .ktx, .dds, .png, .vtf and .tga. Which format you should use depends on what you intend to use the texture for:

  • .png-files should only be used for images which very detailed alpha-channels. E.g. when using images for particle effects or GUI elements.
  • .ktx-files should be used in all other cases. They support compressed images, which is optimal for the GPU.
  • .dds-files are supported, but should only be used if .ktx-files are unavailable for some reason.
  • .vtf-files should be avoided if possible. Supported internal formats are: R8G8B8, R8G8B8A8, DXT1, DXT3 and DXT5.
  • .tga-files are supported, but should be avoided as well.

The preferred order is thus: .ktx > .dds > .png > .vtf > .tga


The first thing that has to be defined in every material is a shader. That's the string above the first data block.
The parameters you need to use are dependent on the shader, although a lot of the parameters behave the same between shaders.
You can find more information about shaders here.

Material Parameters

Each parameter in a material is specified as "$<type> <key> <value>", for instance:

$texture diffusemap "nature/leafgrass01"

The type that should be used is dependent on the parameter. Available types are:

  • $bool: 1/0, or true/false
  • $int
  • $float
  • $string
  • $texture: Any texture associated with this type will automatically be precached once the material is loaded.
  • $cubemap: Same as texture, but is specifically used for cubemaps, e.g. skyboxes. Not supported for .png and .vtf-textures!

You can find a list of available material parameters here.
Alternatively you can use .vmt-files from the source engine, which pragma will attempt to convert automatically during runtime. This is not recommended!

See Also