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

Func water analog: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(42 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{base brush|func_water_analog}}
{{LanguageBar}}


==Entity description==
{{CD|CFuncMoveLinear|file1=func_movelinear.cpp}}
It moves linearly along a given distance, in a given direction.
{{this is a|brush entity|name=func_water_analog}} It's a version of {{ent|func_movelinear}} slightly specialized for use as water.


Only two [[material]]s are known to render correctly across all systems, these are <code>nature/water_movingplane</code> and <code>nature/water_dx70</code>. This is ostensibly because of how the material effects on the more complex water [[shader]]s require static brushes, so they can optimize what's visible to the water surface. A moving water surface would break this effect, so therefore full water shaders are unusable on a moving surface.
{{important|Does not work with the {{ent|water (shader)|alt=Water}} shader.<br>{{ent|Refract}} can be used as a workaround for dynamic refraction with cubemapped reflections, although Valve does not provide any materials which do this.<br>Existing materials which are compatible include:
* {{file|nature/water_movingplane|vmt}} ([[LightmappedGeneric]])
* {{file|nature/water_dx70|vmt}} ([[LightmappedGeneric]])
* {{file|nature/hazard_liquid|vmt}} ([[LightmappedGeneric]]) {{only|{{portal}}}}
* {{file|liquids/!greenslime|vmt}} ([[UnlitTwoTexture]]) {{only|{{hls}} {{hldms}} {{jbep3}} }}
{{Confirm|Does the Water shader work if using cubemap reflections and refractions, instead of the real-time versions? This would still be beneficial for the ability to have two normal maps scrolling in different directions.}} }}


{{bug|Doesn't behave properly in {{l4d2}}! Physics don't behave properly if affected by this brush and graphical glitches can occur. Use sparingly and cautiously!}}
{{bug|Water must be part of the world in {{l4ds|4}} otherwise it doesn't work properly and acts as non-solid brush.|hidetested=1}}


== Keyvalues ==
{{FuncMoveLinear notes}}
{{KV|Move Direction (Pitch Yaw Roll)|angle|The direction the water will move, when told to '<code>Open</code>'.}}
{{KV|Start Position|float|Position of the water brush when spawned. The range is a value between 0.0 and 1.0, where 0 is the starting position and 1 is the starting position + (move direction * move distance).}}
{{KV|Speed|integer|The speed that the water brush moves, in inches per second.}}
{{KV|Move Distance|float|The distance from the starting point that the water brush should move, in inches.}}
{{KV|Sound played when the water brush starts moving.|sound}}
{{KV|Sound played when the water brush stops moving.|sound}}
{{KV|Wave Height|string|Legacy keyvalue from GoldSrc}}
{{KV Targetname}}
{{KV Parentname}}
{{KV Origin}}


== Inputs ==
{{bug|hidetested=1|In {{bms|4}}, if this entity uses multiple brushes, [[VPhysics]] objects work incorrectly with this entity (the same for {{ent|func_water|engine=source}}). It looks like they are using [[Bounding box|BBox]] of this entity to calculate physics, instead of using brushes. This issue can be found in '''Interloper''' chapter. Separate water into several separate entities to avoid this bug.
{{IO|Open|Move the water brush to the end position (starting position + (move direction * move distance)).}}
{{expand|title=Examples.|
{{IO|Close|Move the water brush to the starting position.}}
[[File:wateran1.jpg| thumb | left | 710px |Note how the hat is "flying in air".]]
{{IO|SetPosition|Move the water brush to a specific position between 0.0 and 1.0, where 0 is the starting position and 1 is the starting position + (move direction * move distance).|param=string}}
[[File:wateran2.jpg| thumb | right | 710px |Note how the hat is "flying in air".]]
{{I Targetname}}
}}
{{I Parentname}}
}}


== Outputs ==
{{codenote|Both <code>func_water_analog</code> and {{ent|func_movelinear}} are linked to [[CFuncMoveLinear]] C++ class. The game code checks the {{mono|classname}} KV to distinguish between them.}}
{{IO|OnFullyOpen|Fired when the water brush reaches the end position (starting position + (move direction * move distance)).}}
{{IO|OnFullyClosed|Fired when the water brush reaches the starting position.}}
{{O Targetname}}


== See also ==
==Keyvalues==
* [[Moving Water]]
{{KV|Water Material|intn=WaterMaterial|material|The material to derive water information from. Determines $underwateroverlay that use {{ent|func_water_analog}}.|only=BMS}}
:{{Bug|Don't work after reload. You still can repeat this effect with trigger and {{ent|env_screenoverlay}}.|hidetested=1}}
{{KV|Wave Height|intn=WaveHeight|string|only=BMS}}


{{sfx_brush}}
[[Category:Water]]


==Tutorials about Func_Water_Analog (Russian)==
{{OtherKIO|func_movelinear}}
Lessons created by [https://vk.com/project_source Project-S]
 
==See also==
*[[Moving water (Source)|Moving water]]


*[https://www.youtube.com/watch?v=jfBaC3F3kaY Func_Water_Analog (Вода в движении - вертикально)]
[[Category:SFX_Brush_Entities]]
[[Category:Water]]

Latest revision as of 15:23, 24 May 2025

English (en)Translate (Translate)
C++ Class hierarchy
CFuncMoveLinear
CBaseToggle
CBaseEntity
C++ func_movelinear.cpp

func_water_analog is a brush entity available in all Source Source games. It's a version of func_movelinear slightly specialized for use as water.

Icon-Important.pngImportant:Does not work with the Water shader.
Refract can be used as a workaround for dynamic refraction with cubemapped reflections, although Valve does not provide any materials which do this.
Existing materials which are compatible include:
Confirm:Does the Water shader work if using cubemap reflections and refractions, instead of the real-time versions? This would still be beneficial for the ability to have two normal maps scrolling in different directions.
Icon-Bug.pngBug:Water must be part of the world in Left 4 Dead seriesLeft 4 Dead series Left 4 Dead series otherwise it doesn't work properly and acts as non-solid brush.
Note.pngNote:The SetPosition input and Start Position keyvalue do not perform any bounds checking, so values less than 0 and greater than 1 can be used. Negative values will move in the opposite direction to the movement direction, and values greater than 1 will move it in multiples of the set Move Distance. Moving past the opened/closed position does not trigger the OnFullyOpen and OnFullyClosed outputs.
Icon-Bug.pngBug:There are bugs that may arise when parenting this entity to any of these: func_movelinear, func_lookdoor, func_water_analog. A func_door (or for func_water_analog, func_water) can be used as a workaround. (see here for a code fix)[ Code Fix]
Confirm:Might be fixed in Portal 2? Parented movelinears are used extensively for this game's piston platforms.
Icon-Bug.pngBug:In Black Mesa Black Mesa, if this entity uses multiple brushes, VPhysics objects work incorrectly with this entity (the same for func_water). It looks like they are using BBox of this entity to calculate physics, instead of using brushes. This issue can be found in Interloper chapter. Separate water into several separate entities to avoid this bug.
Examples.
Note how the hat is "flying in air".
Note how the hat is "flying in air".
Cpp.pngCode:Both func_water_analog and func_movelinear are linked to CFuncMoveLinear C++ class. The game code checks the classname KV to distinguish between them.

Keyvalues

Water Material (WaterMaterial) <material> (only in Black Mesa)
The material to derive water information from. Determines $underwateroverlay that use func_water_analog.
Icon-Bug.pngBug:Don't work after reload. You still can repeat this effect with trigger and env_screenoverlay.
Wave Height (WaveHeight) <string> (only in Black Mesa)


Note.pngNote:Other Keyvalues / Inputs / Outputs are same as func_movelinear.

See also