View Full Version : [TUTORIAL] Flowing Water
Snipergen
11-28-2007, 03:26 AM
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
11-28-2007, 01:33 PM
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
11-28-2007, 01:40 PM
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
11-29-2007, 11:54 AM
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.)
Immortal-D
11-29-2007, 12:00 PM
Very cool. Might even be able to do a stormy river or something.
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
11-30-2007, 12:27 PM
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
12-01-2007, 01:20 PM
maybe a white func_dustcloud? I don't know if it would work... just an idea.
Crimson
12-26-2007, 01:24 AM
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
12-26-2007, 04:40 AM
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
12-26-2007, 10:43 AM
So is there anyway that I can make water that looks remotely like the hydro water for a waterfall?
Crimson
12-29-2007, 07:01 PM
So theres no way for me to do this?
Snipergen
12-30-2007, 04:02 AM
nope srry
A Boojum Snark
12-30-2007, 06:53 PM
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...
http://img.photobucket.com/albums/v401/aboojumsnark/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)
Crimson
12-31-2007, 12:52 AM
You are my hero Boojum *_*
Crimson
12-31-2007, 02:57 AM
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
12-31-2007, 05:24 AM
ooohh nice boojum! I believe i was wrong than :(
Well, everybody learns 1 thing every day.
Intraman
12-31-2007, 08:33 AM
hrmm I donno, that water texture doesn't really make a good looking waterfall texture. but as long as it works I suppose.
Crimson
12-31-2007, 09:54 AM
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
12-31-2007, 09:57 AM
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.
Crimson
12-31-2007, 12:48 PM
Good idea but not a viable option for my map. Everything is inside of a cave and theres not a whole lot of moving going on. And its within about 2048 that my FPS goes to crap so a pretty good ways.
I am thinking it is just a setting that is going nuts. I dunno though... I am hoping Boojum has some idea why.
A Boojum Snark
12-31-2007, 01:40 PM
Not sure why that's happening, it didn't for me in my test map, and I never get near 200 fps to begin with so a drop would've been more noticeable. Would you send me the map and let me have a look myself? PM me a link if you have someplace to upload it, otherwise you can email me it, aboojumsnark [at] gmail.com
Crimson
01-01-2008, 12:14 PM
It seems to have fixed itself somehow. I have recompiled a couple times and after building cubemaps it does not seem to do it anymore. If I have the problem again I will shoot the vmf over to you.
Thanks very much man, it looks wonderful!
*Edit*
Just to make sure, this is fairly cheap correct? I have to large waterfalls in my main choke point and don't want everyone lagging out lol
A Boojum Snark
01-01-2008, 05:14 PM
It shouldn't be much more expensive than any other cubemapped surface. The deformation of the reflection might add a little bit more, but with everything else that is going on in a game I don't think it'd make much of a dent.
l3eeron
01-04-2008, 05:12 PM
Im using something similar to this with my water fall in avantiville...
I got a question for ya
How would one use a water texture on a vertical face? Can I change one of the attributes in the vmt to allow me to use water going up n down.... its just in the skybox so no one will be touching it:
http://i157.photobucket.com/albums/t51/l3eeon/cp_avantiville_b5_0060011.jpg
Right now its just a clear scrolling water texture... it needs a blue color underneath it, but it wont let me use water on a vertical face
A Boojum Snark
01-04-2008, 09:17 PM
You "cant" use a real water texture on a vertical surface. A real one with reflection, refraction and the color-tinting of stuff behind it just won't function properly on anything but a flat surface.
There are a plethora of VMT parameters that have to do with real water, and when making fake water like I did it's easier to start from something closer (the hydro cheap water).
My only suggestion (unless you just make a water-like image) if you really want your water looking bluer is to try tweaking the $envmaptint parameter over to the blue side (it's an RGB value, so raise the last number) which will make the cubemap reflection more blue.
vBulletin® v3.7.0 Release Candidate 2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.