[Solved] Custom water texture
Quote from iSpectra on January 14, 2013, 9:42 amHi there,
I seek some help with my custom water texture.
I created it and replaced to old, dirty looking on with hammer and everything works fine, except the fact that I'm now able to walk on it and it's not animated. So these two things are basically my questions. I also checked out Interlopers.net, but didn't find anything useful (Checked the water, waterfalls and custom textures tutorials).I attached the .vmf and .vtf files.
Best Regards,
iSpectra
Hi there,
I seek some help with my custom water texture.
I created it and replaced to old, dirty looking on with hammer and everything works fine, except the fact that I'm now able to walk on it and it's not animated. So these two things are basically my questions. I also checked out Interlopers.net, but didn't find anything useful (Checked the water, waterfalls and custom textures tutorials).
I attached the .vmf and .vtf files.
Best Regards,
iSpectra
????????????????????????????????????????????????????????Visit my Steam profile!
Quote from Lpfreaky90 on January 14, 2013, 10:05 amYour water texture is very basic; the vmt needs to be more complex in order to function properly.
- Code: Select all
"LightmappedGeneric"
{
"$basetexture" "custom/water"
"$translucent" 1
"$surfaceprop" "water"
"$envmap" "env_cubemap"
"%keywords" "water"
"%compilewater" 1
"$abovewater" 1
"$normalmapalphaenvmapmask" 1
// I'm not too sure about this part; cause I didn't check your vtf yet but probably the problem is in the vmt.
"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 21.00
}
"AnimatedTexture"
{
"animatedtexturevar" "$bumpmap"
"animatedtextureframenumvar" "$bumpframe"
"animatedtextureframerate" 21.00
}
}
}EDIT: this is the most basic water texure possible; not with fancy flow etc, but there are uses where a static water texture is prefered over a nice fancy flowing one. For a flowing one you'll need stuff that's in jose's post.
Your water texture is very basic; the vmt needs to be more complex in order to function properly.
- Code: Select all
"LightmappedGeneric"
{
"$basetexture" "custom/water"
"$translucent" 1
"$surfaceprop" "water"
"$envmap" "env_cubemap"
"%keywords" "water"
"%compilewater" 1
"$abovewater" 1
"$normalmapalphaenvmapmask" 1
// I'm not too sure about this part; cause I didn't check your vtf yet but probably the problem is in the vmt.
"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 21.00
}
"AnimatedTexture"
{
"animatedtexturevar" "$bumpmap"
"animatedtextureframenumvar" "$bumpframe"
"animatedtextureframerate" 21.00
}
}
}
EDIT: this is the most basic water texure possible; not with fancy flow etc, but there are uses where a static water texture is prefered over a nice fancy flowing one. For a flowing one you'll need stuff that's in jose's post.

Quote from josepezdj on January 14, 2013, 10:08 amHi, and welcome to the forums.
First of all, your main problem is the .vmt file. The water texture in Source engine is a shader, not a normal texture. This shader is called "Water". Read here about it. So you can't pretend to use a Lighmappedgeneric as water because the engine will not compile it as so, the engine thinks you have simply made a texture and texture a brush side.
In order to understand how a water material (.vmt) is made, I'd suggest you to check into Valve's materials. There are a lot of them. They're stored into your folder Portal 2/portal2, into a packed .vpk file called pak01_dir.vpk (you can open these with GTFScape).
As an example, look inside a Portal2 water material called Toxicslime_a1_Intro5.vmt below:
- Code: Select all
Water
{
$forceexpensive 1
$normalmap "liquids/water_river_normal_sharp"
$flowmap "liquids/sp_a1_intro5_hflowmap"
$flow_normaluvscale 160
$flow_worlduvscale 0.5
$flow_timeintervalinseconds 0.6
$flow_uvscrolldistance 0.1
$flow_bumpstrength 1
$flow_noise_texture "liquids/water_noise"
$flow_noise_scale 0.001
$flow_debug 0
$basetexture "liquids/toxicslime_color"
$color_flow_uvscale 300
$color_flow_timeintervalinseconds 5
$color_flow_uvscrolldistance 0.11
$color_flow_lerpexp 1
$color_flow_displacebynormalstrength 0.01
$reflecttexture _rt_WaterReflection
$reflectamount "0.1"
$reflecttint "{ 240 240 192 }"
$reflectskyboxonly 0
$reflectonlymarkedentities 1$abovewater 1
$bottommaterial "nature/toxicslime002a_beneath"
$fogenable 1
$fogstart 0
$fogend 100
$lightmapwaterfog 1$fogcolor "{ 58 35 20 }"
$flashlighttint 1
"%compilewater" 1
"%tooltexture" "nature/water_frame01_normal"
$surfaceprop slime
}The second problem you have is that you are using a .vtf texture without an alpha channel. This is important because the water shader makes us of the alpha channel to fake the movement...
I hope this will help for starters
Hi, and welcome to the forums.
First of all, your main problem is the .vmt file. The water texture in Source engine is a shader, not a normal texture. This shader is called "Water". Read here about it. So you can't pretend to use a Lighmappedgeneric as water because the engine will not compile it as so, the engine thinks you have simply made a texture and texture a brush side.
In order to understand how a water material (.vmt) is made, I'd suggest you to check into Valve's materials. There are a lot of them. They're stored into your folder Portal 2/portal2, into a packed .vpk file called pak01_dir.vpk (you can open these with GTFScape).
As an example, look inside a Portal2 water material called Toxicslime_a1_Intro5.vmt below:
- Code: Select all
Water
{
$forceexpensive 1
$normalmap "liquids/water_river_normal_sharp"
$flowmap "liquids/sp_a1_intro5_hflowmap"
$flow_normaluvscale 160
$flow_worlduvscale 0.5
$flow_timeintervalinseconds 0.6
$flow_uvscrolldistance 0.1
$flow_bumpstrength 1
$flow_noise_texture "liquids/water_noise"
$flow_noise_scale 0.001
$flow_debug 0
$basetexture "liquids/toxicslime_color"
$color_flow_uvscale 300
$color_flow_timeintervalinseconds 5
$color_flow_uvscrolldistance 0.11
$color_flow_lerpexp 1
$color_flow_displacebynormalstrength 0.01
$reflecttexture _rt_WaterReflection
$reflectamount "0.1"
$reflecttint "{ 240 240 192 }"
$reflectskyboxonly 0
$reflectonlymarkedentities 1$abovewater 1
$bottommaterial "nature/toxicslime002a_beneath"
$fogenable 1
$fogstart 0
$fogend 100
$lightmapwaterfog 1$fogcolor "{ 58 35 20 }"
$flashlighttint 1
"%compilewater" 1
"%tooltexture" "nature/water_frame01_normal"
$surfaceprop slime
}
The second problem you have is that you are using a .vtf texture without an alpha channel. This is important because the water shader makes us of the alpha channel to fake the movement...
I hope this will help for starters
Quote from iSpectra on January 14, 2013, 5:41 pmHi,
first of all, thank you both for your posts!
@josepezdj: Do you know any custom water tutorial, because the dev. community link doesn't really help me since it's still way to complex for me to understand properly.Edit: I didn't find the Toxicslime_a1_Intro5.vmt too. I checked the materials/liquids folder.
Hi,
first of all, thank you both for your posts!
@josepezdj: Do you know any custom water tutorial, because the dev. community link doesn't really help me since it's still way to complex for me to understand properly.
Edit: I didn't find the Toxicslime_a1_Intro5.vmt too. I checked the materials/liquids folder.
????????????????????????????????????????????????????????Visit my Steam profile!
Quote from FelixGriffin on January 14, 2013, 5:58 pmLook in the VPK.
Look in the VPK.

Quote from josepezdj on January 15, 2013, 7:36 am@iSpectra: as I told you and also Felix said, you must look into the file pak01_dir.vpk. This is a packed special file that Valve games use: many of the games' files are packed into there, not in common folders outside
Above I told you where it is located and how to open it. I suggest you to check into it and start by modifying any of the stock water materials.
There aren't tutorials for creating custom water materials, only for applying it properly... Be sure you also read the article Adding Water.
The VDC explains what each parameter does, but let me help with what I know:
water parameters
[spoiler]Water //this is the shader type; it's one of the most complex ones! but because of that you can achieve awesome results. Normally, world textures use the shader 'Lightmappedgeneric', models use 'Vertexgeneric', and there are many more such as 'refract', 'solid energy'....
{
$forceexpensive 1 //this is telling the engine to render expensive water (high quality water with great reflections and such) instead of cheap; this can be also controlled by the water_lod_control that you must place on top of the water material in the hammer editor$normalmap "liquids/water_river_normal_sharp" //this is similar to the bumpmaps for the world textures, the normal maps modify the 'height' of pixels and when you see the texture there are parts that appear to be embossed like; this is how the water_river_normal_sharp looks like:
$flowmap "liquids/sp_a1_intro5_hflowmap" //the flowmap is the map that tells the angine the directions we want the water to be moving; the different colours mean east-south-north-west.... This is how it looks like:
About the following parameters just read the VDC and if you want, play with their values to see the effect:
$flow_normaluvscale 160 //read the VDC
$flow_worlduvscale 0.5 //read the VDC
$flow_timeintervalinseconds 0.6 //read the VDC
$flow_uvscrolldistance 0.1 //read the VDC
$flow_bumpstrength 1 //read the VDC
$flow_noise_texture "liquids/water_noise" //this is a cool parameter, it introduces noise in the image of the water you see; check how it looks like:
$flow_noise_scale 0.001 //read the VDC
$flow_debug 0 //read the VDC$basetexture "liquids/toxicslime_color" //THIS ONE is what you were looking for; this is that ugly goo look the water has in Portal2; even though not mandatory to make a custom water texture, Portal series use it to make the water looks toxic and ugly
. This is how it looks like:
Let's do this: I've made a quick clean water material for you, download it from here and place it somewhere into your materials folder; then edit this line to make it point to the path where your texture is placed; for example if you put it into portal2/portal2/materials/liquids folder, this line will be like so:
$basetexture "liquids/jose_clean_water_test"
About the following parameters just play with them if you want, or leave them as they are...
$color_flow_uvscale 300
$color_flow_timeintervalinseconds 5
$color_flow_uvscrolldistance 0.11
$color_flow_lerpexp 1
$color_flow_displacebynormalstrength 0.01$reflecttexture _rt_WaterReflection //Taken from the VDC: Texture to use for reflection. For real-time reflections, use _rt_WaterReflection.
$reflectamount "0.1" //This is the amount of warp for the reflection. Higher values produce more visible reflections
$reflecttint "{ 240 240 192 }" //this is very interesting: it defines what color will have the reflections you'll see on the water's surface; that value is "white-ish", clear reflections, I like it (but you can also make reflections look more red or green if you like...); for the RGB colours in mapping, bookmark this site
$reflectentities 0 //if set to "0" it won't reflect entities; I like to set it to "1" to see cool reflections of surrounding entities
$reflectonlymarkedentities 1 //this is to reflect those entities with the property "Render in Fast Reflections" set to YES.
$reflect2dskybox 0 //this is used when there's a skybox around; you set a value of "1" if you want your sky to be reflected on the water's surface, or "0" if you don't want it to be reflected.
(About all this, I made a post some time ago that I recommend you to read in the case you are interested in going a bit further regarding water reflections and skybox. Find it here )
$abovewater 1 //very important: this is satying that this whole material file is intended to be used for the above surface of the water brush, it's the "water itself"
$bottommaterial "nature/toxicslime002a_beneath" //it's a required parameter; water needs an anove material (this one) plus a botttom material. This one is the typical you see when you submerge into the goo (brownish and dirt).
$fogenable 1 //this is to enable the fog; it creates a fog you can see in the water; the following are the paramters that you can change to tweak it:
$fogcolor "{ 58 35 20 }" //this is oneof the most coolest parameter... it is the color you see in the water depth... the VDC recommends you to use a color that fits to the bottom material, up to you (I use a dark blue one though)
$fogstart 0 //the distance in inches from the player's eye where the fog starts... it's recommended to use a value of "0" for edge fading to work properly
$fogend 100 //distance in inches where the fog ends; to my experience this gives a sense of depth when you look into the water closely and zoom in...
$lightmapwaterfog 1 //allows the fog to receive lightmaps, that's to say, it casts shadows coming from static props.
$flashlighttint 1 //to be frank I haven't really tested this parameter..."%compilewater" 1 //needed to compile the water properly.
"%tooltexture" "nature/water_frame01_normal" //this is just the image you see in your hammer editor texture browser.
$surfaceprop slime //use 'slime' or 'water', no significative difference; like the rest of the game textures this tells the engine what material is its surface made of, in order to adjust its behavior 'in game': a wooden material makes a particular sound when you walk on it.... a metal material too... glass or grates are handled/rendered in a special way...
[/spoiler]
Try that material I linked you to and let me know if it works good... As I told you the .vtf you posted has no alpha channel, and the water shader makes use of it to alternate the texture with the noise and flowmap... and to make it looks good with a cool movement.
Ok, now I'm a bit tired of writting, bye
@iSpectra: as I told you and also Felix said, you must look into the file pak01_dir.vpk. This is a packed special file that Valve games use: many of the games' files are packed into there, not in common folders outside Above I told you where it is located and how to open it. I suggest you to check into it and start by modifying any of the stock water materials.
There aren't tutorials for creating custom water materials, only for applying it properly... Be sure you also read the article Adding Water.
The VDC explains what each parameter does, but let me help with what I know:
water parameters
Try that material I linked you to and let me know if it works good... As I told you the .vtf you posted has no alpha channel, and the water shader makes use of it to alternate the texture with the noise and flowmap... and to make it looks good with a cool movement.
Ok, now I'm a bit tired of writting, bye
Quote from iSpectra on February 1, 2013, 10:52 amSo I used the code and texture you provided me, but I still have a problem. At least I got fancy reflections and flowing animations.
So I used the code and texture you provided me, but I still have a problem. At least I got fancy reflections and flowing animations.
????????????????????????????????????????????????????????Visit my Steam profile!
Quote from portal2tenacious on February 1, 2013, 1:00 pmYou could also download some water textures from TopHATTwaffle's website
You could also download some water textures from TopHATTwaffle's website
Quote from iSpectra on February 3, 2013, 2:37 pmEven tho that helps me for now, I'd like to know if someone knows why my texture has this weird problem.
Even tho that helps me for now, I'd like to know if someone knows why my texture has this weird problem.
????????????????????????????????????????????????????????Visit my Steam profile!

Quote from BenVlodgi on February 3, 2013, 7:23 pmiSpectra wrote:Even tho that helps me for now, I'd like to know if someone knows why my texture has this weird problem.because you wrote your vmt wrong is my guess... just copy one from the existing water materials, and change the names boom done... right?
because you wrote your vmt wrong is my guess... just copy one from the existing water materials, and change the names boom done... right?