$moss enable: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{langsp}}
{{LanguageBar|title={{mono|$moss_enable}}}}
[[File:MOSS.png|thumb|right|Moss shader example with [[LightmappedGeneric]], for <code>$moss_texture</code> used <code>xen/moss00_d</code>.]]
{{this is a|shader parameter|name=$moss_enable|game=Black Mesa}}  
[[File:MOSS25.png|thumb|right|Moss shader example with [[VertexLitGeneric]], for <code>$moss_texture</code> used <code>models/props_xen/moss_test/bubblemoss</code>.]]
[[File:MOSS=.jpg|thumb|right|Moss shader example with [[LightmappedGeneric]], for <code>$moss_texture</code> used <code>xen/moss00_d</code>.]]
[[File:MOSS25=.jpg|thumb|right|Moss shader example with [[VertexLitGeneric]], for <code>$moss_texture</code> used <code>models/props_xen/moss_test/bubblemoss</code>.]]
This is procedural moss implementation, which is triplanar projection shader that allows you to project additional texture that mixes with [[normalmap]]. This shader available for [[VertexLitGeneric]], [[LightmappedGeneric]] and [[Lightmapped_4WayBlend]] shaders. It was created during development of [[Xen]] for {{bms|4}} and was designed to simulate presence of moss on surface.
This is procedural moss implementation, which is triplanar projection shader that allows you to project additional texture that mixes with [[normalmap]]. This shader available for [[VertexLitGeneric]], [[LightmappedGeneric]] and [[Lightmapped_4WayBlend]] shaders. It was created during development of [[Xen]] for {{bms|4}} and was designed to simulate presence of moss on surface.


For [[VertexLitGeneric]], it uses specified texture. For [[LightmappedGeneric]] and [[Lightmapped_4WayBlend]], instead of using texture itself for moss, this shader takes color that most of the texture consists of and then applies color to surface according to the parameters specified in <code>.vmt</code>.
For [[VertexLitGeneric]], it uses the specified texture. For [[LightmappedGeneric]] and [[Lightmapped_4WayBlend]], instead of using the texture itself for moss, this shader takes color that most of the texture consists of and then applies color to the surface according to the parameters specified in <code>.vmt</code>.
All parameters works in the same way for both shaders.
All parameters works in the same way for both shaders.


In {{bms|4}} was used for <code>models\props_xen\moss_test\sphereofchon.mdl</code> and <code>models\props_xen\moss_test\test_moss001.mdl</code> models. Both using <code>models/props_xen/moss_test/bubblemoss</code> texture. The final version of the game doesn't use this shader in any of the maps. May be incompatible with some shaders (as it was with [[$phong]]).
In {{bms|4}} it was used for <code>models\props_xen\moss_test\sphereofchon.mdl</code> and <code>models\props_xen\moss_test\test_moss001.mdl</code> models. Both using the <code>models/props_xen/moss_test/bubblemoss</code> texture. The final version of the game doesn't use this shader in any of the maps. May be incompatible with some shaders (as it was with [[$phong]]).
 
This shader was used in {{bmsbs|4}}. Besides moss, it was also used for dust caps and other small details.
 
This shader also should be good for a snow layer.
{{note|There is no {{hammer|4}} preview for this shader.}}
{{note|There is no {{hammer|4}} preview for this shader.}}
{{back | Black Mesa Level Creation}}
{{bug|hidetested=1|This shader doesn't blend with [[New Specular|new specular]] and [[$phong]].
{{expand|title=Examples.|
<gallery mode=nolines heights=256px widths=384px>
Black Mesa Screenshot 2024.01.14 - 11.48.45.07=.jpg|An example with [[LightmappedGeneric]]. The specular should be yellow instead of white.
Black Mesa Screenshot 2024.06.01 - 18.51.17.26=.jpg|An example with [[VertexLitGeneric]]. The specular should be green instead of white.
</gallery>
}}
}}


== Parameters and Effects ==
== Parameters and Effects ==
{{MatParam|$moss_enable|int|Toggle moss between enabled and disabled state. 1 - enabled, 0 - disabled.}}
{{MatParamDef|$moss_enable|bool|Toggle moss between enabled and disabled state. 1 - enabled, 0 - disabled.}}
{{MatParam|$moss_texture|texture|For [[LightmappedGeneric]], defines a [[diffuse]] texture that will use moss for color. For [[VertexLitGeneric]], defines a [[diffuse]] texture that will use moss and mix with [[normalmap]].
{{MatParamDef|$moss_texture|texture|For [[LightmappedGeneric]], defines a [[diffuse]] texture that will use moss for color. For [[VertexLitGeneric]], defines a [[diffuse]] texture that will use moss and mix with [[normalmap]].
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=290px>
File:moss1.png |<code>metal/metalgrate013a</code> ([[LightmappedGeneric]])
File:moss1=.jpg|<code>metal/metalgrate013a</code> ([[LightmappedGeneric]])
File:moss2.png |<code>dev/dev_ram_512_red </code> ([[LightmappedGeneric]])
File:moss2=.jpg|<code>dev/dev_ram_512_red </code> ([[LightmappedGeneric]])
File:moss3.png |<code>xen/moss00_d</code> ([[LightmappedGeneric]])
File:moss3=.jpg|<code>xen/moss00_d</code> ([[LightmappedGeneric]])
</gallery>
</gallery>
}}
}}
}}
}}
{{MatParam|$moss_ref_direction|vector3|Defines direction for moss, the numbers can be negative. Works in the same way for [[VertexLitGeneric]].
{{MatParamDef|$moss_ref_direction|vector3|Defines direction for moss, the numbers can be negative. Works in the same way for [[VertexLitGeneric]].
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1d.png |<code>$moss_ref_direction "[1 0 0]"</code>
File:moss1d=.jpg|<code>$moss_ref_direction "[1 0 0]"</code>
File:moss2d.png |<code>$moss_ref_direction "[0 1 0]</code>
File:moss2d=.jpg|<code>$moss_ref_direction "[0 1 0]</code>
File:moss3d.png |<code>$moss_ref_direction "[0 0 1]</code>
File:moss3d=.jpg|<code>$moss_ref_direction "[0 0 1]</code>
</gallery>
</gallery>
}}
}}
}}
}}
{{MatParam|$moss_angle_theta|float|Inner angle value. With [[LightmappedGeneric]], works only properly only for [[displacement]] surfaces. Results depend on <code>$moss_angle_phi</code> and <code>$moss_angle_falloff</code>. Works in similar way for [[VertexLitGeneric]].
{{MatParamDef|$moss_angle_theta|float|Inner angle value. With [[LightmappedGeneric]], works properly only on [[displacement]] surfaces. Results depend on <code>$moss_angle_phi</code> and <code>$moss_angle_falloff</code>. Works in a similar way for [[VertexLitGeneric]].
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1t-.png |<code>$moss_angle_theta 1, $moss_angle_phi 10, $moss_angle_falloff 0.5.</code>
File:moss1t-=.jpg|<code>$moss_angle_theta 1, $moss_angle_phi 10, $moss_angle_falloff 0.5.</code>
File:moss2t-.png |<code>$moss_angle_theta 5, $moss_angle_phi 10, $moss_angle_falloff 0.5.</code>
File:moss2t-=.jpg|<code>$moss_angle_theta 5, $moss_angle_phi 10, $moss_angle_falloff 0.5.</code>
File:moss3t-.png |<code>$moss_angle_theta 10, $moss_angle_phi 10, $moss_angle_falloff 0.5</code>
File:moss3t-=.jpg|<code>$moss_angle_theta 10, $moss_angle_phi 10, $moss_angle_falloff 0.5</code>
</gallery>
</gallery>
}}
}}
}}
}}
{{MatParam|$moss_angle_phi|float|Outer angle value. With [[LightmappedGeneric]], works only properly only for [[displacement]] surfaces. Results depend on <code>$moss_angle_theta</code> and <code>$moss_angle_falloff</code>. Works in similar way for [[VertexLitGeneric]].
{{MatParamDef|$moss_angle_phi|float|Outer angle value. With [[LightmappedGeneric]], works properly only on [[displacement]] surfaces. Results depend on <code>$moss_angle_theta</code> and <code>$moss_angle_falloff</code>. Works in similar way for [[VertexLitGeneric]].
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1p.png |<code>$moss_angle_theta 50, $moss_angle_phi 50, $moss_angle_falloff 0.5.</code>
File:moss1p=.jpg|<code>$moss_angle_theta 50, $moss_angle_phi 50, $moss_angle_falloff 0.5.</code>
File:moss2p.png |<code>$moss_angle_theta 50, $moss_angle_phi 100, $moss_angle_falloff 0.5.</code>
File:moss2p=.jpg|<code>$moss_angle_theta 50, $moss_angle_phi 100, $moss_angle_falloff 0.5.</code>
File:moss3p.png |<code>$moss_angle_theta 50, $moss_angle_phi 200, $moss_angle_falloff 0.5.</code>
File:moss3p=.jpg|<code>$moss_angle_theta 50, $moss_angle_phi 200, $moss_angle_falloff 0.5.</code>
</gallery>
</gallery>
}}
}}
}}
}}
{{MatParam|$moss_angle_falloff|float|Falloff value. With [[LightmappedGeneric]], works only properly only for [[displacement]] surfaces. Results depend on <code>$moss_angle_phi</code> and <code>$moss_angle_theta</code>. Works in similar way for [[VertexLitGeneric]].
{{MatParamDef|$moss_angle_falloff|float|Falloff value. With [[LightmappedGeneric]], works properly only on [[displacement]] surfaces. Results depend on <code>$moss_angle_phi</code> and <code>$moss_angle_theta</code>. Works in similar way for [[VertexLitGeneric]].
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1f.png |<code>$moss_angle_theta 10, $moss_angle_phi 200, $moss_angle_falloff 0.5.</code>
File:moss1f=.jpg|<code>$moss_angle_theta 10, $moss_angle_phi 200, $moss_angle_falloff 0.5.</code>
File:moss2f.png |<code>$moss_angle_theta 10, $moss_angle_phi 200, $moss_angle_falloff 10</code>
File:moss2f=.jpg|<code>$moss_angle_theta 10, $moss_angle_phi 200, $moss_angle_falloff 10</code>
File:moss3f.png |<code>$moss_angle_theta 10, $moss_angle_phi 200, $moss_angle_falloff 500</code>
File:moss3f=.jpg|<code>$moss_angle_theta 10, $moss_angle_phi 200, $moss_angle_falloff 500</code>
</gallery>
</gallery>
}}
}}
}}
}}
{{MatParam|$moss_blend_factor|float|Moss blend factor. Use values from 0 to 1, other works incorrectly.
{{MatParamDef|$moss_blend_factor|float|Moss blend factor. Use values from 0 to 1, others do not work correctly.
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1b.png |<code>$moss_blend_factor 0.5</code>
File:moss1b=.jpg|<code>$moss_blend_factor 0.5</code>
File:moss2b.png |<code>$moss_blend_factor 0.8</code>
File:moss2b=.jpg|<code>$moss_blend_factor 0.8</code>
File:moss3b.png |<code>$moss_blend_factor 1.0</code>
File:moss3b=.jpg|<code>$moss_blend_factor 1.0</code>
</gallery>
</gallery>
}}
}}
}}
}}
{{MatParam|$moss_scale|float|Scale for moss. Deprecated and non-functional. Use [[$seamless_scale]] instead, it will scale the moss texture.
{{MatParamDef|$moss_scale|float|Scale for moss. Deprecated and non-functional. Use [[$seamless_scale]] instead.}}
{{MatParamDef|$moss_scale_turn_on_absolute|bool|Toggle moss scale between enabled and disabled state. 1 - enabled, 0 - disabled. Affects nothing at least in {{bms|4|nt=2}}.|deprecated=1}}
{{MatParamDef|$seamless_scale|float|This parameter scales texture for this shader.
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<gallery mode=packed heights=290px>
<gallery mode=packed heights=310px>
File:20240602164627_1.jpg|<code>$seamless_scale 0</code>
File:20240602164627_1.jpg|<code>$seamless_scale 0</code>
File:20240602164614_1.jpg|<code>$seamless_scale 0.003</code>
File:20240602164614_1.jpg|<code>$seamless_scale 0.003</code>
</gallery>
</gallery>
}}
}}
|deprecated=1}}
}}
{{MatParam|$moss_scale_turn_on_absolute|bool|Toggle moss scale between enabled and disabled state. 1 - enabled, 0 - disabled. Effects nothing at least in {{bms|4|nt=2}}.|deprecated=1}}
 
==Bugs/Limitations==
====Incompatible with new specular shader====
New specular shader doesn't blending with moss shader.
<gallery mode=nolines heights=256px widths=384px>
Black Mesa Screenshot 2024.01.14 - 11.48.45.07.png|An example with [[LightmappedGeneric]]. The specular should be yellow and not white.
Black Mesa Screenshot 2024.06.01 - 18.51.17.26.png|An example with [[VertexLitGeneric]]. The specular should be green and not white.
</gallery>


== See also ==
== See also ==
* [[New Specular]]
* [[New Specular]]
* [https://chetanjags.wordpress.com/2022/06/01/blackmesa-xenengine-part1-a-heavily-modified-source-engine/ BlackMesa XenEngine: Part1 – Heavily Modified Source Engine] (page from Black Mesa developer about Black Mesa engine, better known as [[XenEngine]])
* [https://chetanjags.wordpress.com/2022/06/01/blackmesa-xenengine-part1-a-heavily-modified-source-engine/ BlackMesa XenEngine: Part1 – Heavily Modified Source Engine] (page from Black Mesa developer about Black Mesa engine, better known as [[XenEngine]])
[[Category:Black Mesa]][[Category:Shaders]]

Latest revision as of 12:06, 23 August 2025

English (en)Translate (Translate)

$moss_enable is a material shader parameter available in Black Mesa Black Mesa.

Moss shader example with LightmappedGeneric, for $moss_texture used xen/moss00_d.
Moss shader example with VertexLitGeneric, for $moss_texture used models/props_xen/moss_test/bubblemoss.

This is procedural moss implementation, which is triplanar projection shader that allows you to project additional texture that mixes with normalmap. This shader available for VertexLitGeneric, LightmappedGeneric and Lightmapped_4WayBlend shaders. It was created during development of Xen for Black Mesa Black Mesa and was designed to simulate presence of moss on surface.

For VertexLitGeneric, it uses the specified texture. For LightmappedGeneric and Lightmapped_4WayBlend, instead of using the texture itself for moss, this shader takes color that most of the texture consists of and then applies color to the surface according to the parameters specified in .vmt. All parameters works in the same way for both shaders.

In Black Mesa Black Mesa it was used for models\props_xen\moss_test\sphereofchon.mdl and models\props_xen\moss_test\test_moss001.mdl models. Both using the models/props_xen/moss_test/bubblemoss texture. The final version of the game doesn't use this shader in any of the maps. May be incompatible with some shaders (as it was with $phong).

This shader was used in Black Mesa: Blue Shift Black Mesa: Blue Shift. Besides moss, it was also used for dust caps and other small details.

This shader also should be good for a snow layer.

Note.pngNote:There is no Hammer Hammer preview for this shader.
Icon-Bug.pngBug:This shader doesn't blend with new specular and $phong.
Examples.

Parameters and Effects

Toggle moss between enabled and disabled state. 1 - enabled, 0 - disabled.
For LightmappedGeneric, defines a diffuse texture that will use moss for color. For VertexLitGeneric, defines a diffuse texture that will use moss and mix with normalmap.
Examples.


Defines direction for moss, the numbers can be negative. Works in the same way for VertexLitGeneric.
Examples.


Inner angle value. With LightmappedGeneric, works properly only on displacement surfaces. Results depend on $moss_angle_phi and $moss_angle_falloff. Works in a similar way for VertexLitGeneric.
Examples.


Outer angle value. With LightmappedGeneric, works properly only on displacement surfaces. Results depend on $moss_angle_theta and $moss_angle_falloff. Works in similar way for VertexLitGeneric.
Examples.


Falloff value. With LightmappedGeneric, works properly only on displacement surfaces. Results depend on $moss_angle_phi and $moss_angle_theta. Works in similar way for VertexLitGeneric.
Examples.


Moss blend factor. Use values from 0 to 1, others do not work correctly.
Examples.


Scale for moss. Deprecated and non-functional. Use $seamless_scale instead.
Toggle moss scale between enabled and disabled state. 1 - enabled, 0 - disabled. Affects nothing at least in Black Mesa Black Mesa: Definitive Edition.
This parameter scales texture for this shader.
Examples.

See also