VertexLitGeneric: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(Improves VertexLitGeneric's material parameters readability)
Line 5: Line 5:


=== Basics ===
=== Basics ===
;{{ent|$basetexture}}
{{MatParam|$basetexture|texture|[[$basetexture]] defines [[albedo]] texture.}}
: Defines an albedo texture.
{{MatParam|$detail|texture|[[$detail|Detail]] texturing.}}
;{{ent|$detail}}
{{MatParam|$decaltexture|texture|Use a 2nd UV channel for high-resolution decal support.|only={{csgo}}}}
: Detail texturing.
{{MatParam|$seperatedetailuvs|bool|{{todo|''Use texcoord1 for detail texture''}}|since={{src07}}}}
; {{ent|$decaltexture}} {{only|{{csgo}}}}
: Use a 2nd UV channel for high-resolution decal support.


=== Adjustment ===
=== Adjustment ===
;<code>[[$color#Models|$color2]]</code>
{{MatParam|$color2|RGB matrix|[[$color#Models|Color tinting]].}}
: Color tinting.
{{MatParam|$basetexturetransform|matrix|[[$basetexture#.24basetexturetransform|Transform]] [[$basetexture]]'s alignment, scale, rotation and position.}}
;{{ent|$lightwarptexture}} {{since|{{src06}}}}
{{MatParam|[[$allowdiffusemodulation]]|bool|Prevents the model's material from being tinted by [[$color2]] or <code>rendercolor.</code>|since={{l4d}}}}
: Per-texel color modification via a warp texture.
{{MatParam|$seperatedetailuvs|bool|{{todo|''Confirm use of texcoord1 for [[$detail|detail]] texture''}}|since={{src07}}}}
{{MatParam|[[$allowdiffusemodulation]]|bool|Prevents the model's material from being tinted by <code>$color2</code> or <code>rendercolor.</code>|since={{l4d}}}}
{{MatParam|$desaturatewithbasealpha|float|Use the base alpha to desaturate the base texture. Set to non-zero to enable, value gets multiplied into the alpha channel before desaturating.|since={{as}}}}
{{MatParam|$desaturatewithbasealpha|float|Use the base alpha to desaturate the base texture. Set to non-zero to enable, value gets multiplied into the alpha channel before desaturating.|since={{as}}}}
{{MatParam|[[$notint]]|bool|Prevents the model's material from being tinted by <code>$color2</code> or <code>rendercolor.</code>|only={{csgo}}|also={{P2CE}}}}
{{MatParam|[[$notint]]|bool|Prevents the model's material from being tinted by [[$color2]] or <code>rendercolor.</code>|only={{csgo}}|also={{P2CE}}}}


=== Transparency ===
=== Transparency ===
;{{ent|$alpha}}
{{MatParam|$alpha|bool|Cheaply scales the opacity of an entire material.}}
: Cheaply scales the opacity of an entire material.
{{MatParam|$alphatest|bool|Cheap transparency using a binary opacity mask.}}
;{{ent|$alphatest}}
{{MatParam|$nocull|bool|Disables backface culling.}}
: Cheap transparency using a binary opacity mask.
{{MatParam|$translucent|bool|Expensive translucency using a full alpha mask.}}
;{{ent|$nocull}}
{{MatParam|$distancealpha}}|bool|{{since|{{src07}}Vector-like edge filtering.}}
: Disables backface culling.
;{{ent|$translucent}}
: Expensive translucency using a full alpha mask.
;{{ent|$distancealpha}} {{since|{{src07}}}}
: Vector-like edge filtering.


=== Lighting ===
=== Lighting ===
;{{ent|$bumpmap}}
{{MatParam|$bumpmap|texture| [[Bump_map|Bump]] diffuse. [[Normal]] mapping.}}
: Normal mapping.
{{MatParam|$lightwarptexture|texture|1 dimension Per-texel color modification via a [[$lightwarptexture|warp texture]].|since={{src06}}}}
;{{ent|$halflambert}}
{{MatParam|$halflambert|bool|[[$halflambert|Half-lambertian]] shading.}}
: Half-lambertian shading.
{{MatParam|$selfillum|bool|Determines whether the surface is [[Glowing_Textures#.24selfillum|self-illuminated]] independent of environment lighting.}}
;{{ent|$selfillum}}
{{MatParam|$emissiveblendenabled|bool|[[Glowing_Textures#.24emissiveblend|Advanced flowing self-illumination]], used on the [[Vortigaunt|Vortigaunts]] in {{Game link|Half-Life 2: Episode Two}}.|since={{src07}}}}
: Determines whether the surface is self-illuminated independent of environment lighting.
;{{ent|$emissiveblend}} {{since|{{src07}}}}
: Advanced flowing self-illumination, used on the Vortigaunts in {{Game link|Half-Life 2: Episode Two}}.


=== Reflection ===
=== Reflection ===
;{{ent|$envmap}}
{{MatParam|$envmap|texture|[[$envmap|Specular reflections]].}}
: Specular reflections.
{{MatParam|$phong|bool|[[$phong|Diffuse reflections]].|since={{src06}}}}
;{{ent|$phong}} {{since|{{src06}}}}
{{MatParam|$rimlight|bool|Constant [[$rimlight|rimlight]] based on [[phong]] and the ambient lighting.|since={{src07}}}}
: Diffuse reflections.
;{{ent|$rimlight}} {{since|{{src07}}}}
: Constant rimlight based on phong and the ambient lighting.


=== Effect ===
=== Effect ===
;<code>[[Wrinkle_maps#Materials_and_textures|$compress]]</code> {{since|{{src07}}}}
{{MatParam|$compress|texture|[[Wrinkle_maps#Materials_and_textures|Wrinklemaps]] for character faces.|since={{src07}}}}
;<code>[[Wrinkle_maps#Materials_and_textures|$stretch]]</code> {{since|{{src07}}}}
{{MatParam|$stretch|texture|[[Wrinkle_maps#Materials_and_textures|Wrinklemaps]] for character faces.|since={{src07}}}}
: Wrinklemaps for character faces.
{{MatParam|$flesh|bool|The [[$flesh|flesh]] effect used for Alyx in Half-Life 2: Episode Two.|since={{src07}}}}
;{{ent|$flesh}} {{since|{{src07}}}}
{{MatParam|$treeSway|bool|Vertex manipulation to give the effect of [[$treeSway|trees swaying]] in the wind.|since={{l4d}}}}
: The flesh effect used for Alyx in Half-Life 2: Episode Two.
;{{ent|$treeSway}} {{since|{{l4d}}}}
: Vertex manipulation to give the effect of trees swaying in the wind.


=== Technical Workarounds ===
=== Technical Workarounds ===
{{MatParam|$flashlightnolambert|bool|Tell [[env_projectedtexture|projected textures]] such as the flashlight to ignore the surface normal of the model. Useful for models with {{ent|$nocull}} such as foilage. Otherwise, lighting the face with a flashlight from behind will not affect it. Default 0.|since={{src07}}}}
{{MatParam|$flashlightnolambert|bool|Tell [[env_projectedtexture|projected textures]] such as the flashlight to ignore the surface normal of the model. Useful for models with {{ent|$nocull}} such as foilage. Otherwise, lighting the face with a flashlight from behind will not affect it. ''Default 0''.|since={{src07}}}}
{{MatParam|$lowqualityflashlightshadows|bool|Force low quality flashlight/projected texture shadows for faster performance.|since={{portal2}}}}
{{MatParam|$lowqualityflashlightshadows|bool|Force low quality flashlight/projected texture shadows for faster performance.|since={{portal2}}}}
{{MatParam|$allowfencerenderstatehack|bool|Fence render hack for cascade shadow maps, allows shadow maps to work properly with fences.|since={{csgo}}}}
{{MatParam|$allowfencerenderstatehack|bool|Fence render hack for cascade shadow maps, allows shadow maps to work properly with fences.|since={{csgo}}}}
Line 72: Line 53:


{{MatParam|$cloakpassenabled|bool|Enables cloaking effects.}}
{{MatParam|$cloakpassenabled|bool|Enables cloaking effects.}}
{{MatParam|$cloakfactor|normal|0.00 {{=}} fully visible, 1.00 {{=}} fully invisible.}}
{{MatParam|$cloakfactor|normal|0.00 {{=}} fully visible,<br/>
{{MatParam|$cloakcolortint|RGB matrix|Colors the refraction effect. Default is white.}}
1.00 {{=}} fully invisible.}}
{{MatParam|$refractamount|float|How strong the refraction effect should be when the material is partially cloaked. Default 2.}}
{{MatParam|$cloakcolortint|RGB matrix|Colors the refraction effect. ''Default " [ 1 1 1 ] "''.}}
{{MatParam|$refractamount|float|How strong the refraction effect should be when the material is partially cloaked. ''Default 2''.}}


== Caveats ==
== Caveats ==

Revision as of 00:51, 21 March 2023

English (en)Français (fr)中文 (zh)Translate (Translate)

VertexLitGeneric is a material shader available in all Source games. It is the shader most commonly used to render models, and supports a variety of effects.

Supported Parameters

Basics

$basetexture $detail $decaltexture

Adjustment

$color2 $basetexturetransform [[$allowdiffusemodulation|$allowdiffusemodulation]] $seperatedetailuvs $desaturatewithbasealpha [[$notint|$notint]]

Transparency

$alpha $alphatest $nocull $translucent $distancealpha|bool|(in all games since Source 2007Vector-like edge filtering.)

Lighting

$bumpmap $lightwarptexture $halflambert $selfillum $emissiveblendenabled

Reflection

$envmap $phong $rimlight

Effect

$compress $stretch $flesh $treeSway

Technical Workarounds

$flashlightnolambert $lowqualityflashlightshadows $allowfencerenderstatehack $disablecsmlookup

Cloak

VertexLitGeneric natively supports the Spy cloak effect from Team Fortress 2 Team Fortress 2 . You will want to combine it with a sine wave proxy for the full effect.

$cloakpassenabled $cloakfactor $cloakcolortint $refractamount

Caveats

Mapbase

Unlit materials in Mapbase should have the shader SDK_VertexLitGeneric.

See also