Difference between revisions of "Shader Types and Parameters"

From Valve Developer Community
Jump to: navigation, search
m (Fully verified folders: Inserted link to future folder (coming soon).)
(category rename)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{stub}}
+
#redirect [[Category:Shaders]]
 
 
== Shader types ==
 
=== Shaders according to folders ===
 
The following list of shaders is partially categorized according to the folders found in the unpacked ''Source Materials.gcf''. This is to eliminate listing many folder/material exclusive shaders, to prevent beginners from being overwhelmed with unnecessary shader names. (See the [[Talk:Shader Types and Parameters|talk]]-page of this article for a rationale.)
 
 
 
If you are looking for a single (though currently incomplete) reference list, you can instead find it [[:Category:List_of_Shaders|here]].
 
 
 
Note that many folders are not yet categorized. In order to add a new entry, please search each material in the folder for shaders (by manually opening them and checking their contents). It may be very tedious work, but it is the only way to discover the more rare shaders.
 
 
 
==== Main list ====
 
This is a list of common shaders, and shaders not yet categorized according to folder. (Check the folders before adding new shaders. We do not want duplicate entries.)
 
 
 
{|
 
! Shader Name
 
! Description
 
! Parameter Notes
 
|-
 
| [[Eyeball]]
 
|
 
|
 
|-
 
| [[eyes]]
 
| Used for realistic eyeballs for models.
 
|
 
|-
 
| [[LightmappedGeneric]]
 
| The most common texture.  A basetexture is multiplied by a lightmap.
 
| Only the $basetexture line is required.
 
$albedo, $selfillumtint, $detail, $detailframe (dx9), $detailscale, $envmap, $envmapframe, $envmapmask, $envmaskframe, $envmapmasktransform (dx9), $envmapmaskscale (dx8), $envmaptint, $bumpmap, $bumpframe, $bumptransform, $envmapcontrast, $envmapsaturation, $fresnelreflection, $nodiffusebumplighting (dx9), $bumpmap2 (dx9), $bumpmapframe2 (dx9), $frame2 (dx9), $basetexturenoenvmap (dx9), $basetexture2noenvmap (dx9), $detail_alpha_mask_base_texture (dx9)
 
|-
 
| LightmappedGeneric_DX8
 
|
 
|
 
|-
 
| LightmappedGeneric_DX9
 
|
 
|
 
|-
 
| LightmappedGeneric_NoBump_DX8
 
|
 
|
 
|-
 
| [[Modulate]]
 
|
 
|
 
|-
 
| [[predator]]
 
|
 
|
 
|-
 
| [[Refract]]
 
| Refracts the light behind it according to a dudvmap and bumpmap.  Only works correctly on models.
 
| If used on a model, Set "$model" 1
 
|-
 
| Refract_DX60
 
|
 
|
 
|-
 
| Refract_DX80
 
|
 
|
 
|-
 
| Refract_DX90
 
|
 
|
 
|-
 
| [[Sprite]]
 
|
 
|
 
|-
 
| [[Teeth]]
 
|
 
|
 
|-
 
| [[UnlitGeneric]]
 
| A basetexture appears at full brightness.
 
| If used on a model, set "$model" 1.
 
|-
 
| UnlitGeneric_DX8
 
|
 
|
 
|-
 
| UnlitGeneric_DX9
 
|
 
|
 
|-
 
| UnlitGeneric_HDR_DX9
 
|
 
|
 
|-
 
| [[UnlitTwoTexture]]
 
| Two textures are mixed evenly and appear at full brightness.
 
|
 
|-
 
| [[VertexLitGeneric]]
 
| A basetexture with vertex lighting.
 
| $albedo (dx9), $selfillumtint, $detail, $detailframe (dx9), $detailscale, $envmap, $envmapframe, $envmapmask, $envmaptransform (dx9), $envmapmaskscale (dx8), $envmaptint, $bumpmap, $bumpmapframe, $bumptransform, $envmapcontrast, $envmapsaturation
 
|-
 
| VertexLitGeneric_DX8
 
|
 
|
 
|-
 
| VertexLitGeneric_DX9
 
|
 
|
 
|-
 
| [[Water (shader)|Water]]
 
|
 
| For fallbacks for this shader, see [[Shaders in Nature\]].
 
|-
 
| [[WorldTwoTextureBlend]]
 
| A partially transparent detail texture is blended on top of the base texture, according to the alpha channel of the detail texture.
 
|$basetexture <nowiki><texture></nowiki>, $detail <nowiki><texture></nowiki>, $detailscale <nowiki><float></nowiki>, $surfaceprop <nowiki><type></nowiki>.
 
|}
 
 
 
==== Fully verified folders ====
 
These folders are those in which every single [[VMT]] file has been searched for shaders (as of 31-01-2008).
 
 
 
* [[Shaders in cable\]]
 
* [[Shaders in Debug\]]
 
* [[Shaders in Decals\]]
 
* [[Shaders in Dev\]]
 
* [[Shaders in Editor\]]
 
* [[Shaders in Engine\]]
 
* [[Shaders in Glass\]]
 
* [[Shaders in hlmv\]]
 
* [[Shaders in HUD\]]
 
* [[Shaders in Nature\]]
 
* [[Shaders in particle\]]
 
* [[Shaders in scripted\]]
 
* [[Shaders in shadertest\]]
 
* [[Shaders in Sprites\]]
 
* [[Shaders in Tools\]]
 
* [[Shaders in VGUI\]]
 
 
 
==== Unknown shaders ====
 
Many shaders previously listed on this page came from a very old list that lists shaders that isn't used by any current materials in <code>source materials.gcf</code>. It is uncertain if these shaders are working, or how to use them. This is why they are in [[Shaders without folder|this separate list]].
 
 
 
== Shader parameters ==
 
=== Texture references ===
 
;"$basetexture" "''path to base texture''"
 
:Basic color map.
 
;"$basetexture2" "''path to 2nd base texture''"
 
:Used for the WorldVertexTransition shader.
 
;"$bumpmap" "''path to normal map''"
 
:Defines normal vectors for lighting purposes and for envmap distortion
 
;"$bumpmap2" "''path to normal map''"
 
:Used for the WorldVertexTransition shader.
 
;"$parallaxmap" "''path to height map''"
 
:Use for parallax mapping. Not functional.
 
;"$texture2" "''path to 2nd base texture''"
 
:Used for "twotexture"-type shader.
 
;"$detail" "''path to detail texture''"
 
:Greyscale image usually used at higher resolution to add detail to the base texture. Used in conjunction with "$detailscale".
 
 
 
=== Texture adjustment ===
 
;"$bumpscale" <''float''>
 
;"$parallaxmapscale" <''float''>
 
;"$detailscale" <''float''>
 
:Number of times the detail texture will scale in the base texture.
 
;"$basetexturetransform" "center <''float''> <''float''> scale <''float''> <''float''> rotate <''float''> translate <''float''> <''float''>"
 
;"$basetexturetransform2" "center <''float''> <''float''> scale <''float''> <''float''> rotate <''float''> translate <''float''> <''float''>"
 
:"center" and "translate" are in UV 0..1 coordinates, "rotate" is in angles.
 
:'''You must include all variables.''' The defaults are: <code>center .5 .5 scale 1 1 rotate 0 translate 0 0</code>.
 
 
 
=== World interaction ===
 
;"$surfaceprop" "''surface property''"
 
:Defines the gib types and impact sounds of the material. See [[Material surface properties|Material Surface properties]] for more information.
 
 
 
=== Reflections ===
 
;"$basealphaenvmapmask" 1
 
:Uses $basetexture's alpha channel as an envmap mask.
 
;"$envmap" "env_cubemap"
 
:Uses nearest env_cubemap for reflection.
 
;"$envmapcontrast" ''float''
 
:contrast 0 == normal 1 == color*color.  Adjusts dynamic range of env_cubmap.  Use higher contrasts to diminish relatively darker areas, increase "hot spots".
 
;"$envmapmask" "''texture''"
 
;"$envmapmaskscale" ''float''
 
;"$envmapmode" 1
 
;"$envmapsaturation" ''float''
 
:saturation 0 == greyscale 1 == normal
 
;"$envmapsphere" 1
 
;"$envmaptint" "[''float float float'']"
 
:Scales the red, green, and blue components of the envmap.
 
;"$normalmapalphaenvmapmask" 1
 
:Masks the envmap according to the alpha channel of the normal map.
 
 
 
=== Lighting/Rendering ===
 
;"$additive" 1
 
:Renders the texture additively (Its colors are added to, instead of replacing, what is displayed behind it).
 
;"$color" "[float float float]"
 
:Scales red, green, and blue components of the material.
 
;"$halflambert" 1
 
:Improves shading quality dramatically.
 
;"$nocull" 1
 
:Make the surface two-sided.
 
;"$selfillum" 1
 
:Uses $basetexture's alpha channel to set minumum clamps on the lighting.
 
 
 
=== Opacity ===
 
;"$translucent" 1
 
:Used with "UnlitGeneric", "VertexlitGeneric", "LightmappedGeneric" and many more shaders to enable a opacity map according to the alpha channel of the "$basetexture" targa.
 
;"$alphatest" 1
 
:Alphatesting: Every pixel with an alpha value less than 178 will be completely transparent ingame. (However, values close to this value will confuse the shader at distances.) This type of shading costs much less than ''translucent'' shading [http://www.chatbear.com/board.plm?a=viewthread&t=697,1113959073,6037&id=839735&b=4986&v=flatold ].
 
;"$alpha" ''float''
 
:Scales material opacity by the 'float' number.
 
 
 
=== Other ===
 
;"$decal" 1
 
:Needed for a material to be rendered as a decal. See [[Creating Decals]].
 
;"$model" 1
 
:Used on materials applied to models (''used with "UnlitGeneric", "Refract" and others'').
 
;"$writeZ" 1
 
:Only used by materials using the modulation shader. Setting $writeZ to 1 forces the material to set the z value in the depth buffer (so things z-buffer against it). By default, the modulation shader doesn't set the z value.
 
 
 
== See also ==
 
* [[Material Creation]]
 
 
 
[[Category:Shaders]]
 
[[Category:Material System]]
 

Latest revision as of 12:26, 6 July 2018

Redirect to: