func_water_analog workaround

ChickenLover

L2: Junior Member
Jun 28, 2008
95
19
I'm working on a level that uses a func_water_analog to raise and lower the water level. Unfortunately the entity has some serious flaws which are from the entity only being able to use two water textures both of which are very ugly and very old DirectX wise. The problems with the entity are:

a) There is no fog underwater.
b) Looking at the surface of the water from within appears clear and does not look like water at all.
c) Using any other texture besides the two that work makes looking at the surface of the water from within completely black.

The issue with the surface seems to be an engine limitation dealing with shaders (hopefully only tied to BSP and BSP entities). I've tried using a func_brush and a func_illusionary parented to the func_water_analog but both have the same result. It seems as soon as the texture is applied to a BSP block that moves, it is unable to render the surface correctly.

I was thinking that perhaps I might be able to make a model of a 2D plane that uses the water shader. Then I could use that model with a prop_dynamic and move it with the water. I'm not quite sure how to tie the shader to the model though. Any ideas on how this could be done? If you think you have another solution please share as well. Also, if you think you might know a way to fake the fog that would be excellent.
 

Ezekel

L11: Posh Member
Dec 16, 2008
818
245
well one thing that comes to mind is that there's a level in hl2 where you have to raise the water level in the sewers during part where you're trying to escape c17 to get to the speedboat part. - that water had underwater-fog and appeared as detailed as any other water in the game.
i'd suggest finding the map for that and decompiling to see how it was done, my guess is that it's a func_door with water texture on the surface, and nodraw on all other faces, but i have a feeling that using a func_door means when the water height changes, any players inside the water will be dragged with it, possibly embedding them in world brushes as a result.
 
Feb 14, 2008
1,051
931
No.. there's a specific texture that Valve used on func_water_analogs, maybe if you inspected that texture, and applied similar propterties to the .vmf of a tf2 texture you could make it work.
 

ChickenLover

L2: Junior Member
Jun 28, 2008
95
19
The water in the city escape doesn't look very good. It looks fine from the surface but once you get underwater it looks awful. I decompiled the level and it uses one of the two textures that work with the func_water_analog. The fog did look like it was working though.

The problem with these textures is all they are doing it using a texture and transparency. All of the other water types use shaders and other effects to make it look a lot better. Example:

water_movingplane_beneath.vmt

"UnlitGeneric"
{
"$basetexture" "dev/water_moving_beneath"
"$bumpmap" "dev/water_normal"
// "$additive" "1"
"$translucent" "1"
"$surfaceprop" "water"
"%keywords" "wasteland"
"%compilewater" 1
"$abovewater" 0
}

vs

water_well_beneath.vmt

"Water"
{
"%keywords" "tf"
"$forceexpensive" 1

"$abovewater" 0
"%compilewater" 1
"$CHEAPWATERSTARTDISTANCE" 500.0
"$CHEAPWATERENDDISTANCE" 1000.0
// bottom materials shouldn't use $envmap!!! They won't work if they do.
// "$envmap" "env_cubemap"
"%tooltexture" "dev/water_normal"
"$refractamount" ".2"
"$refracttint" "[0.95 1.0 0.97]"

"$reflectamount" "1.0"
"$reflecttint" "[1 1 1]"

// "$reflecttexture" "_rt_WaterReflection"
"$refracttexture" "_rt_WaterRefraction"


<dx90
{
"$fallbackmaterial" "water/water_well_beneath_dx80"
}

"$scale" "[1 1]"

"$blurrefract" "1"
// "$bumpmap" "water/tfwater001_dudv"
"$normalmap" "water/tfwater001_normal"

$underwateroverlay "effects/water_warp_well"
"$surfaceprop" "water"
"$bumpframe" "0"

"$fogenable" 1
// "$fogcolor" "{0 0 0}"
"$fogcolor" "{24 38 53}"
"$fogstart" -350
"$fogend" 1550.00

"Water_DX60"
{
"$fallbackmaterial" "nature/water_dx70_beneath"
}

"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$normalmap"
"animatedtextureframenumvar" "$bumpframe"
"animatedtextureframerate" 30.00
}

"TextureScroll"
{
"texturescrollvar" "$bumptransform"
"texturescrollrate" .05
"texturescrollangle" 45.00
}

"WaterLOD"
{
}
}
}

As soon as I apply any of those shaders, the effect will break. This is why I was thinking of just having it use a transparent texture and faking the effect with a prop_dynamic that uses the shader being used in water_well_beneath.vmt. I just don't know how to go about getting that shader applied to a model.