Blender VertexLitGeneric

thumb|The nodegroup in shader editor
thumb|The hl2 combine soldier using BlenderVertexLitGeneric
 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
== 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.
 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 ==
# Install Blender 2.80 or later. Or [steam://rungameid/365670 Install from Steam] (AppID: 365670)
# Download the file on GitHub.
# open the .blend library file
# File->Defaults->Save Startup File
== See also ==
* Materials for models
* VertexLitGeneric, the shader this tool recreates
* VertexLitGeneric OSL, an alternative Blender shader for the Cycles ray-tracing engine
* Blender Source Tools for import/export of SMD/DMX files
Category:Blender Category:Material_System Category:Shaders Category:Third Party Tools