Basic texture for water (solved)

Discussion in 'Mapping Questions & Discussion' started by Lampenpam, Jun 7, 2017.

  1. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
  2. DrSquishy

    DrSquishy L7: Fancy Member

    Messages:
    435
    Positive Ratings:
    80
    I checked some water VMT files and here are some examples:
    //"$nofresnel" "1"

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



    "$scale" "[1 1]"

    // "$bumpmap" "water/tfwater001_dudv"
    "$normalmap" "water/tfwater001_normal"

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

    "$fogenable" 1
    "$fogcolor" "{51 43 13}"
    "$fogstart" "-100"
    "$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
    }
    }
    }
    and
    "$refracttexture" "_rt_WaterRefraction"
    "$refractamount" ".12"
    // "$refracttint" "{57 54 44}"
    "$refractblur" "1"



    "$scale" "[1 1]"

    // "$bumpmap" "water/tfwater001_dudv"
    "$normalmap" "water/tfwater001_normal"

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

    "$fogenable" 1
    "$fogcolor" "{57 54 44}"
    "$fogstart" "0"
    "$fogend" "300"

    "$temp" "[0 0]"
    "$curr" 0.0
    "$curr2" 0.0

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

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


    "TextureScroll"
    {
    "texturescrollvar" "$bumptransform"
    "texturescrollrate" .6
    "texturescrollangle" 10.00
    }
    "WaterLOD"
    {
    // fixme! This has to be here, or material loading barfs.
    "dummy" 0
    }
    }
    }
    I found these in C:\Program Files\Steam\steamapps\common\SourceFilmmaker\game\tf\materials\water . This will be slightly different for you, as I am using 32 bit windows. Hope this helps
     
  3. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    Well I was already looking at serveral examples, but the water aways showed up bright white. I'm downloading Portal at the moment to see how this texture was done. Someone told me it's using $basetexture despite the VDW implying that it can't be used for water shader.
     
    Last edited: Jun 7, 2017
  4. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    Ok after more unsuccesfull experiments I looked at Portal's vmt. Turns out it's not even using the Water shader. It's LightMappedGeneric. And it uses %CompileSlime. What is this sorcery? o_O http://i.imgur.com/nDjXC41.png

    Well copy/pasting everything did the job. My water now only lacks the underwater fog and I think it just doesn't work in Tf2, but I can live with that.
     
    Last edited: Jun 7, 2017
  5. DrSquishy

    DrSquishy L7: Fancy Member

    Messages:
    435
    Positive Ratings:
    80
    I think the fog is possible:
    "$fogenable" 1
    "$fogcolor" "{57 54 44}"
    "$fogstart" "0"
    "$fogend" "300"
    I kept finding lines like this in some of the vmts. This one was from water_2fort_beneath
     
    • Thanks Thanks x 1
  6. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    Yep I'm using those parameters. I have copy pasted the entire VMT (the link from before is the original Portal VMT) and only edited the $basetexture and $bottommaterial. But the fog doesn't work. I guess %CompileSlime is just a little broken for Tf2 like all other forgoten features.
     
  7. DrSquishy

    DrSquishy L7: Fancy Member

    Messages:
    435
    Positive Ratings:
    80
    What if you need separate textures just for the fog? Or maybe a fog controller?
     
  8. Dr. Orange

    Dr. Orange L6: Sharp Member

    Messages:
    356
    Positive Ratings:
    267
    %compilewater makes the brush behave as water (players can swim in it, bullets create splash effect, etc.)
    %compileslime is the same as %compilewater, except all splash effects are green instead of white.
     
  9. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    Doubt it, water texture's fog is defined by the parameters only and the fog controllers are unrelated to water. The portal texture even uses the fog parameters like a regular %compileWater texture.

    The only potential error I can think of is that I specified the bottommaterial incorrectly. But unlike water textures, the portal texture specifies a bottom material without puting a ".vmt" at its end, while tf2 water textures do (because it is supposed to link to a material file, not a texture). It's weird, but I already played around tried various values for that parameter, following examples in that portal texture and tf2 textures but nothing worked out, which makes me pretty certain that fog just doesn't work with %compileSlime in TF2.

    Nope they are still white. It's probably a portal thing... but If I can use %compilewater on a lightmappedgeneric shader as well, perhaps then the fog works? I gotta experiment more...
     
  10. Dr. Orange

    Dr. Orange L6: Sharp Member

    Messages:
    356
    Positive Ratings:
    267
    All %compilewater does is tell VBSP that the brush this material is applied to should be a water brush. It works with most material properties and shaders other than that.
     
    • Thanks Thanks x 1
  11. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    Weird thing is, if I turned %CompielSlime into %CompileWater, the texture above the water broke, could just be a typo or oversight, buuuut I just figured out why the fog didn't work with the Slime:

    I am incompetent and made a typo with $bottommaterial

    Well, thanks for sticking with me anyway. I'm happy I got it to work.
     
    • Agree Agree x 1
    Last edited: Jun 8, 2017
  12. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    Actually, I think the green splash effect is missing in TF2 because now I'm getting the error- particle effects when ever a ragdoll plunges into the water.

    But I fixed it by just using %CompileWater instead. Anyway, CompileWater works now and CompileSlime is just broken. Thanks for the help~
     
  13. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    931
    Positive Ratings:
    893
    I did this once years ago and I basically copy-pasted the hydro water.
    I think that I actually managed to get fog to work, or maybe I'm just remembering things wrong. I will try to recreate it, as I have deleted the files long ago.
    EDIT: Reread thread. I read too quickly first time and didn't fully understand that a broken bottommaterial causes fog to break. Guess I don't have to do anything after all.
     
  14. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    It's fine now. Fog was only an issue cos I made a typo, and I by using LightMappedGeneric (instead of the water shader) with %CompileWater gave me the desired result. Confusing documentation and broken features made this thread longer than it needed
     
  15. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    931
    Positive Ratings:
    893
    Hm. Maybe I should point out that hydro's water (which is cheap and therefore doesn't have fog anyways) does in fact use LightMappedGeneric together with $basetexture. This probably would have helped sooner.
     
  16. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    Hm, that's certainly interesting since I already tried to use $basetexture with the water shader but it didn't work. Could have been a oversight on my part but since the wiki stated "there is no $basetexture" for the water shader I just gave up on it.
    Does Hydro's $basetexture even work? It doesn't look much different from other water textures besides its color irrc.
     
  17. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    931
    Positive Ratings:
    893
    Again, hydro is using LightMappedGeneric instead of Water. And yes, it does indeed show up. Theres one catch, however.
    The texture itself is garbage. It has clamping for S and T enabled, meaning it's a solid color unless you are at the origin of the map (which doesn't happen on hydro). If you remove this clamping, you will see that the texture is still garbage. The alpha is messed up at the border of the texture, making the tiling as noticable as playing minecraft.
     
    • Thanks Thanks x 1
  18. henke37

    aa henke37

    Messages:
    1,832
    Positive Ratings:
    420
  19. Lampenpam

    aa Lampenpam

    Messages:
    990
    Positive Ratings:
    328
    Weird, you didn't mention that %CompileSmile prevents textures from being depressed. :p

    I actually saw your thread before but all that coding stuff was over my head. Was interesting though
     
    Last edited: Jun 9, 2017
  20. henke37

    aa henke37

    Messages:
    1,832
    Positive Ratings:
    420
    Depressed how? As in being sad and unwilling to do stuff?