Creating Custom Water

Discussion in 'Mapping Questions & Discussion' started by Rengaurd, Oct 15, 2009.

  1. Rengaurd

    Rengaurd L1: Registered

    Messages:
    6
    Positive Ratings:
    0
    I am new to creating custom textures in general.

    Currently I am trying to create a Custom Water Texture/Brush for a map I am currently working on. This brush can be real "dirty" in the sense that what i want is for them to fall into the water and it catches them instead of them falling onto a solid surface.

    I am not trying to give the surface of the water any glossy look or make it reflect anything. In fact its a simple blue surface right now.

    If anyone could link me to the command needed to create the water in a .vmt file or a site that lists what the commands are, I would appreciate it.
     
  2. Dr. ROCKZO

    Dr. ROCKZO L8: Fancy Shmancy Member

    Messages:
    580
    Positive Ratings:
    159
    It's not quite as simple as that, however I'm not too sure of the exact step by step.. steps. It's been done before (The slidy, sticky water (Portal)) So you may want to look at that map, or ask a more experienced Member here.
     
  3. Schinken

    Schinken L1: Registered

    Messages:
    33
    Positive Ratings:
    15
    You want to put 2 different things together, i don't think it's possible to stop a player on the water (like you want it to) just by the texture. You might need Player clips or Trigger_pushes (so it's harder to get out) ect....

    A texture consists of 2 Parts. The VTF (Valve Texture File i think) which is the Texture itself (all Water Textures in CSS use the same VTF).

    And then there is the VMT (Valve Material File) which is something like a options file. This is what the 2fort water VMT looks like opened in notepad:

    Code:
    "Water"
    {
    
    	<dx90
    	{
    		 	"$fallbackmaterial" "water/water_2fort_dx80"
    	}
    
    	"%keywords" "tf"
    	//	$forcecheap 1
    	
    	"%tooltexture" "dev/tfwater_normal"
    	"%compilewater" 1
    	"$abovewater" 1
    	//"$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
    		}
    	}
    }
    
    Reference:
    http://developer.valvesoftware.com/wiki/Materials
    and
    http://developer.valvesoftware.com/wiki/Textures
    should help ;)
     
  4. Blue552

    Blue552 L3: Member

    Messages:
    137
    Positive Ratings:
    18
    Yea Basically just change the refraction values of the above example.

    Can remove cubemap all together, could look real dodge though.

    Change the fog settings to affect LOS
     
  5. Rengaurd

    Rengaurd L1: Registered

    Messages:
    6
    Positive Ratings:
    0
    I'm assuming that I need to change some of the things like the
    "$fallbackmaterial" "water/water_2fort_dx80"
    to my texture name, but I'm wrong could you tell me where to add it.

    Also by 'catch' i meant that they fall into it like normal water instead of landing on a hard surface like it was a solid brush. Right now it is being treated like a solid brush and driving me nuts because I can't get it to stop. This texture is really basic due to the fact that it is a straight image with now alpha channels or anything like that.

    (side note: this was just a test for me as more of a learning experience as to how to work the water.)

    I would love to have something like a command list or something that explains what all the .vmt commands to trigger things in the texture, and don't know if there is a list anywhere. (as for those links posted above, they gave a bit of insight, but for my ignorance just caused some confusion also)
     
  6. Schinken

    Schinken L1: Registered

    Messages:
    33
    Positive Ratings:
    15
    If i remember correctly $fallbackmaterial is used on older graphics cards.
    Just try the default (water/water_2fort_dx80) i think it's only the top visual level (the waves of the water etc.) the fog and colour etc will still be there.

    Maybe just try using the "water/water_2fort_dx80" fallbackmaterial and test how it looks, if it looks good, why not?^_^
     
  7. Rengaurd

    Rengaurd L1: Registered

    Messages:
    6
    Positive Ratings:
    0
    Well, it kinda worked, but not really. The whole thing wound up turning my texture into 2fort water with 2fort water exact look. I'm guessing my may just have to turn my texture into a func_illusionary with it overtop the water.

    Grrrr, this is gonna be messy.
     
  8. Dr. ROCKZO

    Dr. ROCKZO L8: Fancy Shmancy Member

    Messages:
    580
    Positive Ratings:
    159
    It'll be a great skill to learn though, So you've basically just made a copy of the 2fort water?
     
  9. Rengaurd

    Rengaurd L1: Registered

    Messages:
    6
    Positive Ratings:
    0
    The code that schinkin posted essentially turns the texture into 2fort water and removes any real traits that existed from the texture.

    It almost seemed like the texture wasn't needed anymore and you could make a water texture from just having a .vmt file. But I'm not sure if it actually used my texture or not for the file.
     
  10. Schinken

    Schinken L1: Registered

    Messages:
    33
    Positive Ratings:
    15
    Okay, let me have another try :)

    "$fallbackmaterial" "water/water_2fort_dx80" //Is only used if you have an old graphics card, start tf2 with dx80 support or use simple water(?) i think (i'm not sure about the last one).


    "%tooltexture" "dev/tfwater_normal"
    //This is what the Water texture looks in the Hammer Texture Browser, they all use the same (it doesn't matter what they look like in Hammer)


    $underwateroverlay "effects/water_warp" //This one gives the "Dizzy" underwater look :)

    "$refracttexture" "_rt_WaterRefraction" //this is, as the name sais, the refract texture which tells the engine how to refract objects nearby the water (Mapper's Tip: If you put a prop inside the Water, it will be calculated twice by the engine.


    // "$bumpmap" "water/tfwater001_dudv"
    "$normalmap" "water/tfwater001_normal"
    //kind of refracttexture, it gives the water the "waves" :)


    "$surfaceprop" "water" //tells the engine that this is a water texture :)


    "$bottommaterial" "water/water_2fort_beneath.vmt" //this is what the water surface looks from beneath :)


    "$fallbackmaterial" "nature/water_dx70" //this is the texture to use, if you run TF2 on dx70 (is this even possible x_X?)


    ---------------------------------
    ###################



    Okay, so far so good, as i see i made a little misstake.


    First, if you want a non-refract water texture, try this:

    "$refractamount" ".00" //I'm not sure if it works :)

    Okay next, you want a dirty water so i don't think that there are much waves :).

    "$normalmap" "water/tfwater001_normal"

    This one gives the water the waves, try commenting it ("//") so it wont be recognized anymore, if that is not working, make your own normalmap.

    Normalmaps are just coloured textures. The engine recognizes the colours and calculates a fake depth to the texture (the waves :)).

    For normalmaps you can use Nvidia (Adobe PhotoShop Normal Map and DDS Authoring Plug-ins).
    To create your own .VTF as file :) then just put it there, e.g.:

    "$normalmap" "water/MyWater"

    This should work.

    Also you can use underwater fog, to make the water more dirty.

    "$fogenable" 1 //Enable the fog ;)
    "$fogcolor" "{51 43 13}" (I am not sure why there are brackets around it, but for brown use (was it RGB or BGR?):
    RGB: 139 69 19
    BGR: 19 69 139

    "$fogstart" "-100" //From fog start (where 0 is the water surface i think)
    "$fogend" "400" //to the fog end will blend the fog (0 to 100 percent)


    I hope this helps, if there are still questions, just ask :).
     
    • Thanks Thanks x 2
    Last edited: Oct 16, 2009
  11. Rengaurd

    Rengaurd L1: Registered

    Messages:
    6
    Positive Ratings:
    0
    I think I owe you a beer.

    I am going to test this to see if I can get this to work with my texture. Fingers crossed. If it does or doesn't work out, I will give a shout out either way.