Jump to content
Mr. Green Gaming

How to: Make a custom water texture


Mr. Darkness

Recommended Posts

WARNING: Before complaining about the code, I am gonna say that I will fix that shit tomorrow. Thank you for attention

Hi guys!

Most of you like doing own textures for their usage in your maps. So how about doing own water texture?

So what am I going to tell you is that there are 2 ways of doing different water textures, which take different time to do and which take a pretty large size.

First way (Easy):

-Takes like 2-3 minutes of doing

-Takes a small size (kilobytes)

-You can change only colour and how foggy will it be.

-Requires VTFEdit.

Second way (Hard, better for those users who really do know what are they doing):

-Takes hours to do

-Takes a pretty big size

-You can do your own looking for it, beneath color, animation and so on, BUT: it might look like crap if you will do it wrong.

-Requires 2 programms: Crazybump (http://www.crazybump...a/download.html) for doing normal maps (texture) and VTFEdit for compiling Vtf and vmt files.

Lets start for Hard way (skip to the end if you want to pass that one).

So let me tell you 1 thing first.

So you've decided to dabble with water textures. Let me tell you some tricks in making your water purty, first off, go off looking for a nice water texture . A water texture is a non-coloured texture in a size of 256 x 256 px. What makes the water come alive is the animated normal maps and dudv. Don't have a clue what these are then skip to the easy part. The reason the water is at 256 x 256 is that the texture would be far too big otherwise as many textured are used to create the movement of the water. The standard HL2 water consist of 29 frames, keep that in mind when creating. All water is consist of an animated base texture and a beneath water. Prettier water than the most basic contain an animated normal map and an animated dudv map as well. How much of these you create is up to you.

To do it the hard way you will need a photo of a water surface, preferably if it is possible a series in order to create the animated texture but you can distort the picture to get it to look nice. How you do it is up to you to discover, I would have gone with maybe 50 photos of a pond surface and made my texture out of them. If you go by distortion, try out the different filters there is in photoshop, you don't have to make em seamless if you're unsure about the results. Normal maps encode height in a texture and dudv maps encode height used for refraction of the surface.

To do it in photoshop:

Make a new projeck with size 256x256 px.

Click filter>render>clouds to make clouds instead of your white/invisible ground.

Click Filter>Gallery of filters>and choose chrome.

Now dont change the color.

Just a bit of advice: to get something to move, you animate textures, in theory it's real easy but irl it can be a bit of a hassle. You need smooth transitions and not to much then it will look crap later in the animation cycle.

1. Pick a series of pictures of at least ten, preferably more but too many will be harder to distribute and use more memory resources as they will be larger. They all need to be seamless. They also don't have to be anywhere near the right colour you want, that will be dealt with later on. You can use the slideshow function in windows to look at them so they don't look too jumpy after smoothing em out. Call them for example water000, it is only the numerical ending which is important. If you have ten frames then save the first one as 000 and 018, the second as 001 and 017 and so on. This is so the the animation will go back to it's original starting point without a jump. You can create an alpha channel for each of them as well so they get transparent. Save all of them also as water_dx70 as well. This will be your fall back material for low end systems.

2. Load up crazybump to create normalmaps: http://www.crazybump...a/download.html Create normalmaps for all of the textures calling them for example water_normal000 and so on. They are supposed to end with _normal in order for vtex to figure the file out correctly. Save all of them with the same numbers and a _dudv ending as well instead of the _normal.

3. Place all of the normal maps and standard .tga's in your materialsrc sub folder and create a text file with the same name as the texture containg this: FUCK. THE CODE THING GONE WRONG.

"startframe" "000"

"endframe" "0xx" //xx where is your last series number.

"normaltodudv" "1" //To compile to dudv from normal.

For the standard texture: do the same as normal map .txt

Now compile all three of them, as you can see the files get to be rather large.

Now you have created the all of your necessary textures, now only the .vmt's remain. You will need five .vmt's, one called water_expensive (or whatever you decide to call your water) water_cheap and water_beneath and water_dx70 and water_beneath_dx70

The water_expensive should contain: IGNORE THE SIZE THINGS

"Water"

{

"Water_DX60"

{

"$fallbackmaterial" "any foldier/water_dx70"

}

"Water_DX80"

{

"$refractamount" ".13"

}

"Water_DX81"

{

"$refractamount" ".13"

}

"$abovewater" 1

"%tooltexture" "any foldier/water_normal"

"$refracttexture" "_rt_WaterRefraction"

"$refractamount" "1.0"

"$refracttint" "[0.9 1.0 0.95]" //This is where you decide the tint of the refraction

"$reflecttexture" "_rt_WaterReflection"

"$reflectamount" "1.0"

"$reflecttint" "[.9 .9 .9]" //This is where you decide the tint of the relection

"$envmap" "env_cubemap"

"$scale" "[1 1]"

"$bumpmap" "any foldier/water_dudv"

"$normalmap" "any foldier/water_normal"

"%compilewater" 1

"$surfaceprop" "water"

"$bottommaterial" "any foldier/beneath"

"$subdivsize" 64

"$bumpframe" "0"

"$fogenable" 1

"$fogcolor" "{61 129 230}" //This is where you change fog colour as well as the colour of the waters appereance, should be the same for both beneath water and above water

"$fogstart" 0 //This has to be set to zero to work properly

"$fogend" 1200.00 //Max distance you can see through the fog

"$bumpoffset" "[0 0]"

"Proxies"

{

"AnimatedTexture"

{

"animatedtexturevar" "$normalmap"

"animatedtextureframenumvar" "$bumpframe"

"animatedtextureframerate" 30.00 //This is standard HL2 animation speed, depends on your number of frames, the number is likely going to need tweaking unless you have 29 frames.

}

"TextureScroll"

{

"texturescrollvar" "$bumptransform"

"texturescrollrate" .05

"texturescrollangle" 45.00

}

"WaterLOD"

{

}

}

}

For water_cheap:

"$scale" "[1 1]"

"$bumpmap" "any foldier/water_dudv"

"$normalmap" "any foldier/water_normal"

"$surfaceprop" "water"

"$bottommaterial" "any foldier/water_beneath"

"$bumpframe" "0"

"$fogenable" 1

"$fogcolor" "{20 130 20}"

"$fogstart" 0.00

"$fogend" 400.00

"Proxies"

{

"AnimatedTexture"

{

"animatedtexturevar" "$normalmap"

"animatedtextureframenumvar" "$bumpframe"

"animatedtextureframerate" 30.00

}

"TextureScroll"

{

"texturescrollvar" "$bumptransform"

"texturescrollrate" .05

"texturescrollangle" 45.00

}

"WaterLOD"

{

}

}

}

For water_beneath:

[/size]
[size=2]"Water"[/size][size=2]{[/size][size=2] "Water_DX60"[/size][size=2] {[/size][size=2] "$fallbackmaterial" "nature/water_beneath_dx70"[/size][size=2] }[/size][size=2] "$abovewater" 0[/size][size=2] "%compilewater" 1[/size][size=2] "$CHEAPWATERSTARTDISTANCE" 500.0[/size][size=2] "$CHEAPWATERENDDISTANCE" 1000.0[/size][size=2] "%tooltexture" "any foldier/water_normal"[/size][size=2] "$refractamount" "1.0"[/size][size=2] "$refracttint" "[0.95 1.0 0.97]"[/size][size=2]
[/size][size=2] "$reflectamount" "1.0"[/size][size=2] "$reflecttint" "[1 1 1]"[/size][size=2]
[/size][size=2] "$refracttexture" "_rt_WaterRefraction"[/size][size=2]
[/size][size=2] "$scale" "[1 1]"[/size][size=2]
[/size][size=2] "$bumpmap" "any foldier/water_dudv"[/size][size=2] "$normalmap" "any foldier/water_normal"[/size][size=2]
[/size][size=2] "$surfaceprop" "water"[/size][size=2] "$bumpframe" "0"[/size][size=2]
[/size][size=2] "$fogenable" 1[/size][size=2] "$fogcolor" "{22 20 10}"[/size][size=2] "$fogstart" 1.00[/size][size=2] "$fogend" 400.00[/size][size=2]
[/size][size=2] "Proxies"[/size][size=2] {[/size][size=2] "AnimatedTexture"[/size][size=2] {[/size][size=2] "animatedtexturevar" "$normalmap"[/size][size=2] "animatedtextureframenumvar" "$bumpframe"[/size][size=2] "animatedtextureframerate" 30.00[/size][size=2] }[/size][size=2]
[/size][size=2] "TextureScroll"[/size][size=2] {[/size][size=2] "texturescrollvar" "$bumptransform"[/size][size=2] "texturescrollrate" .05[/size][size=2] "texturescrollangle" 45.00[/size][size=2] }[/size][size=2]
[/size][size=2] "WaterLOD"[/size][size=2] {[/size][size=2] }[/size][size=2] }[/size][size=2]}[/size][size=2]

For water_dx70:

[/size][size=2]
"LightmappedGeneric" //this water doesn't use the expensive water shader and is excellent for performance[/size]
{
"$basetexture" "any foldier/water"
"$color" "{160 187 201}"
"$scale" "[1 1]"
"$translucent" "1"

"%compilewater" 1


"$surfaceprop" "water"

"$bottommaterial" "any foldier/water_beneath_dx70"

"$bumpframe" "0"

"$fogenable" 1

"$fogcolor" "{25 25 15}"

"$fogstart" 0.00

"$fogend" 150.00

"$abovewater" 1

"$texoffset" "[0 0]"

"$texscale" "0.5"

"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 20.00
}

"TextureScroll"
{
"texturescrollvar" "$texoffset"
"texturescrollrate" .025
"texturescrollangle" 45.00
}

"TextureTransform"
{
"translateVar" "$texoffset"
"scaleVar" "$texscale"
"resultVar" "$basetexturetransform"
}
}
}[size=2]

For water_beneath_dx70:

[/size][size=2]
"LightmappedGeneric"[/size]
{
"$abovewater" 0
"%compilewater" 1

"$basetexture" "any foldier/water"
"$scale" "[1 1]"
"$translucent" "1"
"$nocull" "1"

"$surfaceprop" "water"

"$fogenable" 1

"$fogcolor" "{25 25 15}"

"$fogstart" 0.00

"$fogend" 450.00

"$texoffset" "[0 0]"

"$texscale" "0.5"

"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 20.00
}

"TextureScroll"
{
"texturescrollvar" "$texoffset"
"texturescrollrate" .025
"texturescrollangle" 45.00
}

"TextureTransform"
{
"translateVar" "$texoffset"
"scaleVar" "$texscale"
"resultVar" "$basetexturetransform"
}
}
}[size=2]

From this you have created a new custom water from which you can create an endless stream of different water colours. Valve only made one base water texture and used it throughout the entire of HL2 but changed the tints and the fog colour and fog distances to get the different colours you can see in game.

For the easy way

So for these ones it will be of size of 30 kb or even lower. You will need to do vmt's for that, so it wont take over 9000000mb (okay, 30 mb) for compiling.

So here we go:

For water_expensive:

[/size]
[size="2"]
"Water"
{
"Water_DX60"
{
"$fallbackmaterial" "nature/water_canals03_dx70" //Create a fall back material of your own if you want to
}
"Water_DX80"
{
"$refractamount" ".13"
}
"Water_DX81"
{
"$refractamount" ".13"
}

"$abovewater" 1
"%tooltexture" "dev/water_normal"
"$refracttexture" "_rt_WaterRefraction"
"$refractamount" "1.0"
"$refracttint" "[0.9 1.0 0.95]" //change to get another tint of the refraction

"$reflecttexture" "_rt_WaterReflection"
"$reflectamount" "1.0"
"$reflecttint" "[.9 .9 .9]" //Change this as well

"$envmap" "env_cubemap"
"$scale" "[1 1]"

"$bumpmap" "dev/water_dudv" //Use valves own
"$normalmap" "dev/water_normal" //same as above

"%compilewater" 1
"$surfaceprop" "water"
"$bottommaterial" "any foldier/beneath" //Bottom material is needed as well
"$subdivsize" 64
"$bumpframe" "0"

"$fogenable" 1
"$fogcolor" "{61 129 230}" //This is where you control the colour of the water, should be the same for both the above and beneath waters
"$fogstart" 0
"$fogend" 1200.00 //How foggy the water should appear, the number tell you the max view distance in inches

"$bumpoffset" "[0 0]"

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

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

"WaterLOD"
{
}
}
}

For water_cheap:



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

"%compilewater" 1
"$forcecheap" 1
"$CHEAPWATERSTARTDISTANCE" 500.0
"$CHEAPWATERENDDISTANCE" 1000.0
"$envmap" "env_cubemap"
"%tooltexture" "dev/water_normal"
"$refractamount" "1.0"
"$refracttint" "[0.95 1.0 0.97]"

"$reflectamount" "1.0"
"$reflecttint" "[1 1 1]"
"$refracttexture" "_rt_WaterRefraction"
"$reflecttexture" "_rt_WaterReflection"

"$scale" "[1 1]"

"$bumpmap" "dev/water_dudv"
"$normalmap" "dev/water_normal"

"$surfaceprop" "water"
"$bottommaterial" "any foldier/water_beneath"
"$bumpframe" "0"

"$fogenable" 1
"$fogcolor" "{113 202 255}"
"$fogstart" 1.00
"$fogend" 400.00

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

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

"WaterLOD"
{
}
}
}

For water_beneath:



"Water"
{
"Water_DX60"
{
"$fallbackmaterial" "nature/water_dx70_beneath"
}
"$abovewater" 0
"%compilewater" 1
"$CHEAPWATERSTARTDISTANCE" 500.0
"$CHEAPWATERENDDISTANCE" 1000.0
"%tooltexture" "dev/water_normal"
"$refractamount" "1.0"
"$refracttint" "[0.95 1.0 0.97]"

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

"$refracttexture" "_rt_WaterRefraction"

"$scale" "[1 1]"

"$bumpmap" "dev/water_dudv"
"$normalmap" "dev/water_normal"

"$surfaceprop" "water"
"$bumpframe" "0"

"$fogenable" 1
"$fogcolor" "{22 20 10}"
"$fogstart" 1.00
"$fogend" 400.00

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

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

"WaterLOD"
{
}
}
}

For above water, one of fallback materials:



"LightmappedGeneric"
{
"$basetexture" "dev/water"
"$color" "{130 144 169}"
"$scale" "[1 1]"
"$translucent" "1"

"%compilewater" 1

"$surfaceprop" "water"

"$bottommaterial" "nature/water_dx70_beneath"

"$bumpframe" "0"

"$fogenable" 1

"$fogcolor" "{25 25 15}"

"$fogstart" 0.00

"$fogend" 150.00

"$abovewater" 1

"$texoffset" "[0 0]"

"$texscale" "0.5"

"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 20.00
}

"TextureScroll"
{
"texturescrollvar" "$texoffset"
"texturescrollrate" .025
"texturescrollangle" 45.00
}

"TextureTransform"
{
"translateVar" "$texoffset"
"scaleVar" "$texscale"
"resultVar" "$basetexturetransform"
}
}
}

For beneath fallback material (btw, fallback materials are dx70 materials):



"LightmappedGeneric"
{
"$abovewater" 0
"%compilewater" 1

"$basetexture" "dev/water"
"$scale" "[1 1]"
"$translucent" "1"
"$nocull" "1"

"$surfaceprop" "water"

"$fogenable" 1

"$fogcolor" "{25 25 15}"

"$fogstart" 0.00

"$fogend" 450.00

"$texoffset" "[0 0]"

"$texscale" "0.5"

"Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 20.00
}

"TextureScroll"
{
"texturescrollvar" "$texoffset"
"texturescrollrate" .025
"texturescrollangle" 45.00
}

"TextureTransform"
{
"translateVar" "$texoffset"
"scaleVar" "$texscale"
"resultVar" "$basetexturetransform"
}
}
}

You have done your water texture! So was that easy or hard?

Anyway. If you are having some questions about it, just ask. Don't be shy!

As for me I couldnt do this without the tutorial i read. I am doing my own water texture right now and began from wrong steps. But I am sure it will be going good.

Btw. Writing this tutorial I took some steps from this link: http://forums.firear...er-textures-DIY

If you have done some water textures, feel free to post em here! (Note: I am still doing my water texture!)

Edited by Mr. Darkness
Link to comment

water textures for what game? gmod?

For any game running on source engine (hl2, css, tf2, hl1source, and probably gmod, if it runs in hl2).

Boter, the code does appear in any valve's texture. You can try using gcf scape and copy any vmt water texture to load it up in vtfedit. Ofc these are ones of the ways to do them. There are more, but they are similar to easy ways.

Edited by Mr. Darkness
Link to comment

water textures for what game? gmod?

For any game running on source engine (hl2, css, tf2, hl1source, and probably gmod, if it runs in hl2).

Boter, the code does appear in any valve's texture. You can try using gcf scape and copy any vmt water texture to load it up in vtfedit. Ofc these are ones of the ways to do them. There are more, but they are similar to easy ways.

Yeah no shit

But you could atleast added a picture; this is just lazy copy and paste.

Link to comment

water textures for what game? gmod?

For any game running on source engine (hl2, css, tf2, hl1source, and probably gmod, if it runs in hl2).

Boter, the code does appear in any valve's texture. You can try using gcf scape and copy any vmt water texture to load it up in vtfedit. Ofc these are ones of the ways to do them. There are more, but they are similar to easy ways.

Yeah no shit

But you could atleast added a picture; this is just lazy copy and paste.

Well. I could have maybe added easy way. I am doing a hard way now. I will show you tomorrow what textures i have done (hard), but not in-game yet.

EDIT: you havent given me the file extractor in a sex yet :gmod:

Edited by Mr. Darkness
Link to comment

So I have done my own one in "easy" way, but under it it looks crap :V

And I actually know what did I do wrong. So here it is :V

If you want to do your maps textures (ffs), I require to do them in easy way first. The hard way takes too much time.

I will do a 'shit' "water" texture for him to add to his maps.. Thanks for the tutorial! Now ... should I pick yellow or brown shit?

Sarcasm? :(

post-126-129717403891_thumb.jpg

post-126-129717409591_thumb.jpg

Edited by Mr. Darkness
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...