Blender VertexLitGeneric

From Valve Developer Community
Jump to: navigation, search
The nodegroup in shader editor
The hl2 combine soldier using BlenderVertexLitGeneric

Blender VertexLitGeneric Blender VertexLitGeneric allows real time creation of VMT-type materials within Blender. Specifically the VertexLitGeneric shader for models. it also comes with an experimental VMT compiler named VMTgen

Blank image.pngTodo: Add Usage section, point out differences, add references from other pages and clean up this page

Features

  • basetexture
  • bumpmap
  • envmap, with options
  • phong, with options
  • alphatest, with options
  • selfillum
  • rimlight
  • lightwarptexture

VMTgen

VMTgen is a command working with BVLG to automatically compile a VMT from the current setup

it exports a file for each material, automatically naming the file with the name of the blender material it is derived from, and places them in a specified folder (//export/) by default

a cdmaterials string must be specified, and texture paths are assumed to be cdmaterials + name of the texture with the extension removed.

Usage:

to use VMTgen, open up a python console or head to the scripting workspacethen activate the script with

BVLG = bpy.data.texts["BVLG_VMTgen.py"].as_module()

you can now use the following commands:

BVLG.VMTgen(mat, cdmaterials, folder, mode)
mat
the name of the material to be compiled
cdmaterials
the prefix path for textures, assumed to be the same as defined in the object's QC
folder
the folder in which compiled VMTs are placed. //export/ by default
mode
"name" if mat is a string with the name of the material, "data" if it is the python material data : bpy.data.materials[]. "name" by default
to compile a single material
An invalid setup may give unexpected results. a VMT will be generated as long as there is a VertexLitGeneric node directly connected to the material output
It must strictly comply with the way BVLG is intended: node links can only be in sockets marked [texture] and must be directly tied to a texture.
Note.pngNote:having an invalid or leaving empty the $basetexture socket will not load a $basetexture in the compiled VMT whereas a blank or invalid $bumpmap will automatically load /dev/normal_blank if needed by phong
BVLG.AutoVMTgen(cdmaterials, folder, mode)
cdmaterials
the prefix path for textures, assumed to be the same as defined in the object's QC
folder
the folder in which compiled VMTs are placed. //export/ by default
mode
"name" if mat is a string with the name of the material, "data" if it is the python material data : bpy.data.materials[]. "name" by default
to compile all materials with a suitable Node setup
the tool will cycle through all materials loaded in the blender file, but only attempt to compile those that have a VertexLitGeneric node present

limitations

VMTgen currently only supports leftward propagation of BVLG nodes. Simply put, lightwarp and alphatest are completely ignored.
Due to inaccuracies in BVLG, the compiled material may look different to the one seen in blender. I can only apologize until these inaccuracies are fixed.
Anything more complicated than a direct texture or field has not been implemented, so even if it seems obviously feasible it just won't work any other way, yet.
Textures and VMT files still have to be manually placed in the correct folders.

Installation

  1. Install Blender 2.80 or later. Or Install from Steam (AppID: 365670)
  2. Download the file on GitHub.
  3. open the .blend library file
  4. File->Defaults->Save Startup File

See also