Difference between revisions of "Material Flags"

From Valve Developer Community
Jump to: navigation, search
($flags)
(converted values to human readable form)
 
Line 17: Line 17:
 
| '''Flag''' || '''Value''' || '''Comment'''
 
| '''Flag''' || '''Value''' || '''Comment'''
 
|-
 
|-
| MATERIAL_VAR_DEBUG || 0x0001 ||  
+
| MATERIAL_VAR_DEBUG || 1||  
 
|-
 
|-
| MATERIAL_VAR_NO_DEBUG_OVERRIDE || 0x0002 ||  
+
| MATERIAL_VAR_NO_DEBUG_OVERRIDE || 2||  
 
|-
 
|-
| MATERIAL_VAR_NO_DRAW || 0x0004 ||  
+
| MATERIAL_VAR_NO_DRAW || 4||  
 
|-
 
|-
| MATERIAL_VAR_USE_IN_FILLRATE_MODE || 0x0008 ||  
+
| MATERIAL_VAR_USE_IN_FILLRATE_MODE || 8||  
 
|-
 
|-
| MATERIAL_VAR_VERTEXCOLOR || 0x0010 || [[$vertexalpha]]
+
| MATERIAL_VAR_VERTEXCOLOR || 16|| [[$vertexalpha]]
 
|-
 
|-
| MATERIAL_VAR_VERTEXALPHA || 0x0020 || [[$vertexalpha]]
+
| MATERIAL_VAR_VERTEXALPHA || 32|| [[$vertexalpha]]
 
|-
 
|-
| MATERIAL_VAR_SELFILLUM || 0x0040 || [[$selfillum]]
+
| MATERIAL_VAR_SELFILLUM || 64|| [[$selfillum]]
 
|-
 
|-
| MATERIAL_VAR_ADDITIVE || 0x0080 ||  
+
| MATERIAL_VAR_ADDITIVE || 128||  
 
|-
 
|-
| MATERIAL_VAR_ALPHATEST || 0x0100 || [[$alphatest]]
+
| MATERIAL_VAR_ALPHATEST || 256|| [[$alphatest]]
 
|-
 
|-
| MATERIAL_VAR_MULTIPASS || 0x0200 ||  
+
| MATERIAL_VAR_MULTIPASS || 512||  
 
|-
 
|-
| MATERIAL_VAR_ZNEARER || 0x0400 ||  
+
| MATERIAL_VAR_ZNEARER || 1024||  
 
|-
 
|-
| MATERIAL_VAR_MODEL || 0x0800 || [[$model]]
+
| MATERIAL_VAR_MODEL || 2048|| [[$model]]
 
|-
 
|-
| MATERIAL_VAR_FLAT || 0x1000 ||  
+
| MATERIAL_VAR_FLAT || 4096||  
 
|-
 
|-
| MATERIAL_VAR_NOCULL || 0x2000 || [[$nocull]]
+
| MATERIAL_VAR_NOCULL || 8192|| [[$nocull]]
 
|-
 
|-
| MATERIAL_VAR_NOFOG || 0x4000 || [[$nofog]]
+
| MATERIAL_VAR_NOFOG || 16384|| [[$nofog]]
 
|-
 
|-
| MATERIAL_VAR_IGNOREZ || 0x8000 || [[$ignorez]]
+
| MATERIAL_VAR_IGNOREZ || 32768|| [[$ignorez]]
 
|-
 
|-
| MATERIAL_VAR_DECAL || 0x10000 ||  
+
| MATERIAL_VAR_DECAL || 65536||  
 
|-
 
|-
| MATERIAL_VAR_ENVMAPSPHERE || 0x20000 ||  
+
| MATERIAL_VAR_ENVMAPSPHERE || 131072||  
 
|-
 
|-
| MATERIAL_VAR_NOALPHAMOD || 0x40000 ||  
+
| MATERIAL_VAR_NOALPHAMOD || 262144||  
 
|-
 
|-
| MATERIAL_VAR_ENVMAPCAMERASPACE || 0x80000 ||  
+
| MATERIAL_VAR_ENVMAPCAMERASPACE || 524288||  
 
|-
 
|-
| MATERIAL_VAR_BASEALPHAENVMAPMASK || 0x100000 ||  
+
| MATERIAL_VAR_BASEALPHAENVMAPMASK || 1048576||  
 
|-
 
|-
| MATERIAL_VAR_TRANSLUCENT || 0x200000 || [[$translucent]]
+
| MATERIAL_VAR_TRANSLUCENT || 2097152|| [[$translucent]]
 
|-
 
|-
| MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK || 0x400000 ||  
+
| MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK || 4194304||  
 
|-
 
|-
| MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING || 0x800000 ||  
+
| MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING || 8388608||  
 
|-
 
|-
| MATERIAL_VAR_OPAQUETEXTURE || 0x1000000 ||  
+
| MATERIAL_VAR_OPAQUETEXTURE || 16777216||  
 
|-
 
|-
| MATERIAL_VAR_ENVMAPMODE || 0x2000000 ||  
+
| MATERIAL_VAR_ENVMAPMODE || 33554432||  
 
|-
 
|-
| MATERIAL_VAR_SUPPRESS_DECALS || 0x4000000 ||  
+
| MATERIAL_VAR_SUPPRESS_DECALS || 67108864||  
 
|-
 
|-
| MATERIAL_VAR_HALFLAMBERT || 0x8000000 || [[Half Lambert]]
+
| MATERIAL_VAR_HALFLAMBERT || 134217728|| [[Half Lambert]]
 
|-
 
|-
| MATERIAL_VAR_WIREFRAME || 0x10000000 ||  
+
| MATERIAL_VAR_WIREFRAME || 268435456||  
 
|-
 
|-
| MATERIAL_VAR_ALLOWALPHATOCOVERAGE || 0x20000000 ||  
+
| MATERIAL_VAR_ALLOWALPHATOCOVERAGE || 536870912||  
 
|-
 
|-
| MATERIAL_VAR_IGNORE_ALPHA_MODULATION || 0x40000000 ||  
+
| MATERIAL_VAR_IGNORE_ALPHA_MODULATION || 1073741824||  
 
|}
 
|}
  
Line 86: Line 86:
 
| '''Flag''' || '''Value''' || '''Comment'''
 
| '''Flag''' || '''Value''' || '''Comment'''
 
|-
 
|-
| MATERIAL_VAR2_LIGHTING_UNLIT || 0x0000 ||
+
| MATERIAL_VAR2_LIGHTING_UNLIT || 0||
 
|-
 
|-
| MATERIAL_VAR2_LIGHTING_VERTEX_LIT || 0x0001 ||
+
| MATERIAL_VAR2_LIGHTING_VERTEX_LIT || 1||
 
|-
 
|-
| MATERIAL_VAR2_LIGHTING_LIGHTMAP0 || 0x0002 ||
+
| MATERIAL_VAR2_LIGHTING_LIGHTMAP0 || 2||
 
|-
 
|-
| MATERIAL_VAR2_LIGHTING_BUMPED_LIGHTMAP || 0x0004 ||
+
| MATERIAL_VAR2_LIGHTING_BUMPED_LIGHTMAP || 4||
 
|-
 
|-
| MATERIAL_VAR2_LIGHTING_MASK || 0x0001 + 0x0002 + 0x0004 ||
+
| MATERIAL_VAR2_LIGHTING_MASK || 7 || Sum of 3 above
 
|-
 
|-
| MATERIAL_VAR2_DIFFUSE_BUMPMAPPED_MODEL || 0x0008 ||
+
| MATERIAL_VAR2_DIFFUSE_BUMPMAPPED_MODEL || 8||
 
|-
 
|-
| MATERIAL_VAR2_USES_ENV_CUBEMAP || 0x0010 ||
+
| MATERIAL_VAR2_USES_ENV_CUBEMAP || 16||
 
|-
 
|-
| MATERIAL_VAR2_NEEDS_TANGENT_SPACES || 0x0020 ||
+
| MATERIAL_VAR2_NEEDS_TANGENT_SPACES || 32||
 
|-
 
|-
| MATERIAL_VAR2_NEEDS_SOFTWARE_LIGHTING || 0x0040 ||
+
| MATERIAL_VAR2_NEEDS_SOFTWARE_LIGHTING || 64||
 
|-
 
|-
| MATERIAL_VAR2_BLEND_WITH_LIGHTMAP_ALPHA || 0x0080 ||
+
| MATERIAL_VAR2_BLEND_WITH_LIGHTMAP_ALPHA || 128||
 
|-
 
|-
| MATERIAL_VAR2_NEEDS_BAKED_LIGHTING_SNAPSHOTS || 0x0100 ||
+
| MATERIAL_VAR2_NEEDS_BAKED_LIGHTING_SNAPSHOTS || 256||
 
|-
 
|-
| MATERIAL_VAR2_USE_FLASHLIGHT || 0x0200 ||
+
| MATERIAL_VAR2_USE_FLASHLIGHT || 512||
 
|-
 
|-
| MATERIAL_VAR2_USE_FIXED_FUNCTION_BAKED_LIGHTING || 0x0400 ||
+
| MATERIAL_VAR2_USE_FIXED_FUNCTION_BAKED_LIGHTING || 1024||
 
|-
 
|-
| MATERIAL_VAR2_NEEDS_FIXED_FUNCTION_FLASHLIGHT || 0x0800 ||
+
| MATERIAL_VAR2_NEEDS_FIXED_FUNCTION_FLASHLIGHT || 2048||
 
|-
 
|-
| MATERIAL_VAR2_USE_EDITOR || 0x1000 ||
+
| MATERIAL_VAR2_USE_EDITOR || 4096||
 
|-
 
|-
| MATERIAL_VAR2_NEEDS_POWER_OF_TWO_FRAME_BUFFER_TEXTURE || 0x2000 ||
+
| MATERIAL_VAR2_NEEDS_POWER_OF_TWO_FRAME_BUFFER_TEXTURE || 8192||
 
|-
 
|-
| MATERIAL_VAR2_NEEDS_FULL_FRAME_BUFFER_TEXTURE || 0x4000 ||
+
| MATERIAL_VAR2_NEEDS_FULL_FRAME_BUFFER_TEXTURE || 16384||
 
|-
 
|-
| MATERIAL_VAR2_IS_SPRITECARD || 0x8000 ||
+
| MATERIAL_VAR2_IS_SPRITECARD || 32768||
 
|-
 
|-
| MATERIAL_VAR2_USES_VERTEXID || 0x10000 ||
+
| MATERIAL_VAR2_USES_VERTEXID || 65536||
 
|-
 
|-
| MATERIAL_VAR2_SUPPORTS_HW_SKINNING || 0x20000 ||
+
| MATERIAL_VAR2_SUPPORTS_HW_SKINNING || 131072||
 
|-
 
|-
| MATERIAL_VAR2_SUPPORTS_FLASHLIGHT || 0x40000 ||
+
| MATERIAL_VAR2_SUPPORTS_FLASHLIGHT || 262144||
 
|}
 
|}
 
   
 
   

Latest revision as of 17:19, 30 November 2019

Material $flags and $flags2 parameters control how the material is rendered. $flag can be changed in real-time to allow changes in rendering, but $flags2 is read-only and assists the engine or other code in using the material correctly. Enumerations found in https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/public/materialsystem/imaterial.h

The flags can also be set via the .vmt Example:

#Sets the MATERIAL_VAR_VERTEXCOLOR and MATERIAL_VAR_VERTEXALPHA flag
UnlitGeneric
{
$basetexture brick/brickwall003a
$vertexcolor 1
$vertexalpha 1
}

$flags

$flags can contain the following flags:

Flag Value Comment
MATERIAL_VAR_DEBUG 1
MATERIAL_VAR_NO_DEBUG_OVERRIDE 2
MATERIAL_VAR_NO_DRAW 4
MATERIAL_VAR_USE_IN_FILLRATE_MODE 8
MATERIAL_VAR_VERTEXCOLOR 16 $vertexalpha
MATERIAL_VAR_VERTEXALPHA 32 $vertexalpha
MATERIAL_VAR_SELFILLUM 64 $selfillum
MATERIAL_VAR_ADDITIVE 128
MATERIAL_VAR_ALPHATEST 256 $alphatest
MATERIAL_VAR_MULTIPASS 512
MATERIAL_VAR_ZNEARER 1024
MATERIAL_VAR_MODEL 2048 $model
MATERIAL_VAR_FLAT 4096
MATERIAL_VAR_NOCULL 8192 $nocull
MATERIAL_VAR_NOFOG 16384 $nofog
MATERIAL_VAR_IGNOREZ 32768 $ignorez
MATERIAL_VAR_DECAL 65536
MATERIAL_VAR_ENVMAPSPHERE 131072
MATERIAL_VAR_NOALPHAMOD 262144
MATERIAL_VAR_ENVMAPCAMERASPACE 524288
MATERIAL_VAR_BASEALPHAENVMAPMASK 1048576
MATERIAL_VAR_TRANSLUCENT 2097152 $translucent
MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK 4194304
MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING 8388608
MATERIAL_VAR_OPAQUETEXTURE 16777216
MATERIAL_VAR_ENVMAPMODE 33554432
MATERIAL_VAR_SUPPRESS_DECALS 67108864
MATERIAL_VAR_HALFLAMBERT 134217728 Half Lambert
MATERIAL_VAR_WIREFRAME 268435456
MATERIAL_VAR_ALLOWALPHATOCOVERAGE 536870912
MATERIAL_VAR_IGNORE_ALPHA_MODULATION 1073741824

$flags2

$flags2 can contain the following flags:

Flag Value Comment
MATERIAL_VAR2_LIGHTING_UNLIT 0
MATERIAL_VAR2_LIGHTING_VERTEX_LIT 1
MATERIAL_VAR2_LIGHTING_LIGHTMAP0 2
MATERIAL_VAR2_LIGHTING_BUMPED_LIGHTMAP 4
MATERIAL_VAR2_LIGHTING_MASK 7 Sum of 3 above
MATERIAL_VAR2_DIFFUSE_BUMPMAPPED_MODEL 8
MATERIAL_VAR2_USES_ENV_CUBEMAP 16
MATERIAL_VAR2_NEEDS_TANGENT_SPACES 32
MATERIAL_VAR2_NEEDS_SOFTWARE_LIGHTING 64
MATERIAL_VAR2_BLEND_WITH_LIGHTMAP_ALPHA 128
MATERIAL_VAR2_NEEDS_BAKED_LIGHTING_SNAPSHOTS 256
MATERIAL_VAR2_USE_FLASHLIGHT 512
MATERIAL_VAR2_USE_FIXED_FUNCTION_BAKED_LIGHTING 1024
MATERIAL_VAR2_NEEDS_FIXED_FUNCTION_FLASHLIGHT 2048
MATERIAL_VAR2_USE_EDITOR 4096
MATERIAL_VAR2_NEEDS_POWER_OF_TWO_FRAME_BUFFER_TEXTURE 8192
MATERIAL_VAR2_NEEDS_FULL_FRAME_BUFFER_TEXTURE 16384
MATERIAL_VAR2_IS_SPRITECARD 32768
MATERIAL_VAR2_USES_VERTEXID 65536
MATERIAL_VAR2_SUPPORTS_HW_SKINNING 131072
MATERIAL_VAR2_SUPPORTS_FLASHLIGHT 262144