Swimming in normal water
I would like to create normal water in hammer. The player has to be able to swim and cubes must not swim so they can be placed on the ground.
I tried several "liquid-type" textures. The water looks nice from above with "liquids/water_swamp_m2_beneath" but the cube is swimming on top and the player is moved by a current/steam although I have just a pool. Also, if the player dives everything gets brown like under toxic water, although the water looks very clear and clean from above.
Do you have any idea how to fix one or all of these problems?
Thanks for reading!
Leon
That is not difficult to achieve. But I'd suggest you to create a custom water material since all stock ones are too much goo like. You could take one of the stock ones (located into portal2/portal2/pak01_dir.vpk file that you can open with GTFScape and into the folder /liquids or /nature)
The key to make the water look like "normal water" is to add into its .vmt material file the following line:
$traslucent 1
You can set its "translucency" with this parameter:
$waterblendfactor 0.30
(go changing the value being a value of 1 = not translucent at all)
Make the brush as usual: all textured nodraw except top side of it.
If you can't make it don't hesitate to send me a pm so I can help you ![]()
EDIT
You must know that a water material with the suffix "_beneath" is used as a bottom material, not really on the surface (top of the water brush), ok? if you look into its vmt file you'll see it is different than the rest in several lines, one of the most important oes is this:
$abovewater 1 (for top maaterial)
$abovewater 0 (for bottom maaterial)
I have read your post regarding the water several times the last months and also started to map again. But I could not make it yet. In between I had to do other stuff so thats why i write to you so late now.
I exported all the water vmt-files from the nature folder and tried to understand them. They didnt see so much different to me, so I took water_bts_01 and extracted it into my portal2/portal2/materials folder. I edited it as you said but when I rendered the map it was still yellow/brown and goo like.
There are the lines:
*$abovewater 1
$bottommaterial "nature/toxicslime002a_beneath" *
so although above water is "1" an bottommaterial is given? I tried to change it to $bottommaterial "liquids/water_river_normal_sharp" but no effect.
I also tried to adjust the fog values, which were default:
*$fogenable 1
$fogstart 0
$fogend 60
$lightmapwaterfog 1
$fogcolor "{ 90 70 20 }"
$flashlighttint 1
"%compilewater" 1
"%tooltexture" "nature/water_frame01_normal"
$surfaceprop slime
*
I changed color, fogstart, and even disabled fog but somehow I could not see any effect ingame.
Could you post the content of a vmt-file that would work?
And what is also bothering me with the nodrow texture on the sides: I want to fill an aquarium, so it should not look from side the same as empty :/
Thanks in advance. ![]()
Sorry, I missed your post!
Let me explain the parameters you should consider to make the translucent water:
-
First of all, I made a stupid mistake and said $translucent 1 where I should have said $pseudotranslucent 1... sorry for this! THis parameter is the most important to make your water translucent.
-
Now you can modulate that translucency by changing the value of $waterblendfactor as I already told you in previous post, where 0 is totally transparent and 1 opaque. Usually 0.5 is a good value.
Leon wrote:
I edited it as you said but when I rendered the map it was still yellow/brown and goo like.
This is because of the following line:
$basetexture "liquids/toxicslime_color"
Just delete it, it is not required for the water to work, and it is what gives the water the goo look. However, if you don't want to erase it BUT you introduced the $pseudotranslucent 1 param, you can still have translucent water with values of $waterblendfactor closer to "0".
Leon wrote:
There are the lines:
$abovewater 1
$bottommaterial "nature/toxicslime002a_beneath"
so although above water is "1" an bottommaterial is given? I tried to change it to $bottommaterial "liquids/water_river_normal_sharp" but no effect.
Listen, I think you have all concepts a bit mixed up altogether
There are a few required parameters for the water to work properly:
-
the above material: this is the main one and is declaredd by *$abovewater 1*. It's the water you see from above the surface.
-
the bottom or beneath material: this one must be declared in the main material, and that's done by $bottommaterial "[path to the bottom texture material name here]"*. This is the water you'll see if you jump into the water, from below the surface (when you die into Portal you see this dirty goo, that is the "nature/toxicslime002a_beneath"* that many of the materials use)
-
fog: the water shader is a fogged material, you just can't disable fog. It's declared by the *$fogenable 1* parameter into the main material.
-
the normal map: this is how the water surface shape looks like. The water_river_normal_sharp.vtf is one example of these, there is also another into /nature folder in the .VPK called water_frame01_normal... you can open them to check, they are all blueish because the engine uses this colours-code to understand the information about a given surface. So these only affects the shape of your water surface, ok? You declare it by *$normalmap "[path to the normal texture name here]"*
-
the flow map: this is the movement of the surface of your water; these are also "maps", like the nromal map, and have a certain colours-code that the engine uses to understand where to move what part. There are a bunch of them into the /liquids folder inside your .VPK file. You declare it by *$flowmap "[path to the flow texture name here]"*
Additionally, for the translucent water, the fog color, and where your fog starts and ends is important:
-
The color because it will make your water lighter (clear) or darker (dirty). Bookmark this page in order to know the RGB colours used in mapping. Find the lightest colours for your transparent water.
-
$fogstart*: it's the distance from the "eye" to where the fog must start in inches. This use to be "0", and the VDC indeed says that it "Must be 0 for edge fading to work properly"*
-
*$fogsend*: distance from the eye where the fog should end in inches. To be honest, I can't really see any significative difference in the above material when your water is pseudotranslucent, but it does make a difference in the bottom one: you want to give it values above 200-300 in order to see clearly underneath the water.
I'm attaching 2 materaials, above (josepezdj_water_transparent.vmt) and bottom (josepezdj_water_transparent_beneath.vmt), for you. Check and test them. You must place the bottom one into a /josepezd/water folder, or change the path to the correct location into the "above" material, ok?
Regarding your aquarium, I'm afradi you should find a workaround for that. Your water brush must be always textured nodraw except the topmost face, no exceptions; you can't either texture a vertical face, only one that's horizontally oriented, ok? This is a limitation of the shader "Water".
However, there are workarounds. You could fake the sides of that aquarium by creating another material with the "Refract" shader instead of the "Water" shader. There is a good tuto at Interlopers about this if you need more help 
I look forward to see what you do with transparent water!
I created a new folder "my materials" inside the folder "portal 2/portal2/materials", copied your files in it and changed the path for the beneath material inside the main material accordingly.
But the water is white from above and black from below. Do you have an idea?
And do I have to compile the map again or just reload the map, after I change the material text file?
What did you set as the bottom texture? And remember, water won't work on vertical surfaces. Only horizontal rectangles.
Leon wrote:
But the water is white from above and black from below. Do you have an idea?
If what I'm seeing around your pool is a glass texture, that's the problem. Try testing it without glass, but whatever other texture instead, it should work good. Glass has special properties and the engine compile those materials giving them these properties. I told you that for the sides you should use different materials making use of the refract shader, not the water shader...
Thanks.
And also for the reload command! ![]()
You textured the water brush properly: only the top face must be texture with the (above) water material, rest with no-draw. BUT you must not use glass material for the brushes that contain the water, ok? Please change those glass textures surrounding the water brush and you'll see that the water appears correctly, not white.
Then, my suggestion is to create different materials to use them apart to fake the side walls of your pools, but for this you should use separate brushes, not those that contain the water, ok? (for example 1 unit thick brushes at each of the 4 sides of your pool). This time, since they must appear on vertical side of a brush, you should use "Refract" shader instead of "Water" one inside the material, ok? ("Water" shader can only be used on horizontal faces)...
I'm really busy lately, but I'll try to prepare some refract material to be used there. ![]()
I have two maps with the water, one for testing (naked room with water) and the real map "H2O" imported from the PETI editor.
I removed the glass in my test map, as you said, and yes the black stuff was gone and the water looked nice from beneath! But it was still white on top. I think I know the reason:
Somehow my hammer does not render the light maps correctly or at least my portal does not load them. I started portal via hammer and all was bright, no shadows. Then I restartet portal again via steam and tested a custom map where i had shadows again. When I loaded the map "H2O" via console without rendering it again suddenly I had correct light maps. From above settings are fine now. Although I still dont know why it worked this time and not before (and now my shadows are gone again). When I dive into the water in the "H2O" map, the surface from beneath is not working properly as you can see in the screenshot (ignore the black, there is just no wall there). The color is changing rapidly to all diferent kind when the player moves through the water.
And is there a way that the player is not pushed by the water? It's like in a river as default.
This is tough 
PS: My console is spamming this message
* Trying to set a pixel shader that failed loading!*
Let me explain the map a bit:
I have water on the ground so that the player has to jump into it right from the beginning in order to teach, that this type of water will not harm.
The water in the aquarium is not there yet but I have planned to allow the player to fill the aquarium by triggering the water dispender (by moving the water and refraction brushes out of the floor).
Thanks and good luck. ![]()
FelixGriffin wrote:
Water can't be on a brush entity. You would need a func_water_analog with a special analog texture.
This.
Leon, bare in mind that the textures you are using here must be slightly modified in order to make them be used with the func_water_analog (the only entity you can tie a water brush to), basically we have to change real-time reflections/refractions for pre-calculated ones. So these lines:
$reflecttexture _rt_WaterReflection
$reflectamount "0.4"
OR
$refracttexture _rt_WaterRefraction
$refractamount "0.2"
should be changed by these:
$forceenvmap 1
$envmap env_cubemap
(You might want to take a look to this other thread/post related to this entity; I posted a couple of materials that might look good for your purposes too
)
Leon wrote:
PS: My console is spamming this message
* Trying to set a pixel shader that failed loading!*
This is caused by the env_projectedtexture whenever the player gets underneath the water (you can see how underneath the water the environment is flickering). I spent quite some time in the past trying to make a translucent water material capable to avoid this problem to no avail; then I thought it must be a shader problem related with the impossibility of projecting shadows beyond the water surface. If you turn off the env_projectedtexture (and only leave light antities and light_spots), that error message is gone and no more flickering underneath the water.
Leon wrote:
I removed the glass in my test map, as you said, and yes the black stuff was gone and the water looked nice from beneath! But it was still white on top.
For a black tile texured pool, darker fog colours should look better. So change:
$fogcolor "{224 255 255}"
for a darker one as for example the following dark blue:
$fogcolor "{22 47 53}"
You should also change the fog colour in the water_transparent_beneath material because yuo'll see a whitey fog colour when you are underneath the water.
I am using the water_movingplane texture that i downloaded from another forum, but the surface itself is the only thing textured, as well as the bottom of said surface.
I wanted to make it a foggy blue
If you want to change the fog colour, open the .VMT file and change the values in the line $fogcolor

Fracture wrote:
what are your properties for the halflife2 water? I dont want to have to download mine all over again. Took forever the first time.
you can just extract HL2 things from the files that come with portal (I think):
..Steam\SteamApps\source materials.gcf
or maybe from source 2007 shared materials.gcf
I dont know what YOUR directory looks like but I aint got that in there. There are two appmanifest files and they are .ACF filetypes
josepezdj wrote:
Have you checked this post? it's already mentioned in my previous post. Grab those materials and test if that is what you are looking for.
That was my thread, remember?. Back when I had an even worse idea of what i was doing. And that water wasn't what i was looking for, it flowed like it was coming off an ocean. My water is motionlessly sitting in a tank. But it rises when a valve is opened. This is where i got the water i am using.
mapping-help/nature-water-movingplane-texture-does-not-exist-for-me-t4149.html
THIS is what i am trying to acheive. Everything I typed into the vtf does nothing