Liquid materials: Difference between revisions
Jump to navigation
Jump to search

Note:If the above water material does not have reflections, refractions, or $underwateroverlay: $abovewater can be omitted, $nocull can be used, and $bottommaterial can be set to the same material as the abovewater material.
SirYodaJedi (talk | contribs) (→Fog) |
No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{stub}} | {{stub}} | ||
{{LanguageBar|title = Water (shader)}} | {{LanguageBar|title = Water (shader)}} | ||
[[Water]] does not ''need'' to use the {{mono|Water}} shader! If a less realistic effect is desired, or the water volume is oddly shaped, other shaders can be used, such as [[LightmappedGeneric]] or [[Refract]]. The method for creating the materials is the same. | [[Water]] does not ''need'' to use the {{mono|Water}} shader! If a less realistic effect is desired, or the water volume is oddly shaped, other shaders can be used, such as [[LightmappedGeneric]] or [[Refract]]. The method for creating the materials is the same. Liquids using using any shader other than Water will always be considered cheap. | ||
== Parameters == | == Parameters == | ||
{{ | {{MatParamDef|%CompileWater|bool|This is needed to make a map using the material compile properly.}} | ||
{{ | {{MatParamDef|%CompileSlime|bool|Can be used instead of %CompileWater to get different particles. Planar reflections don't work with this, due to not applying [[Surface flag|SURF_WARP]].}} | ||
}} | |||
{{ | {{MatParamDef|$abovewater|bool|Whether this material is used for above or below the water’s surface.<br> | ||
{{note|Not setting this in the VMT will automatically force it to 1. If not defined, a warning will appear saying <code>Need to set $abovewater for material x</code>}}}} | {{note|Not setting this in the VMT will automatically force it to 1. If not defined, a warning will appear saying <code>Need to set $abovewater for material x</code>}}}} | ||
{{ | {{MatParamDef|$bottommaterial|material|Required parameter. This is the material ('''not''' texture) to use when underneath the water’s surface. The bottom material must have <code>$reflecttexture</code>, <code>$abovewater</code> and <code>$envmap</code> disabled, but can otherwise do whatever it wants. {{tip|Add {{cmd|%notooltexture}} to the bottom material to hide it in the texture browser {{hammer++|not}}.}} }} | ||
{{note|If the above water material does not have reflections, refractions, or $underwateroverlay: $abovewater can be omitted, [[$nocull]] can be used, and $bottommaterial can be set to the same material as the abovewater material.}} | {{note|If the above water material does not have reflections, refractions, or $underwateroverlay: $abovewater can be omitted, [[$nocull]] can be used, and $bottommaterial can be set to the same material as the abovewater material.}} | ||
{{ | {{MatParamDef|$underwateroverlay|material|Applies a refracting screen overlay when the camera is underwater. Generally used with <code>effects\water_warp01</code>. Requires <code>$abovewater</code> to be 0.<br> | ||
{{note|This is technically not a parameter on the water shader, meaning it can be abused for other unintended purposes! The overlay may still be applied even when the underwater material is told not to render ( {{ent|$no_draw}})}}|since={{src07}}}} | {{note|This is technically not a parameter on the water shader, meaning it can be abused for other unintended purposes! The overlay may still be applied even when the underwater material is told not to render ( {{ent|$no_draw}})}}|since={{src07}}}} | ||
=== Fog === | === Fog === | ||
{{ | {{MatParamDef|$fogenable|bool|Enable volumetric fog for the water. Note that the [[Water (Shader)|Water]] shader will always have fog regardless of this parameter, but $fogstart and $fogend will not work without it. Optional for all other shaders.}} | ||
{{ | {{MatParamDef|$fogcolor|RGB matrix|Color of the water’s volumetric fog. Generally this value should match the color used in the bottom material.<br> | ||
{{Important| If this parameter is not defined in a VMT, the shader will force its value to <code>"[1 0 0]"</code> and spew an error message saying <code>Material x needs to have a $fogcolor.</code>}} | {{Important| If this parameter is not defined in a VMT, the shader will force its value to <code>"[1 0 0]"</code> and spew an error message saying <code>Material x needs to have a $fogcolor.</code>}} | ||
{{warning| | {{warning| | ||
Line 28: | Line 26: | ||
To calculate the eventual linear value that the shader is supplied with, apply the formula <code>x^(1/2.2)</code>{{tip|While expensive water cannot, cheap water ''can'' go higher than 1.0, achieving a more "neon" effect.}} }}}} | To calculate the eventual linear value that the shader is supplied with, apply the formula <code>x^(1/2.2)</code>{{tip|While expensive water cannot, cheap water ''can'' go higher than 1.0, achieving a more "neon" effect.}} }}}} | ||
{{ | {{MatParamDef|$fogstart|float|Distance in units/inches from the eye at which water fog starts. | ||
: {{warning|Must be 0 for edge fading to work properly.}}}} | : {{warning|Must be 0 for edge fading to work properly.}}}} | ||
{{ | {{MatParamDef|$fogend|float|Distance in units/inches from the eye at which water fog ends.}} | ||
=== Other === | === Other === | ||
{{ | {{MatParamDef|$surfaceprop|water|Tells the physics system that the surface is water. See [[$surfaceprop]].}} | ||
{{ | {{MatParamDef|%tooltexture|texture|Defines the texture Hammer will display in the material browser. Any texture can be used, but it is customary to use the [[$normalmap]].}} | ||
; <code>WaterLOD proxy</code> | ; <code>WaterLOD proxy</code> | ||
: This connects the [[water_lod_control]] entity in a level to the water’s internal parameters. This must be declared in the material for the LOD mechanisms to work properly. | : This connects the [[water_lod_control]] entity in a level to the water’s internal parameters. This must be declared in the material for the LOD mechanisms to work properly. | ||
[[Category:Water]] | [[Category:Water]] |
Latest revision as of 12:10, 23 August 2025


Water does not need to use the Water shader! If a less realistic effect is desired, or the water volume is oddly shaped, other shaders can be used, such as LightmappedGeneric or Refract. The method for creating the materials is the same. Liquids using using any shader other than Water will always be considered cheap.
Parameters
This is needed to make a map using the material compile properly.
Can be used instead of %CompileWater to get different particles. Planar reflections don't work with this, due to not applying SURF_WARP.
Whether this material is used for above or below the water’s surface.
Note:Not setting this in the VMT will automatically force it to 1. If not defined, a warning will appear saying

Need to set $abovewater for material x
Required parameter. This is the material (not texture) to use when underneath the water’s surface. The bottom material must have
Tip:Add %notooltexture to the bottom material to hide it in the texture browser (not in
).
$reflecttexture
, $abovewater
and $envmap
disabled, but can otherwise do whatever it wants. 


Applies a refracting screen overlay when the camera is underwater. Generally used with
Note:This is technically not a parameter on the water shader, meaning it can be abused for other unintended purposes! The overlay may still be applied even when the underwater material is told not to render ( $no_draw)
effects\water_warp01
. Requires $abovewater
to be 0.
Fog
Enable volumetric fog for the water. Note that the Water shader will always have fog regardless of this parameter, but $fogstart and $fogend will not work without it. Optional for all other shaders.
Color of the water’s volumetric fog. Generally this value should match the color used in the bottom material.
Important: If this parameter is not defined in a VMT, the shader will force its value to
Warning:
Tip:While expensive water cannot, cheap water can go higher than 1.0, achieving a more "neon" effect.

"[1 0 0]"
and spew an error message saying Material x needs to have a $fogcolor.

Cheap water treats this parameters as a linear value where 0.0 is 0% and 1.0 is 100%.
Expensive water treats this parameter as a Gamma value,
and due do this, each component ( red, green and blue respectively ) can not go above 1.0 or below 0.0 ( on expensive water )
x^(1/2.2)

Distance in units/inches from the eye at which water fog starts.
Warning:Must be 0 for edge fading to work properly.
Other
Tells the physics system that the surface is water. See $surfaceprop.
Defines the texture Hammer will display in the material browser. Any texture can be used, but it is customary to use the $normalmap.
WaterLOD proxy
- This connects the water_lod_control entity in a level to the water’s internal parameters. This must be declared in the material for the LOD mechanisms to work properly.