Hl2 water problems in TF2.

111112oo

L1: Registered
Dec 13, 2013
23
0
I am trying to use this custom water texture in TF2. The texture works fine in the css map it comes from, however in TF2, It has a random chance to show a missing texture that covers your entire vision while underwater. I need help to edit the texture to fix this.

The Texture: https://mega.nz/#!2cQQlDxA!D-lY6kDCLNRIFit4VFr0SXZ0cZ00tWEwJIRVe81xvRo

This also happens on some hl2 textures as well, such as dev/dev_water2

I have a test map to show the problem.
https://www.dropbox.com/s/im4mm019dedyg3w/the_test_map.bsp?dl=0
The leftmost body of water is a tf2 water texture, which works fine.
The middle body of water is the hl2 water with the same issue as the custom water.
The rightmost body of water is the custom water I want to fix.

Thanks.
 

iiboharz

eternally tired
aa
Nov 5, 2014
857
1,291
It's most likely because the $bottommaterial parameter in the VMT is referencing a texture that doesn't exist. This happens with HL2 water materials because they use textures that TF2 doesn't have in its file system. Try and see what materials such as water_2fort use and use that instead.
 

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
Wouldn't it be way simpler to just use a TF2 water material? There's plenty of choice.

And as Iibo said, if there isn't a $bottommaterial specified Source doesn't know what it should render while under water so it goes black-and-purple checkerboard on you.
 

111112oo

L1: Registered
Dec 13, 2013
23
0
It's most likely because the $bottommaterial parameter in the VMT is referencing a texture that doesn't exist. This happens with HL2 water materials because they use textures that TF2 doesn't have in its file system. Try and see what materials such as water_2fort use and use that instead.
Nope, the custom texture references an existing vmt, which is part of the custom water texture, I supplied the download link for a reason yknow. I also mentioned that the error happens randomly, sometimes it works, sometimes it doesn't. I find it easy to replicate if you go into spectator and then join in the game; it will look fine at first but on switching to a player it may look broken. Also the hl2 water references a bottom material that exists within the tf2 filesystem aswell.

Wouldn't it be way simpler to just use a TF2 water material? There's plenty of choice.

And as Iibo said, if there isn't a $bottommaterial specified Source doesn't know what it should render while under water so it goes black-and-purple checkerboard on you.
I cannot use a TF2 water texture because I am porting a map and this water is very map specific, no other water texture would work.

So please have a look at the material file and map before posting.
 
Last edited:

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
I cannot use a TF2 water texture because I am porting a map and this water is very map specific, no other water texture would work.

So please have a look at the material file and map before posting.
You can always check your game cache on missing or corrupted files. Go to Steam->right-click Team Fortress 2 in the game library on the left->Properties->Local Files->Verify integrity of game cache. Do that for CS:S as well, then try the water again.

Also, we don't particularly like Mega as a file hosting service. It either forces you to download some external program in order to download stuff or use Flash player which we all want to see die. Use a shared Dropbox folder for that kind of stuff, just like you did with your map.

This is how your water looks from above:
272B2DBA60349ABA3F8867F9EA6F8CD0DA385FEA

It looks the same from below. I dove underwater with both a spectator cam and as random classes on both teams, and the underwater texture was perfectly fine.
 
Last edited:

111112oo

L1: Registered
Dec 13, 2013
23
0
You can always check your game cache on missing or corrupted files. Go to Steam->right-click Team Fortress 2 in the game library on the left->Properties->Local Files->Verify integrity of game cache. Do that for CS:S as well, then try the water again.

Also, we don't particularly like Mega as a file hosting service. It either forces you to download some external program in order to download stuff or use Flash player which we all want to see die. Use a shared Dropbox folder for that kind of stuff, just like you did with your map.

def not a cache issue mate. Also how dare you talk crap against god-teir mega haha, it really isn't hard.
Just for you. https://www.dropbox.com/s/mknqx4q0jq8q24y/FIBBS.rar?dl=0

It never forces you, just gives you the option between that or the browser, and just enable flash for the site. So don't go about asking people to do extra work for you because you couldn't be bothered.

EDIT: Oh god why does it look like that it shouldn't well that's another problem to fix, if anyone has any ideas.
 
Last edited:

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
def not a cache issue mate. Also how dare you talk crap against god-teir mega haha, it really isn't hard.
Just for you. https://www.dropbox.com/s/mknqx4q0jq8q24y/FIBBS.rar?dl=0

It never forces you, just gives you the option between that or the browser, and just enable flash for the site.
Look again in the post above you, I made a screenshot, just for you.

As for the water's code: you haven't specified a DX9 material. The vmf you provided does not even look remotely similar to how TF2's water is set up. Keep the engine differences between TF2 and CS:S in mind when creating/porting vmt files. What works in one engine branch doesn't always work in the other.

Your vmt:
Code:
"Water"
{
    "Water_DX60"
    {
        "$fallbackmaterial" "nature/water_canals03_dx70"
    }
    "Water_DX80"
    {
        "$refractamount" "0"   //.13
    }
    "Water_DX81"
    {
        "$refractamount" "0"   //.13
    }
    "$abovewater" 1
    "%compilewater" 1
    "$forceexpensive" 1
    "$reflectentities" 0
    "$envmap" "env_cubemap"
    "%tooltexture" "dev/water_normal"
    "$refracttexture" "_rt_WaterRefraction"
    "$refractamount" "0"
    "$refracttint" "[.5 .65 .5]"

    "$reflecttexture" "_rt_WaterReflection"
    "$reflectamount" "2.5"
    "$reflecttint" "[0 0 0]"

    "$scale" "[1 1]"

//    "$bumpmap" "dev/water_dudv"
    "$normalmap" "fibbs/water_flat"

    "$surfaceprop" "water"
    "$bottommaterial" "fibbs/water_flat_beneath"
    "$bumpframe" "0"

    "$fogenable" 1
    "$fogcolor" "{125 150 125}"
    "$fogstart" "0"
    "$fogend" "1"

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

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

        "WaterLOD"
        {
        }
    }
}

2Fort's expensive water vmf:
Code:
"Water"
{
    "%keywords" "tf"
    //    $forcecheap 1
  
    "%tooltexture" "dev/tfwater_normal"
    "%compilewater" 1
    "$abovewater" 1
    //"$nofresnel" "1"

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

    "$reflecttexture" "_rt_WaterReflection"
    "$reflectamount" ".25"
    //"$reflecttint" "{230 240 255}"
//    "$reflectsaturation" "[0 0 1]"

    "$scale" "[1 1]"

//    "$bumpmap" "dev/water_dudv"
    "$normalmap" "water/tfwater001_normal"

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

    "$fogenable" 1
    "$fogcolor" "{51 43 13}"
    "$fogstart" "1"
    "$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
        }
    }
}

Your best bet is to copy one of the existing water vmts that Valve made and replace the materials with the ones you want.
 

111112oo

L1: Registered
Dec 13, 2013
23
0
Look again in the post above you, I made a screenshot, just for you.

As for the water's code: you haven't specified a DX9 material. The vmf you provided does not even look remotely similar to how TF2's water is set up.


Your best bet is to copy one of the existing water vmts that Valve made and replace the materials with the ones you want.

They are really different I can't copy paste, I Need to know what exactly to change, also see the edit to my previous post.
 

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
Care to provide some screenshots as to how it looks on your end then, and how you want it to look? I'm having trouble understanding what it is that you actually want to achieve that can't be achieved by either TF2's many water materials or HL2's many water materials.
 

111112oo

L1: Registered
Dec 13, 2013
23
0
Care to provide some screenshots as to how it looks on your end then, and how you want it to look? I'm having trouble understanding what it is that you actually want to achieve that can't be achieved by either TF2's many water materials or HL2's many water materials.

86FA2ECD54A0FD32C5A02F29A0555EBB3F17262A

Water looking correct in the map im using it in. The test map is buggy with how it looks above, but defiantly not like how you showed
4BDD0409BAD677C76CB80ABCFC95B3B9348F29A5

Correct Underneath
FF387C92880EE768C481CB7194841B4B4D405F1A

Broken Underneath
 

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
Are you trying to create really murky water?
 

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
So that area you point at in the first screenshot is water then, and people are supposed to go in it, but it needs to have that particular flat look?

Take this existing water vmt (for Hydro's cheap water, edited to take out the animated effect), and copy it to a new vmt.
Code:
"LightmappedGeneric"
{

    <dx90
    {
            "$fallbackmaterial" "water/water_hydro_cheap_dx80"
    }

    "%tooltexture" "dev/tfwater_normal"
    "%keywords" "tf"
    "%compilewater" "1"
    "%compileKeepLight" 1


    "$basetexture" "water/water_hydro_base"
    "$bumpmap" "water/tfwater001_normal"
    "$normalmap" "water/tfwater001_normal"
    "$translucent" "1"
    "$surfaceprop" "water"
    "$envmap" "env_cubemap"
    "$envmaptint" "[.2 .2 .2]"
//    "$envmapcontrast" ".5"

    "$abovewater" "1"

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

    "$bottommaterial" "water/water_well_beneath.vmt"
    "$normalmapalphaenvmapmask" "1"
    "$bumpframe" "0"

}

This part: "$basetexture" "water/water_hydro_base" is what you're looking for for the top texture. Make a new material with the color of your choice, then replace the base texture we have here with what you've named that new material. Now you have your water with the solid looking top.

Note: I'm not a texture creating expert, nor am I a water shader expert. Experiment with this, but at least make sure you take the code I posted above as that's what Valve made for Hydro and is actually working. I've made some custom water materials in the past for the Arctic theme pack, but those didn't change the basetexture. That only changed the fog colors and the normal map.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
I cannot use a TF2 water texture because I am porting a map and this water is very map specific, no other water texture would work.
explain please
 

111112oo

L1: Registered
Dec 13, 2013
23
0
explain please
If you look at a screenshot above, you can see the water is a flat colour that suits the cartoon style of the map.
So that area you point at in the first screenshot is water then, and people are supposed to go in it, but it needs to have that particular flat look?

Take this existing water vmt (for Hydro's cheap water, edited to take out the animated effect), and copy it to a new vmt.

blah

This part: "$basetexture" "water/water_hydro_base" is what you're looking for for the top texture. Make a new material with the color of your choice, then replace the base texture we have here with what you've named that new material. Now you have your water with the solid looking top.

Note: I'm not a texture creating expert, nor am I a water shader expert. Experiment with this, but at least make sure you take the code I posted above as that's what Valve made for Hydro and is actually working. I've made some custom water materials in the past for the Arctic theme pack, but those didn't change the basetexture. That only changed the fog colors and the normal map.

I'll try this soon but you do relaise ill have to edit so much more, like fog, and the base texture, I really can't do that without it being a huge mess.
 

Tumby

aa
May 12, 2013
1,084
1,192
My version:
water_flat.vmt
Code:
"Water"
{
   "$basetexture" "models/player/items/all_class/white"
   "$color2" "{125 150 125}"
   "$reflectivity" "{125 150 125}"

   "$abovewater" 1
   "$forcecheap" 1
   "%compilewater" 1
   "%tooltexture" "dev/water_normal"
   "%keywords" "tf"

   "$surfaceprop" "water"
   "$bottommaterial" "fibbs/water_flat_beneath"

   "$reflectentities" 0
   "$envmap" "env_cubemap"
   "$normalmap" "models/effects/flat_normal"

   "$fogenable" 1
   "$fogcolor" "{125 150 125}"
   "$fogstart" "-50"
   "$fogend" "350"

   "Proxies"
   {
     "WaterLOD"
     {
     }
   }
}
water_flat_beneath.vmt
Code:
"Water"
{
   "$basetexture" "models/player/items/all_class/white"
   "$color2" "{125 150 125}"
   "$reflectivity" "{125 150 125}"

   "$abovewater" 0
   "$forcecheap" 1
   "%compilewater" 1
   "%tooltexture" "dev/water_normal"
   
   "$surfaceprop" "water"

   "$reflectentities" 0
   "$envmap" "env_cubemap"
   "$normalmap" "models/effects/flat_normal"

   "$fogenable" 1
   "$fogcolor" "{125 150 125}"
   "$fogstart" "-50"
   "$fogend" "350"

   "Proxies"
   {
     "WaterLOD"
     {
     }
   }
}

You can try out a different look by switching out the "Water" shader at the top with "LightmappedGeneric" and also switching out the word "normalmap" with "bumpmap". The latter is required because valve apparently was a little sleepy when they set up these things for the different shaders.
 

111112oo

L1: Registered
Dec 13, 2013
23
0
My version:

You can try out a different look by switching out the "Water" shader at the top with "LightmappedGeneric" and also switching out the word "normalmap" with "bumpmap". The latter is required because valve apparently was a little sleepy when they set up these things for the different shaders.

This fixes the issue!, However there is a problem with this, the texture has an ugly reflectance to it, I tried removing the reflection parameters and changing the base texture but it still gives of reflectivity. Is it the normal map?
 

Tumby

aa
May 12, 2013
1,084
1,192
This fixes the issue!, However there is a problem with this, the texture has an ugly reflectance to it, I tried removing the reflection parameters and changing the base texture but it still gives of reflectivity. Is it the normal map?
I do not know myself what causes it. I have tried removing it myself but it seems to be stuck with the water code.
It could be caused by forcecheap, which I wouldn't recommend to remove as the water is so simple already.
But have you tried using lightmappedgeneric as I mentioned? I don't remember that having the strange reflection.