$moss enable: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 37: Line 37:
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=290px>
File:moss1=.jpg|<code>metal/metalgrate013a</code> ([[LightmappedGeneric]])
File:moss1=.jpg|<code>metal/metalgrate013a</code> ([[LightmappedGeneric]])
File:moss2=.jpg|<code>dev/dev_ram_512_red </code> ([[LightmappedGeneric]])
File:moss2=.jpg|<code>dev/dev_ram_512_red </code> ([[LightmappedGeneric]])
Line 47: Line 47:
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1d=.jpg|<code>$moss_ref_direction "[1 0 0]"</code>
File:moss1d=.jpg|<code>$moss_ref_direction "[1 0 0]"</code>
File:moss2d=.jpg|<code>$moss_ref_direction "[0 1 0]</code>
File:moss2d=.jpg|<code>$moss_ref_direction "[0 1 0]</code>
Line 57: Line 57:
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1t-=.jpg|<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-=.jpg|<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>
Line 67: Line 67:
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1p=.jpg|<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=.jpg|<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>
Line 77: Line 77:
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1f=.jpg|<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=.jpg|<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>
Line 87: Line 87:
{{expand|title=Examples.|
{{expand|title=Examples.|
<br>
<br>
<gallery mode=packed heights=510px>
<gallery mode=packed heights=290px>
File:moss1b=.jpg|<code>$moss_blend_factor 0.5</code>
File:moss1b=.jpg|<code>$moss_blend_factor 0.5</code>
File:moss2b=.jpg|<code>$moss_blend_factor 0.8</code>
File:moss2b=.jpg|<code>$moss_blend_factor 0.8</code>
Line 98: Line 98:
{{MatParam|$seamless_scale|float|This parameter scales texture for this shader.
{{MatParam|$seamless_scale|float|This parameter scales texture for this shader.
{{expand|title=Examples.|
{{expand|title=Examples.|
<gallery mode=packed heights=310px>
<gallery mode=packed heights=290px>
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>

Revision as of 13:11, 8 January 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:$seamless_scale is not compatible with $phong shader.
Example.
Icon-Bug.pngBug:This shader doesn't blend with new specular and $phong.
Examples.
Black Mesa Level Creation

Parameters and Effects

$moss_enable $moss_texture $moss_ref_direction $moss_angle_theta $moss_angle_phi $moss_angle_falloff $moss_blend_factor $moss_scale $moss_scale_turn_on_absolute $seamless_scale

See also