Blender VertexLitGeneric: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page for my BVLG, added 2 images, Features, quick install guide)
 
m (Added "Shader Name" tmpl)
 
(5 intermediate revisions by 4 users not shown)
Line 2: Line 2:
[[File:Blender-combineusingVertexLitGeneric.JPG|thumb|The hl2 combine soldier using BlenderVertexLitGeneric]]
[[File:Blender-combineusingVertexLitGeneric.JPG|thumb|The hl2 combine soldier using BlenderVertexLitGeneric]]


{{blender}} '''BlenderVertexLitGeneric''' allows creation of VMT-type materials within [[Blender]]. Specifically the [[VertexLitGeneric]] shader for models.
{{blendervertexlit|4.1}} allows real time creation of [[VMT]]-type materials within [[Blender]]. Specifically the {{Shader_Name|VertexLitGeneric}} shader for models.
it also comes with an experimental VMT compiler named VMTgen


{{todo|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


{{todo|Add Usage section, point out differences and make a guide for creating [[VMT]] out of BVLG}}
== VMTgen ==
== Features ==
VMTgen is a command working with BVLG to automatically compile a VMT from the current setup
Most commons effects:
 
* Basetexture
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
* Bumpmap
 
* Envmap
a cdmaterials string must be specified, and texture paths are assumed to be cdmaterials + name of the texture with the extension removed.
* Phong (inlcuding phongexponenttexture)
 
* Alphatest
===Usage:===
* Selfillum
to use VMTgen, open up a python console or head to the scripting workspacethen activate the script with
; <code>BVLG = bpy.data.texts["BVLG_VMTgen.py"].as_module()</code>
 
you can now use the following commands:
 
BVLG.VMTgen(mat, cdmaterials, folder, mode)
:; <code>mat</code>
:: the name of the material to be compiled
:; <code>cdmaterials</code>
:: the prefix path for textures, assumed to be the same as defined in the object's [[QC]]
:; <code>folder</code>
:: the folder in which compiled VMTs are placed. <code>//export/</code> by default
:; <code>mode</code>
:: "name" if mat is a string with the name of the material, "data" if it is the python material data : <code>bpy.data.materials[]</code>. "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|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 <code>/dev/normal_blank</code> if needed by phong}}
 
BVLG.AutoVMTgen(cdmaterials, folder, mode)
:; <code>cdmaterials</code>
:: the prefix path for textures, assumed to be the same as defined in the object's [[QC]]
:; <code>folder</code>
:: the folder in which compiled VMTs are placed. <code>//export/</code> by default
:; <code>mode</code>
:: "name" if mat is a string with the name of the material, "data" if it is the python material data : <code>bpy.data.materials[]</code>. "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 ==
== Installation ==


# [http://www.blender.org/download/ Install Blender 2.80 or later.] Or [steam://rungameid/365670 Install from Steam] (AppID: 365670)
# [http://www.blender.org/download/ Install Blender 2.80 or later.] Or [steam://rungameid/365670 Install from Steam] (AppID: 365670)
# [https://github.com/syborg64/BlenderVertexLitGeneric Download the file on GitHub.]
# [https://github.com/syborg64/BlenderVertexLitGeneric Download the file on GitHub.]
# open the .blend librairy file
# open the .blend library file
# File->Defaults->Save Startup File
# File->Defaults->Save Startup File


== See also ==
== See also ==
* [[Materials_for_models#Compiling_your.VMT_:_Valve_Material_Type|Materials for models]]
* [[Materials_for_models#Compiling_your.VMT_:_Valve_Material_Type|Materials for models]]
* [[VertexLitGeneric]], the shader this tool is for
* [[VertexLitGeneric]], the shader this tool recreates
* [https://git.sr.ht/~b5327157/tf2-blender/tree/HEAD/VertexLitGeneric.md VertexLitGeneric OSL], an alternative Blender shader for the Cycles ray-tracing engine
* [[Blender Source Tools]] for import/export of SMD/DMX files
* [[Blender Source Tools]] for import/export of SMD/DMX files
 
{{sdktools|0}}
[[Category:Blender]] [[Category:Material_System]] [[Category:Shaders]] [[Category:Third Party Tools]]
[[Category:Blender]] [[Category:Material_System]] [[Category:Shaders]] [[Category:Third Party Tools]]

Latest revision as of 08:43, 13 May 2025

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 Shader-ball.png VertexLitGeneric shader for models. it also comes with an experimental VMT compiler named VMTgen

Todo: 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