[TUTORIAL] Flowing Water

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
Ok since you guys make nice tutorials im gonna make one too.
You all know how to make water that stands still right? Now I am gonna teach you how to make "flowing water".
Dont think its ultra fancy it looks shit tbh but I am going to use it for waterfalls etc etc.
Basically its just a plane that moves a texture.

Lets go!

STEP 1

Make a texture that you want to be "water". I have a nice texture at the bottom of the thread for you to download.
Resolution: I prefer 512x512 AND make sure its a .vtf if you export with some alpha involved so you can see trough it a bit.
Save the .vtf as waterflow01.vtf



STEP 2


Teh vmt, you make a .txt file and you paste this in it:

UnLitGeneric
{
"$basetexture" "cp_vulcano/waterflow01" // Texture (.vtf) that this material uses
"$translucent" "1" // Material should be rendered as translucent
"$nocull" "1" // Material should be rendered when viewed from either side
"$surfaceprop" "water" // Type of surface; determines bullet impacts etc...
"$decal" "1" // This is a decal / overlay

"Proxies"
{
// Texture scrolls over time
"TextureScroll"
{
"texturescrollvar" "$baseTextureTransform"
"texturescrollrate" ".15" // Speed of scrolling
"texturescrollangle" "270.00" // Direction of scrolling
}
}
}

The // means that its commented so the engine ignores the text and it's easy for you to understand what the actual code means.

NOTE: CHANGE THE CP_VULCANO TO YOUR MAPNAME!

Now save the .txt and rename it to waterflow01.vmt

STEP 3

The files, where to place them?

Easy, go to steam\steamapps\<UR STEAM NAME>\team fortress 2\tf\materials\

there, create a folder that is like your mapname, like you write in the .vmt earlyer.

So for me its D:\steam\steamapps\<UR STEAM NAME>\team fortress 2\tf\materials\cp_vulcano

Past the .vmt and .vtf there et voila, restart hammer, make something ultra cool and compile.

Want to have my textures to take a look?

DOWNLOAD HERE:
http://jeroendessaux.be/flowingwater.rar
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Why is the $decal flag in there? It isn't being used as one.

The $translucent flag requires alpha channel work in the VTF, if one isn't real good with alpha channels it's also possible to use $alpha <value from 0-1> to set an overall transparency that works without an alpha channel in the VTF.

Also, this material will not be water, it will be solid to everything and you'd have to put it on a func_illusionary if people were to go in it, and then they still wouldn't swim. The %compilewater flag is needed for the compile tools to create water that can be swam in, but once you add that the material needs to get a lot more complex.
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
ive read what youve said with interest. Although all this isnt nessesairy for what im planning to use it for. I want waterfalls and people cant swim in a waterfall as far as i know :D

But thanks for clearing things up mate.
 

Intraman

L4: Comfortable Member
Nov 4, 2007
191
0
But Tutorials should more generic. (otherwise you should have said "waterfall tutorial" instead).
For example, would one be able to use this technique for making flowing rivers, or simply any other type of flowing water other then water falls?

(not to say its a bad thing to have a tutorial like this. Just trying to help clear things up, y'know.)
 

Armadillo of Doom

Group Founder, Lover of Pie
aa
Oct 25, 2007
949
1,228
Very cool. Might even be able to do a stormy river or something.
 

Logo

L3: Member
Oct 25, 2007
115
26
Could you conceivably make a func_illusionary with this then place a water brush below/in this but give it something like a nodraw texture? Maybe there's a better way to do flowing water but just thought I'd mention this.
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
the best way to do water is model the waterflow and give it a moving texture like cs militia or de wanda.

Too bad there is no water engine in the source engine that simulates real water.

Now we are on the topic, does anybody has ideas how to fake water clouds by cause of the splash the water makes at the bottom of the waterfall?
 

Nizzem

L2: Junior Member
Nov 29, 2007
57
0
maybe a white func_dustcloud? I don't know if it would work... just an idea.
 

Crimson

L3: Member
Nov 25, 2007
119
1
Could you perhaps enlighten me how I could go about using the cheap hydro water with this tutorial? I am trying to make a waterfall dropoff and I cannot for the life of me figure out how to do it to match the cheap hydro water.
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
THe hydro waters are shaders. They can only work on horizontal faces as far as I know. This tutorial works with a single textures that moves around a brush (so its scrolls down).
 

Crimson

L3: Member
Nov 25, 2007
119
1
So is there anyway that I can make water that looks remotely like the hydro water for a waterfall?
 
Last edited:

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Incorrect.

Hydro water is cheap and just uses cubemaps for reflection rather than the water shader with real-time reflection and refraction, which only works properly on a single horizontal plane. It's easy enough to convert the hydro water into something for use on a waterfall...

hydroscroll0000.gif

(not representative of true in-game scroll speed)

When on a vertical surface the material will always scroll downward (if you don't change the angle of the material), and I do not recommend using it on a horizontal surface, a different method of material creation would be better for that. Lastly, remember to make your waterfall brush a func_illusionary, with nodraw on all sides except the water faces (the water face will render from both sides, so no worry about nothing showing if you are behind the falls)
 
Last edited:

Crimson

L3: Member
Nov 25, 2007
119
1
It works and looks excellent. The one problem I ran into is when I am anywhere in the vicinity of it, it causes my FPS to go from 200 to 20. I checked Showbudget and it said Dynamic Lighting was maxed out (the little bar). Is this something I can fix?
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
ooohh nice boojum! I believe i was wrong than :(

Well, everybody learns 1 thing every day.
 

Intraman

L4: Comfortable Member
Nov 4, 2007
191
0
hrmm I donno, that water texture doesn't really make a good looking waterfall texture. but as long as it works I suppose.
 

Crimson

L3: Member
Nov 25, 2007
119
1
It looks much better in game, the 20 FPS kills it though lol.

Is it actually using dynamic lighting in the texture file or something? I don't have any on my map and it maxes dynamic lighting out on showbudget.
 

Intraman

L4: Comfortable Member
Nov 4, 2007
191
0
How close do you have to get before it lowers the FPS? Maybe you could just put it far away enough so that it doesn't effect game play but still is veiwable. Y'know if you can't find a solution.