Character (shader): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{stub}}
{{stub}}
[[Category:Shaders]]
[[File:character_vs_vertexlit.jpg|thumb|Character on left, VertexLitGeneric on right.]]
[[File:character_vs_vertexlit.jpg|thumb|Character on left, VertexLitGeneric on right.]]
'''Character''' is a [[material]] [[shader]] available in {{csgo}}. Shares most generic parameters of [[VertexLitGeneric]]. Takes advantage of mask textures to tune stuff like '''rimlighting''', '''phong shading''' and other.
{{This is a|vertex shader|name=Character|game=Counter-Strike: Global Offensive}} Shares most generic parameters of [[VertexLitGeneric]]. It takes advantage of mask textures to tune '''rimlighting''', '''phong shading''' and other parameters.


{{Tip|It might be a good idea to look at Valve [[vmt]]s of new Player Models inside the [[vpk]] files, to get better understanding how to structure your Character shader vmt.}}
{{Tip|It might be a good idea to look at Valve [[vmt]]s of new Player Models inside the [[vpk]] files, to get better understanding how to structure your Character shader vmt.}}
Line 22: Line 21:
;{{ent|$masks2}}
;{{ent|$masks2}}
: '''Red channel''' - Shadow saturation mask
: '''Red channel''' - Shadow saturation mask
: '''Green channel''' - Angle of Anisotropy,as if the mask value > 0
: '''Green channel''' - Angle of Anisotropy,as if the mask value > 0.the mask value * 3.14159 to get angle .
: '''Blue channel''' - [[$envmap]] light scale
: '''Blue channel''' - [[$envmap]] light scale
: '''Alpha channel''' - Retroreflectivity
: '''Alpha channel''' - Retroreflectivity
Line 32: Line 31:
===Unique Envmap Parameters===
===Unique Envmap Parameters===
{{note|In addition to all previous '''VertexLitGeneric''' parameters.}}
{{note|In addition to all previous '''VertexLitGeneric''' parameters.}}
{{MatParam|$envmaplightscale|float|How much the surface's lightmap tints the specular reflection. A value between 0 (off) and 1 (no reflection with completely black lightmap) determines how much the reflection is tinted; values above 1 are permitted but seem to actually start inverting the effect.}}
{{MatParamDef|$envmaplightscale|float|How much the surface's lightmap tints the specular reflection. A value between 0 (off) and 1 (no reflection with completely black lightmap) determines how much the reflection is tinted; values above 1 are permitted but seem to actually start inverting the effect.}}
{{MatParam|$envmaplightscaleminmax|vector2|Thresholds for the lightmap reflection tinting effect. Setting the minimum value higher increases the minimum light amount at which the reflection gets nerfed to nothing.}}
{{MatParamDef|$envmaplightscaleminmax|vector2|Thresholds for the lightmap reflection tinting effect. Setting the minimum value higher increases the minimum light amount at which the reflection gets nerfed to nothing.}}
===Unique Phong Parameters===
===Unique Phong Parameters===
{{note|In addition to all previous '''VertexLitGeneric''' parameters.}}
{{note|In addition to all previous '''VertexLitGeneric''' parameters.}}
{{MatParam|$phongalbedoboost|float|Phong albedo overbrightening factor.}}
{{MatParamDef|$phongalbedoboost|float|Phong albedo overbrightening factor.}}
===Unique Rimlight Parameters===
===Unique Rimlight Parameters===
{{note|In addition to all previous '''VertexLitGeneric''' parameters.}}
{{note|In addition to all previous '''VertexLitGeneric''' parameters.}}
{{MatParam|$rimlightalbedo|float|Rimlight albedo overbrightening factor.}}
{{MatParamDef|$rimlightalbedo|float|Rimlight albedo overbrightening factor.}}
{{MatParam|$rimlighttint|RGB matrix|Color tint of the rimlight.}}
{{MatParamDef|$rimlighttint|RGB matrix|Color tint of the rimlight.}}
{{MatParam|$fakerimboost|float|Controls the strength of ''fake'' rimlight that doesn't use ambient color (visible in pitch black).}}
{{MatParamDef|$fakerimboost|float|Controls the strength of ''fake'' rimlight that doesn't use ambient color (visible in pitch black).}}
{{MatParam|$fakerimtint|RGB matrix|Color of the ''fake'' rimlight.}}
{{MatParamDef|$fakerimtint|RGB matrix|Color of the ''fake'' rimlight.}}
{{MatParam|$rimhaloboost|float|Scale of the rimlight halo.}}
{{MatParamDef|$rimhaloboost|float|Scale of the rimlight halo.}}
{{MatParam|$rimhalobounds|vector4|Default value <code>[0.4 0.5 0.5 0.6]</code> controls the blending between light levels.}}
{{MatParamDef|$rimhalobounds|vector4|Default value <code>[0.4 0.5 0.5 0.6]</code> controls the blending between light levels.}}
===Ambient Reflection Parameters===
===Ambient Reflection Parameters===
{{Note| Ambient Reflection is similiar to rimlighting.}}
{{Note| Ambient Reflection is similiar to rimlighting.}}
{{MatParam|$ambientreflectionboost|float|Controls the strength of ambient light on the model.}}
{{MatParamDef|$ambientreflectionboost|float|Controls the strength of ambient light on the model.}}
{{MatParam|$ambientreflectionbouncecolor|RGB matrix|Color tint of the ambient reflections on the model.}}
{{MatParamDef|$ambientreflectionbouncecolor|RGB matrix|Color tint of the ambient reflections on the model.}}
{{MatParam|$ambientreflectionbouncecenter|vector3|{{todo}} Default value <code>[0 42 0]</code>}}
{{MatParamDef|$ambientreflectionbouncecenter|vector3|{{todo}} Default value <code>[0 42 0]</code>}}
===Shadow Parameters===
===Shadow Parameters===
{{MatParam|$shadowrimboost|float|Extra boost for rimlight in shadow.}}
{{MatParamDef|$shadowrimboost|float|Extra boost for rimlight in shadow.}}
{{MatParam|$shadowsaturation|float|Controls the saturation of shadows.}}
{{MatParamDef|$shadowsaturation|float|Controls the saturation of shadows.}}
{{MatParam|$shadowsaturationbounds|vector4|Default value <code>[0.4 0.5 0.5 0.6]</code> controls shadow (color desaturation) blending between light to mid to dark levels.}}
{{MatParamDef|$shadowsaturationbounds|vector4|Default value <code>[0.4 0.5 0.5 0.6]</code> controls shadow (color desaturation) blending between light to mid to dark levels.}}
{{MatParam|$shadowtint|vector4|Tints the color of shadows on the model. Uses <code>[R G B A]</code>, alpha is shadow strength.}}
{{MatParamDef|$shadowtint|vector4|Tints the color of shadows on the model. Uses <code>[R G B A]</code>, alpha is shadow strength.}}
{{MatParam|$shadowcontrast|float|Controls the contrast of shadows.}}
{{MatParamDef|$shadowcontrast|float|Controls the contrast of shadows.}}
===Miscellaneous Parameters===
===Miscellaneous Parameters===
{{MatParam|$hueshiftamount|float|Changes the hue of the model.}}
{{MatParamDef|$hueshiftamount|float|Changes the hue of the model.}}
{{MatParam|$metalness|float| Metalness is just a negative multiply on the albedo.
{{MatParamDef|$metalness|float| Metalness is just a negative multiply on the albedo.
{{note|Doesn't do anything if [[$masks1]] is used.}}}}
{{note|Doesn't do anything if [[$masks1]] is used.}}}}
{{MatParam|$warpindex|float|Tell shader a float value as V coord of specular or fresnel warp texuture .
{{MatParamDef|$warpindex|float|Tell shader a float value as V coord of specular or fresnel warp texuture .
{{note|Doesn't do anything if [[$masks1]] is used.}}}}
{{note|Doesn't do anything if [[$masks1]] is used.}}}}
{{MatParam|$anisotropyamount|float|Controls how much anisotropic lighting tints the model.}}
{{MatParamDef|$anisotropyamount|float|Controls how much anisotropic lighting tints the model.}}

Latest revision as of 11:47, 23 August 2025

Stub

This article or section is a stub. You can help by expanding it.

Character on left, VertexLitGeneric on right.

Character is a Vertex shader available in Counter-Strike: Global Offensive Counter-Strike: Global Offensive. Shares most generic parameters of VertexLitGeneric. It takes advantage of mask textures to tune rimlighting, phong shading and other parameters.

Tip.pngTip:It might be a good idea to look at Valve vmts of new Player Models inside the vpk files, to get better understanding how to structure your Character shader vmt.


Supported Parameters

Textures & Masks

$basetexture
Diffuse mask.
$bumpmap
Normal map.
$envmap
Specular reflection mask.
$masks1
Red channel - $rimlight mask
Green channel - Phong Albedo mask
Blue channel - $metalness mask
Alpha channel - $warpindex mask
$masks2
Red channel - Shadow saturation mask
Green channel - Angle of Anisotropy,as if the mask value > 0.the mask value * 3.14159 to get angle .
Blue channel - $envmap light scale
Alpha channel - Retroreflectivity
$phongwarptexture
Phong warp texture.
$fresnelrangestexture
BlinnPhong&AmbientReflection fresnel mapping texture

Unique Envmap Parameters

Note.pngNote:In addition to all previous VertexLitGeneric parameters.
How much the surface's lightmap tints the specular reflection. A value between 0 (off) and 1 (no reflection with completely black lightmap) determines how much the reflection is tinted; values above 1 are permitted but seem to actually start inverting the effect.
Thresholds for the lightmap reflection tinting effect. Setting the minimum value higher increases the minimum light amount at which the reflection gets nerfed to nothing.

Unique Phong Parameters

Note.pngNote:In addition to all previous VertexLitGeneric parameters.
Phong albedo overbrightening factor.

Unique Rimlight Parameters

Note.pngNote:In addition to all previous VertexLitGeneric parameters.
Rimlight albedo overbrightening factor.
Color tint of the rimlight.
Controls the strength of fake rimlight that doesn't use ambient color (visible in pitch black).
Color of the fake rimlight.
Scale of the rimlight halo.
Default value [0.4 0.5 0.5 0.6] controls the blending between light levels.

Ambient Reflection Parameters

Note.pngNote: Ambient Reflection is similiar to rimlighting.
Controls the strength of ambient light on the model.
Color tint of the ambient reflections on the model.
[Todo] Default value [0 42 0]

Shadow Parameters

Extra boost for rimlight in shadow.
Controls the saturation of shadows.
Default value [0.4 0.5 0.5 0.6] controls shadow (color desaturation) blending between light to mid to dark levels.
Tints the color of shadows on the model. Uses [R G B A], alpha is shadow strength.
Controls the contrast of shadows.

Miscellaneous Parameters

Changes the hue of the model.
Metalness is just a negative multiply on the albedo.
Note.pngNote:Doesn't do anything if $masks1 is used.
Tell shader a float value as V coord of specular or fresnel warp texuture .
Note.pngNote:Doesn't do anything if $masks1 is used.
Controls how much anisotropic lighting tints the model.