Basic texture for water (solved)

Mar 23, 2013
1,013
347
I have a simple texture I want to be compiled as water:

It looks like this:
9UWvsWX.png


But what do I have to put in the VMT to make this texture visible on the water? no additional effects are necessary. Kinda like the toxic water in Portal 1: https://developer.valvesoftware.com/w/images/7/7e/PoisonWater.jpg
 

DrSquishy

we've all had better times to die
aa
Feb 10, 2017
1,297
974
I checked some water VMT files and here are some examples:
//"$nofresnel" "1"

$underwateroverlay "effects/water_warp"
"$envmap" "env_cubemap"
"$refracttexture" "_rt_WaterRefraction"
"$refractamount" ".32"
//"$refracttint" "{191 179 155}"
"$refractblur" "1"



"$scale" "[1 1]"

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

"$surfaceprop" "water"
"$bottommaterial" "water/water_2fort_beneath.vmt"
"$bumpframe" "0"

"$fogenable" 1
"$fogcolor" "{51 43 13}"
"$fogstart" "-100"
"$fogend" "400"

"$temp" "[0 0]"
"$curr" 0.0
"$curr2" 0.0

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

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

"Sine"
{
"sineperiod" "24"
"sinemin" -0.5
"sinemax" 0.5
"resultVar" "$curr"
}
"Sine"
{
"sineperiod" "16"
"sinemin" 0.5
"sinemax" -0.5
"resultVar" "$curr2"
}

"Equals"
{
"srcVar1" "$curr2"
"resultVar" "$temp[0]"
}
"Equals"
{
"srcVar1" "$curr"
"resultVar" "$temp[1]"
}


"TextureTransform"
{
"translateVar" "$temp"
"resultVar" "$bumptransform"
}

// "TextureScroll"
// {
// "texturescrollvar" "$bumptransform"
// "texturescrollrate" .1
// "texturescrollangle" 45.00
// }
"WaterLOD"
{
// fixme! This has to be here, or material loading barfs.
"dummy" 0
}
}
}
and
"$refracttexture" "_rt_WaterRefraction"
"$refractamount" ".12"
// "$refracttint" "{57 54 44}"
"$refractblur" "1"



"$scale" "[1 1]"

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

"$surfaceprop" "water"
"$bottommaterial" "water/water_2fort_beneath.vmt"
"$bumpframe" "0"

"$fogenable" 1
"$fogcolor" "{57 54 44}"
"$fogstart" "0"
"$fogend" "300"

"$temp" "[0 0]"
"$curr" 0.0
"$curr2" 0.0

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

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


"TextureScroll"
{
"texturescrollvar" "$bumptransform"
"texturescrollrate" .6
"texturescrollangle" 10.00
}
"WaterLOD"
{
// fixme! This has to be here, or material loading barfs.
"dummy" 0
}
}
}
I found these in C:\Program Files\Steam\steamapps\common\SourceFilmmaker\game\tf\materials\water . This will be slightly different for you, as I am using 32 bit windows. Hope this helps
 
Mar 23, 2013
1,013
347
Well I was already looking at serveral examples, but the water aways showed up bright white. I'm downloading Portal at the moment to see how this texture was done. Someone told me it's using $basetexture despite the VDW implying that it can't be used for water shader.
 
Last edited:
Mar 23, 2013
1,013
347
Ok after more unsuccesfull experiments I looked at Portal's vmt. Turns out it's not even using the Water shader. It's LightMappedGeneric. And it uses %CompileSlime. What is this sorcery? o_O http://i.imgur.com/nDjXC41.png

Well copy/pasting everything did the job. My water now only lacks the underwater fog and I think it just doesn't work in Tf2, but I can live with that.
 
Last edited:

DrSquishy

we've all had better times to die
aa
Feb 10, 2017
1,297
974
Ok after more unsuccesfull experiments I looked at Portal's vmt. Turns out it's not even using the Water shader. It's LightMappedGeneric. And it uses %CompileSlime. What is this sorcery? o_O http://i.imgur.com/nDjXC41.png

Well copy/pasting everything did the job. My water now only lacks the underwater fog and I think it just doesn't work in Tf2, but I can live with that.
I think the fog is possible:
"$fogenable" 1
"$fogcolor" "{57 54 44}"
"$fogstart" "0"
"$fogend" "300"
I kept finding lines like this in some of the vmts. This one was from water_2fort_beneath
 
Mar 23, 2013
1,013
347
Yep I'm using those parameters. I have copy pasted the entire VMT (the link from before is the original Portal VMT) and only edited the $basetexture and $bottommaterial. But the fog doesn't work. I guess %CompileSlime is just a little broken for Tf2 like all other forgoten features.
 

DrSquishy

we've all had better times to die
aa
Feb 10, 2017
1,297
974
Yep I'm using those parameters. I have copy pasted the entire VMT (the link from before is the original Portal VMT) and only edited the $basetexture and $bottommaterial. But the fog doesn't work. I guess %CompileSlime is just a little broken for Tf2 like all other forgoten features.
What if you need separate textures just for the fog? Or maybe a fog controller?
 
Mar 23, 2013
1,013
347
What if you need separate textures just for the fog? Or maybe a fog controller?

Doubt it, water texture's fog is defined by the parameters only and the fog controllers are unrelated to water. The portal texture even uses the fog parameters like a regular %compileWater texture.

The only potential error I can think of is that I specified the bottommaterial incorrectly. But unlike water textures, the portal texture specifies a bottom material without puting a ".vmt" at its end, while tf2 water textures do (because it is supposed to link to a material file, not a texture). It's weird, but I already played around tried various values for that parameter, following examples in that portal texture and tf2 textures but nothing worked out, which makes me pretty certain that fog just doesn't work with %compileSlime in TF2.

%compileslime is the same as %compilewater, except all splash effects are green instead of white.

Nope they are still white. It's probably a portal thing... but If I can use %compilewater on a lightmappedgeneric shader as well, perhaps then the fog works? I gotta experiment more...
 
Mar 23, 2013
1,013
347
All %compilewater does is tell VBSP that the brush this material is applied to should be a water brush. It works with most material properties and shaders other than that.

Weird thing is, if I turned %CompielSlime into %CompileWater, the texture above the water broke, could just be a typo or oversight, buuuut I just figured out why the fog didn't work with the Slime:

I am incompetent and made a typo with $bottommaterial

Well, thanks for sticking with me anyway. I'm happy I got it to work.
 
Last edited:
Mar 23, 2013
1,013
347
%compileslime is the same as %compilewater, except all splash effects are green instead of white.

Actually, I think the green splash effect is missing in TF2 because now I'm getting the error- particle effects when ever a ragdoll plunges into the water.

But I fixed it by just using %CompileWater instead. Anyway, CompileWater works now and CompileSlime is just broken. Thanks for the help~
 

Tumby

aa
May 12, 2013
1,084
1,192
I did this once years ago and I basically copy-pasted the hydro water.
I think that I actually managed to get fog to work, or maybe I'm just remembering things wrong. I will try to recreate it, as I have deleted the files long ago.
EDIT: Reread thread. I read too quickly first time and didn't fully understand that a broken bottommaterial causes fog to break. Guess I don't have to do anything after all.
 
Mar 23, 2013
1,013
347
It's fine now. Fog was only an issue cos I made a typo, and I by using LightMappedGeneric (instead of the water shader) with %CompileWater gave me the desired result. Confusing documentation and broken features made this thread longer than it needed
 
Mar 23, 2013
1,013
347
Hm, that's certainly interesting since I already tried to use $basetexture with the water shader but it didn't work. Could have been a oversight on my part but since the wiki stated "there is no $basetexture" for the water shader I just gave up on it.
Does Hydro's $basetexture even work? It doesn't look much different from other water textures besides its color irrc.
 

Tumby

aa
May 12, 2013
1,084
1,192
Again, hydro is using LightMappedGeneric instead of Water. And yes, it does indeed show up. Theres one catch, however.
The texture itself is garbage. It has clamping for S and T enabled, meaning it's a solid color unless you are at the origin of the map (which doesn't happen on hydro). If you remove this clamping, you will see that the texture is still garbage. The alpha is messed up at the border of the texture, making the tiling as noticable as playing minecraft.
 

henke37

aa
Sep 23, 2011
2,075
515
Depressed how? As in being sad and unwilling to do stuff?