-
-
Notifications
You must be signed in to change notification settings - Fork 14
Materials
This plugin adds almost full VMT/VTF file support with some extensions. VMT files will be imported as regular StandardMaterial3D, except in some cases.
Note
If you create a Godot Material (*.tres) with the same name and path as a *.vmt file, the importer will use Godot's version instead.
Important
The operations below should be done only inside the specified target folder in the project settings
Project Settings -> Godot VMF -> Materials -> Target Folder
| Option | Demo |
|---|---|
| Convert TRES material into VMT and VTF: | ![]() |
| Create a VMT and VTF file from some source image: | ![]() |
| Create a blend material from two VMT files: | ![]() |
"LightmappedGeneric"
{
$roughnesstexture "path_to_vtf"
$metalnesstexture "path_to_vtf"
$ambientocclusiontexture "path_to_vtf"
$roughnessfactor 0.7
$metallnessfactor 0.3
$specularfactor 0.6
$ambientocclusionlightaffect 0.43
$detailblendmode 1 // See blend modes for detail textures of Godot Material
$emissioncolor "0 255 0 255"
$emissionenergy 10.3
$emissionoperator 0 // 0 - add, 1 - multiply
$texturefilter LINEAR_WITH_MIPMAPS // or NEAREST, LINEAR, NEAREST_WITH_MIPMAPS, NEAREST_WITH_MIPMAPS_ANISOTROPIC, LINEAR_WITH_MIPMAPS_ANISOTROPIC
$shader "path_to_shader" // This path already includes res:// and by specifying this VMT becomes a ShaderMaterial instead of StandardMaterial3D (example: '"$shader" "shaders/gds/spatial_generic.gdshader"')
$nextpass "path_to_next_pass_shader" // This path already includes res:// adds VMTShaderBasedMaterial to the `next_pass` property
}Create a singleton class named VMTExtend in @tool mode and define a function with the name of the property you want to support or override.
@tool
extends Node
func basetexture(material: Material, value: Variant):
if "albedo_texture" not in material: return;
material.albedo_texture = VTFLoader.get_texture(value);
func emissionenergy(material: Material, value: Variant):
material.emission_energy_multiplier = value;For ShaderMaterials (VMTs with $shader), all fields from the VMT will be moved directly into uniforms:
shader_type spatial;
uniform sampler2D basetexture; // albedo
uniform sampler2D selfillummask; // emission map
void fragment() {
ALBEDO = texture(basetexture, UV).rgb;
EMISSION = texture(selfillummask, UV).rgb;
}Detail props are cheap, non-solid objects that randomly emit from materials used by brushes and displacements. They fade out at a distance so are only good for small, surface-hugging features like grass and shrubs. Detail props are splitted by chunks the size which could be configured in the Project Settings. After import there will be a node called DetailProps inside the VMFNode which will contain MultiMeshInstance3D
Use case
Here's properties that should be added inside of VMT file:
LightmappedGeneric {
// ...
$detailprop "res://models/grass.mesh.res"
$detailpropdensity 0.8
$detailpropscale "4 5"
$detailpropshadows 1
// 2nd detail prop for blend materials
$detailprop2 "res://models/rock.mesh.res"
$detailpropdensity2 0.2
$detailpropscale2 "1 5"
$detailpropshadows2 1
}| Property | Type | Description |
|---|---|---|
| $detailprop | string | A path to the Mesh resource |
| $detailpropdensity | float | Instancing density. The higher value the more instances there will be per one triangle (can be more than 1) |
| $detailpropscale | Vector2 | Scale range. For each instance the scale value will be a random value within the specified range |
| $detailpropshadows | Boolean | Cast shadows |
In case you've configured TRES/RES material and want to use detail props option - just add details into the Metadata section of the material
| Step 1 | Step 2 | Step 3 |
|---|---|---|
![]() |
![]() |
![]() |





