This article's documentation is for anything that uses the Source engine. Click here for more information.

LightmappedGeneric: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(32 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{lang | LightmappedGeneric}}
{{Source topicon}} {{lang}}
{{Shader|LightmappedGeneric}} It is the shader most commonly used to render brushes, displacements and [[lightmap]]ped surfaces.  
{{this is a|pixel shader|name=LightmappedGeneric}} It is the shader most commonly used to render [[lightmap]]ped [[brush]]es and [[displacement]]s.  


Only some games like {{tf2}} support this shader to be used on models. {{todo|Which other games support it?}}
Models cannot use this shader; [[$lightmap|lightmapped models]] use the {{ent|VertexLitGeneric}} shader.


== Supported Parameters ==
== Supported Parameters ==


=== Basics ===
=== Basics ===
;{{ent|$basetexture}}
{{MatParamDef|$basetexture|texture|Defines an [[diffuse]] texture.}}
: Defines an albedo texture.
{{MatParamDef|$decal|bool|Use this material as a decal.}}
;{{ent|$decal}}
{{MatParamDef|$detail|texture|Detail texturing.}}
: Use this material as a decal.
{{MatParamDef|$surfaceprop|string|Links the surface to a set of physical properties.}}
;{{ent|$detail}}
: Detail texturing.
;{{ent|$surfaceprop}}
: Links the surface to a set of physical properties.
;{{ent|%tooltexture}}
: Used to blend texture previews in Hammer.


=== Adjustment ===
=== Adjustment ===
;{{ent|$color}}
{{MatParamDef|$basetexturetransform|matrix| Transforms the texture before use in the material. This does not affect [[lightmap]]s on the surface. }}
: Independently scales the red, green and blue channels of an albedo.
{{MatParamDef|$color|RGB matrix|Independently scales the red, green and blue channels of an albedo.
;{{ent|$pointsamplemagfilter}} {{only|{{csgo}}}}
{{bug|Greyscale materials using $color as a sole source of tint will not appear colored under light cast by the player flashlight (or a projected texture). This results in textures appearing grey and desaturated. A workaround for this is to add a base grey [[$detail]] to the material and then and then use [[$detailtint]] to color it.|tested={{src13sp}}, {{src13mp}}}}}}
: Disables texture filtering.
{{MatParamDef|$decalscale|float|Same as a brush face's texture scale value: the number of [[unit|units]] that each [[texel]] covers. Normally 0.25 or lower. }}
;{{ent|$seamless_scale}} {{since|{{src07}}}}
{{MatParamDef|$detailscale|float|Fits the detail texture onto the material the given number of times (default {{=}} 4). Generally used instead of {{mono|$detailtexturetransform}} with a value of around 7 or 8 for a 128px detail texture. To independently scale the X and Y coordinates, place your values in brackets: {{mono|$detailscale "[ 4 8 ]"}}}}
: Mitigation for displacement texture stretching.
{{MatParamDef|$detailblendfactor|normal|Controls the amount that the detail texture affects the base texture. The precise use of this depends on the blend factor; in most cases it acts similarly to [[$alpha]]. A value of 0 usually makes the detail texture have no effect, whilst a value of 1 applies the full effect.}}
{{MatParamDef|$detailblendmode|int|How to combine the detail material with the albedo.}}
{{MatParamDef|$modelmaterial|material|A separate [[VertexLitGeneric]] material to that will replace this one if the decal hits a [[Model|model]]. }}
{{MatParamDef|$pointsamplemagfilter|bool|only={{csgo}}{{jbep3}}|Disables texture filtering.}}
{{MatParamDef|$seamless_scale|since={{src07}}|float|Mitigation for displacement texture stretching.}}


=== Transparency ===
=== Transparency ===
;{{ent|$alpha}}
{{MatParamDef|$alpha|float|Scales the opacity of an entire material.
: Scales the opacity of an entire material.
{{modernImportant|Can result in alpha sorting issues if brush is flagged as detail or tied to an entity!}}}}
;{{ent|$alphatest}}
{{MatParamDef|$alphatest|bool|Specifies a mask to use to determine binary opacity.}}
: Specifies a mask to use to determine binary opacity.
{{MatParamDef|$distancealpha|since={{src07}}|bool|Vector-like edge filtering.}}
;{{ent|$distancealpha}} {{since|{{src07}}}}
{{MatParamDef|$nocull|bool|Disables backface culling.}}
: Vector-like edge filtering.
{{MatParamDef|$translucent|bool|Specifies that the material should be partially see-through.
;{{ent|$nocull}}
{{modernImportant|Can result in alpha sorting issues if brush is flagged as detail or tied to an entity!}}}}
: Disables backface culling.
;{{ent|$translucent}}
: Specifies that the material should be partially see-through.


=== Lighting ===
=== Lighting ===
;{{ent|$bumpmap}}
{{MatParamDef|$bumpmap|texture|Specifies a texture that will provide three-dimensional lighting information for a material.}}
: Specifies a texture that will provide three-dimensional lighting information for a material.
{{MatParamDef|$blendmodulatetexture|since={{src06}}|texture|Control sharpness and bias of blend. See [[Blendmodulate]]}}
;{{ent|$lightwarptexture}} {{since|{{src06}}}}
{{MatParamDef|$lightwarptexture|since={{src06}}|texture|Per-texel color modification via a warp texture.  
: Per-texel color modification via a warp texture.
{{Note|Does not appear to be featured on {{ent|LightmappedGeneric}} in {{csgobranch|4}}.}}}}
;{{ent|$selfillum}}
{{MatParamDef|$selfillum|bool|Determines whether the surface is self-illuminated independent of environment lighting.}}
: Determines whether the surface is self-illuminated independent of environment lighting.
{{MatParamDef|$ssbump|since={{src07}}|bool|Flags the {{ent|$bumpmap}} as being a self-shadowing bumpmap.}}
;{{ent|$ssbump}} {{since|{{src07}}}}
: Flags a $bumpmap texture as being a self-shadowing bump map.


=== Reflection ===
=== Reflection ===
;{{ent|$envmap}}
{{MatParamDef|$envmap|cubemap|Specular reflections.}}
: Specular reflections.
{{MatParamDef|$phong|since={{csgo}}|also={{GMOD}}{{mapbase}}|bool|Diffuse reflections.
;{{ent|$phong}} {{only|{{csgo}}}}
{{note|Phong is reflected only from [[env_cascade_light]].}}
: Diffuse reflections.
:{{todo|Are there reflections from any other light sources?.}}  
:{{note|Phong is reflected only from [[env_cascade_light]].}} {{todo|Are there reflections from any other light sources?.}}  
{{warning|Standard phong color is always white and doesn't depend on the color of [[light_environment]] or [[env_cascade_light]].}}
:{{warning|Standard phong color is always white and don't depend on the color of [[light_environment]] or [[env_cascade_light]].}}
{{bug|Normal map does not affect phong reflections if there is empty $envmap on the material, or if you haven't assigned any brush face on [[env_cubemap]] entity.}}}}
:{{bug|Normal map does not affect phong reflections if there is empty $envmap on the material, or if you haven't assigned any brush face on [[env_cubemap]] entity.}}
{{MatParamDef|$phong_exp|only={{lw}}|float|{{confirm|Is this for LW's Blinn–Phong reflections?}}}}
{{MatParamDef|$phong_exp2|only={{lw}}|float|{{confirm|Is this for LW's Blinn–Phong reflections?}}}}
 
==={{portal2}}Paint===
These parameters can be used in any LightmappedGeneric material, and will affect the appearance of paint applied on top of that specific material. All materials that do not specify these will use the code-defined defaults.
{{MatParamDef|$paintsplatnormalmap|texture|The paint splat normal map to use when paint is applied to the material. Defaults to <code>paint/splatnormal_default</code> if not specified.}}
{{MatParamDef|$paintsplatbubblelayout|texture|The layout texture which defines the distribution of bubbles in the paint. Defaults to <code>paint/bubblelayout</code> if not specified.}}
{{MatParamDef|$paintsplatbubble|texture|The normal mapped texture of a single bubble. Defaults to <code>paint/bubble</code> if not specified.}}
{{MatParamDef|$paintenvmap|texture|The environment map reflected in the paint. Defaults to <code>paint/paint_envmap_hdr</code> if not specified.}}
 
=== Texture Organization ===
{{MatParamDef|%keywords|string|Sets keywords <i>(comma separated)</i> filter that can be filtered in hammer for easier texture finding.{{example|<code>%keywords "wasteland,c17"</code> place the material under the <i>"wasteland"</i> and <i>"c17"</i> filters.}} }}
{{MatParamDef|%notooltexture|bool|Hides the material from Hammer's texture browser.{{warning|Non-functional in {{hammer++|4.1}}.}} }}
{{MatParamDef|%tooltexture|texture|Used to blend texture previews in [[Hammer]].}}


=== Effect ===
=== Effect ===
;{{ent|$nofog}}
{{MatParamDef|$nofog|bool|Prevents fog from overdrawing a material.}}
: Prevents fog from overdrawing a material.


== Caveats ==
== Caveats ==


=== Mapbase ===
=== Mapbase ===
LightmappedGeneric materials in [[Mapbase]] should have the shader '''<code>SDK_LightmappedGeneric</code>'''.
LightmappedGeneric materials in [[Mapbase]] should have the shader '''{{mono|SDK_LightmappedGeneric}}'''.




== See also ==
== See also ==
 
*{{mono|[[WorldVertexTransition]]}}, a shader used on displacements to blend two materials together.
*<code>[[WorldVertexTransition]]</code>, a shader used on displacements to blend two materials together.
*{{mono|[[LightmappedTwoTexture]]}}, a brush shader that multiplies a texture on top of another one.
*<code>[[LightmappedTwoTexture]]</code>, a brush shader that multiplies a texture on top of another one.
*{{mono|[[Lightmapped_4WayBlend]]}}, a shader used on displacements to blend up to four materials together.
*<code>[[Lightmapped_4WayBlend]]</code>, a shader used on displacements to blend up to four materials together.

Latest revision as of 11:38, 23 August 2025

English (en)Français (fr)Русский (ru)Translate (Translate)

LightmappedGeneric is a Pixel shader available in all Source Source games. It is the shader most commonly used to render lightmapped brushes and displacements.

Models cannot use this shader; lightmapped models use the VertexLitGeneric shader.

Supported Parameters

Basics

Defines an diffuse texture.
Use this material as a decal.
Detail texturing.
Links the surface to a set of physical properties.

Adjustment

Transforms the texture before use in the material. This does not affect lightmaps on the surface.
Independently scales the red, green and blue channels of an albedo.
Icon-Bug.pngBug:Greyscale materials using $color as a sole source of tint will not appear colored under light cast by the player flashlight (or a projected texture). This results in textures appearing grey and desaturated. A workaround for this is to add a base grey $detail to the material and then and then use $detailtint to color it.  (tested in: Source 2013 Singleplayer, Source 2013 Multiplayer)
Same as a brush face's texture scale value: the number of units that each texel covers. Normally 0.25 or lower.
Fits the detail texture onto the material the given number of times (default = 4). Generally used instead of $detailtexturetransform with a value of around 7 or 8 for a 128px detail texture. To independently scale the X and Y coordinates, place your values in brackets: $detailscale "[ 4 8 ]"
Controls the amount that the detail texture affects the base texture. The precise use of this depends on the blend factor; in most cases it acts similarly to $alpha. A value of 0 usually makes the detail texture have no effect, whilst a value of 1 applies the full effect.
How to combine the detail material with the albedo.
A separate VertexLitGeneric material to that will replace this one if the decal hits a model.
Disables texture filtering.
$seamless_scale <float> (in all games since Source 2007)
Mitigation for displacement texture stretching.

Transparency

Scales the opacity of an entire material.
Icon-Important.pngImportant:Can result in alpha sorting issues if brush is flagged as detail or tied to an entity!
Specifies a mask to use to determine binary opacity.
$distancealpha <boolean> (in all games since Source 2007)
Vector-like edge filtering.
Disables backface culling.
Specifies that the material should be partially see-through.
Icon-Important.pngImportant:Can result in alpha sorting issues if brush is flagged as detail or tied to an entity!

Lighting

Specifies a texture that will provide three-dimensional lighting information for a material.
$blendmodulatetexture <texture> (in all games since Source 2006)
Control sharpness and bias of blend. See Blendmodulate
$lightwarptexture <texture> (in all games since Source 2006)
Per-texel color modification via a warp texture.
Note.pngNote:Does not appear to be featured on LightmappedGeneric in CS:GO engine branch CS:GO engine branch.
Determines whether the surface is self-illuminated independent of environment lighting.
$ssbump <boolean> (in all games since Source 2007)
Flags the $bumpmap as being a self-shadowing bumpmap.

Reflection

Specular reflections.
$phong <boolean> (in all games since Counter-Strike: Global Offensive) (also in Garry's ModMapbase)
Diffuse reflections.
Note.pngNote:Phong is reflected only from env_cascade_light.
Todo: Are there reflections from any other light sources?.
Warning.pngWarning:Standard phong color is always white and doesn't depend on the color of light_environment or env_cascade_light.
Icon-Bug.pngBug:Normal map does not affect phong reflections if there is empty $envmap on the material, or if you haven't assigned any brush face on env_cubemap entity.  [todo tested in ?]
$phong_exp <float> (only in Lambda Wars)
Confirm:Is this for LW's Blinn–Phong reflections?
$phong_exp2 <float> (only in Lambda Wars)
Confirm:Is this for LW's Blinn–Phong reflections?

Portal 2Paint

These parameters can be used in any LightmappedGeneric material, and will affect the appearance of paint applied on top of that specific material. All materials that do not specify these will use the code-defined defaults.

The paint splat normal map to use when paint is applied to the material. Defaults to paint/splatnormal_default if not specified.
The layout texture which defines the distribution of bubbles in the paint. Defaults to paint/bubblelayout if not specified.
The normal mapped texture of a single bubble. Defaults to paint/bubble if not specified.
The environment map reflected in the paint. Defaults to paint/paint_envmap_hdr if not specified.

Texture Organization

Sets keywords (comma separated) filter that can be filtered in hammer for easier texture finding.
PlacementTip.pngExample:%keywords "wasteland,c17" place the material under the "wasteland" and "c17" filters.
Hides the material from Hammer's texture browser.
Warning.pngWarning:Non-functional in Hammer++ Hammer++.
Used to blend texture previews in Hammer.

Effect

Prevents fog from overdrawing a material.

Caveats

Mapbase

LightmappedGeneric materials in Mapbase should have the shader SDK_LightmappedGeneric.


See also