Water texture that isn't actually water?
Quote from ChickenMobile on July 27, 2014, 1:51 amAnother Bad Pun wrote:Portal 2 doesn't support func_water_analog; I'm almost positive.Confirmed does, was playing around with this previously
Problem is that dx70 textures only really support cubemap reflections and they look utterly horrible - the fog you see while in water cannot be rendered and it relies on scrolling/animated textures instead of the cool blending water effects compiled with water.
Probably the best effect on moving water is to make the water completely opaque and rely on cheap reflections from cubemaps - like Dr Keleiner's orange tubes.
I however did have a dream last night with dx90 proxies... is this a sign?
Although the image from cs_militia looks promising - may steal this.
Confirmed does, was playing around with this previously
Problem is that dx70 textures only really support cubemap reflections and they look utterly horrible - the fog you see while in water cannot be rendered and it relies on scrolling/animated textures instead of the cool blending water effects compiled with water.
Probably the best effect on moving water is to make the water completely opaque and rely on cheap reflections from cubemaps - like Dr Keleiner's orange tubes.
I however did have a dream last night with dx90 proxies... is this a sign?
Although the image from cs_militia looks promising - may steal this.
Quote from HMW on July 28, 2014, 3:46 pmI've had a reflecting and refracting water-like material in Portal 1 at one point. I vaguely remember using a "refract" shader with some special keywords for the $envmap and $refracttexture parameters, "_rt_reflection" and "_rt_refraction" respectively. However performance was horrible so I trashed it. Tried to reproduce it in Portal 2 but those keywords don't work anymore. (Or I remembered them wrong.) Would pursue this further but my GFX card is feeling very crashy today
I think your alternative idea is not so bad: to have a room with water and one without, and teleport between them. That's what I did in "A beam too far", to turn the lights on after the power-up. You may be able to avoid world portals by using a "relative" trigger_teleport. (One with a landmark set.)
If you want to try the 3D skybox method, you'll need to name your sky_cameras (add a "targetname" attribute outside of SmartEdit) and send them "activateskybox" inputs to switch between them. But the reflection is probably still going to be off unless you build a miniature version of the whole map inside the 3D skybox.
I've had a reflecting and refracting water-like material in Portal 1 at one point. I vaguely remember using a "refract" shader with some special keywords for the $envmap and $refracttexture parameters, "_rt_reflection" and "_rt_refraction" respectively. However performance was horrible so I trashed it. Tried to reproduce it in Portal 2 but those keywords don't work anymore. (Or I remembered them wrong.) Would pursue this further but my GFX card is feeling very crashy today
I think your alternative idea is not so bad: to have a room with water and one without, and teleport between them. That's what I did in "A beam too far", to turn the lights on after the power-up. You may be able to avoid world portals by using a "relative" trigger_teleport. (One with a landmark set.)
If you want to try the 3D skybox method, you'll need to name your sky_cameras (add a "targetname" attribute outside of SmartEdit) and send them "activateskybox" inputs to switch between them. But the reflection is probably still going to be off unless you build a miniature version of the whole map inside the 3D skybox.
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic
Quote from josepezdj on July 29, 2014, 2:25 amChickenMobile wrote:Suppose josepezdj might know some things?Well, first of all, you already know many of those parameters you used into your material are specific for the Water shader, so they're not doing much there
To me there are 2 possible shaders to use here, LightmappedGeneric and Refract to have water without the Water shader and therefore to be able to apply the material to brush entities. However the idea behind both is the same, you've already got 2 interesting animated textures (from the HL years) inside the pak01_dir.VPK:
- dev/water_dudv.VTF
- dev/water_normal.VTFIf you 'play' them into VTFEdit you'll see all frames in motion doing a cool water surface movement. So basicly you need to add the corresponding proxies into your material files in order to animate them at a certain same rate. Like so:
- Code: Select all
Proxies
{
animatedtexture
{
animatedtexturevar $dudvmap
animatedtextureframenumvar $dudvframe
animatedtextureframerate 30.00
}
animatedtexture
{
animatedtexturevar $normalmap
animatedtextureframenumvar $bumpframe
animatedtextureframerate 30.00
}
texturescroll
{
texturescrollvar $bumptransform
texturescrollrate .05
texturescrollangle 45.00
}
}This is the full content for that material I made for Oxygen Station's human capsules glass, using the Refract shader:
- Code: Select all
Refract
{
$model 1
$refractamount ".2"
$forcerefract 1
$bluramount 1
$refracttint "{164 210 219}"
$scale "[0.5 0.5]"$dudvmap "dev/water_dudv"
$normalmap "dev/water_normal"
$dudvframe 0
$bumpframe 0$surfaceprop water
%toolstexture "josepezdj/water/jose_vertical_wall_of_water"
$refracttinttexture "josepezdj/water/jose_vertical_wall_of_water"
Proxies
{
animatedtexture
{
animatedtexturevar $dudvmap
animatedtextureframenumvar $dudvframe
animatedtextureframerate 30.00
}
animatedtexture
{
animatedtexturevar $normalmap
animatedtextureframenumvar $bumpframe
animatedtextureframerate 30.00
}
texturescroll
{
texturescrollvar $bumptransform
texturescrollrate .05
texturescrollangle 45.00
}
}}
NOTES:
1. I added the param '$model 1' because I turned the capsules into models, just erase that line in order to be able to locate the material into your texture browser and to actually use it on a func_brush or whatever brush entity.
2. The Refract shader could seem a bit annoying and difficult to implement without seeing purple checkerboards or a lot of console messages about a bad rendering; in order to avoid that, you need to use the param '$refracttinttexture' with a path to an actual texture (I made a soft smokey blueish one for my capsules, which I'm attaching to this post as example).
[EDIT] 3. If you need to see the refracting movement from underneath the water, just add "$nocull 1" to the VMT material.
[EDIT] 4. I guess that you could use a fog_volume entity right in the hollow of the water pool to complement the water beneath...
If you want to try out the LightmappedGeneric shader, the idea is the same, but you need to do it differently. I posted some working materials for the func_water_analog (that does work in P2) some time ago here.
Here the idea is to animate the $basetexture texture with proxies, while you also play with its offset and scale. Check:
- Code: Select all
"Lightmappedgeneric"
{
"$abovewater" 0
"%compilewater" 1
"$basetexture" "josepezdj/water/jose_turquoise_water_animated"
"$scale" "[1 1]"
"$translucent" "1"
"$nocull" "1"
"$surfaceprop" "water"
"$envmap" "env_cubemap"
"$envmaptint" "[1 .9 .8]"
"$envmapcontrast" "1"
"$texoffset" "[0 0]"
"$texscale" "0.5"
"$bottommaterial" "josepezdj/water/water_movingplane_beneath""Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 20.00
}"TextureScroll"
{
"texturescrollvar" "$texoffset"
"texturescrollrate" .005
"texturescrollangle" 45.00
}"TextureTransform"
{
"translateVar" "$texoffset"
"scaleVar" "$texscale"
"resultVar" "$basetexturetransform"
}
}
}If you don't really like my edited (turquoise) animated texture, let me know, I can send the original "silvery" one when I arrive home later today.
Try any of those approaches and check out how they look in-game, however, forget about real-time reflections, it's impossible to achieve it without the Water shader and the $reflecttexture _rt_WaterReflection / $refracttexture _rt_WaterRefraction.
Do not hesitate to give me a buzz if you need further assistance from me.
Well, first of all, you already know many of those parameters you used into your material are specific for the Water shader, so they're not doing much there
To me there are 2 possible shaders to use here, LightmappedGeneric and Refract to have water without the Water shader and therefore to be able to apply the material to brush entities. However the idea behind both is the same, you've already got 2 interesting animated textures (from the HL years) inside the pak01_dir.VPK:
- dev/water_dudv.VTF
- dev/water_normal.VTF
If you 'play' them into VTFEdit you'll see all frames in motion doing a cool water surface movement. So basicly you need to add the corresponding proxies into your material files in order to animate them at a certain same rate. Like so:
- Code: Select all
Proxies
{
animatedtexture
{
animatedtexturevar $dudvmap
animatedtextureframenumvar $dudvframe
animatedtextureframerate 30.00
}
animatedtexture
{
animatedtexturevar $normalmap
animatedtextureframenumvar $bumpframe
animatedtextureframerate 30.00
}
texturescroll
{
texturescrollvar $bumptransform
texturescrollrate .05
texturescrollangle 45.00
}
}
This is the full content for that material I made for Oxygen Station's human capsules glass, using the Refract shader:
- Code: Select all
Refract
{
$model 1
$refractamount ".2"
$forcerefract 1
$bluramount 1
$refracttint "{164 210 219}"
$scale "[0.5 0.5]"$dudvmap "dev/water_dudv"
$normalmap "dev/water_normal"
$dudvframe 0
$bumpframe 0$surfaceprop water
%toolstexture "josepezdj/water/jose_vertical_wall_of_water"
$refracttinttexture "josepezdj/water/jose_vertical_wall_of_water"
Proxies
{
animatedtexture
{
animatedtexturevar $dudvmap
animatedtextureframenumvar $dudvframe
animatedtextureframerate 30.00
}
animatedtexture
{
animatedtexturevar $normalmap
animatedtextureframenumvar $bumpframe
animatedtextureframerate 30.00
}
texturescroll
{
texturescrollvar $bumptransform
texturescrollrate .05
texturescrollangle 45.00
}
}}
NOTES:
1. I added the param '$model 1' because I turned the capsules into models, just erase that line in order to be able to locate the material into your texture browser and to actually use it on a func_brush or whatever brush entity.
2. The Refract shader could seem a bit annoying and difficult to implement without seeing purple checkerboards or a lot of console messages about a bad rendering; in order to avoid that, you need to use the param '$refracttinttexture' with a path to an actual texture (I made a soft smokey blueish one for my capsules, which I'm attaching to this post as example).
[EDIT] 3. If you need to see the refracting movement from underneath the water, just add "$nocull 1" to the VMT material.
[EDIT] 4. I guess that you could use a fog_volume entity right in the hollow of the water pool to complement the water beneath...
If you want to try out the LightmappedGeneric shader, the idea is the same, but you need to do it differently. I posted some working materials for the func_water_analog (that does work in P2) some time ago here.
Here the idea is to animate the $basetexture texture with proxies, while you also play with its offset and scale. Check:
- Code: Select all
"Lightmappedgeneric"
{
"$abovewater" 0
"%compilewater" 1
"$basetexture" "josepezdj/water/jose_turquoise_water_animated"
"$scale" "[1 1]"
"$translucent" "1"
"$nocull" "1"
"$surfaceprop" "water"
"$envmap" "env_cubemap"
"$envmaptint" "[1 .9 .8]"
"$envmapcontrast" "1"
"$texoffset" "[0 0]"
"$texscale" "0.5"
"$bottommaterial" "josepezdj/water/water_movingplane_beneath""Proxies"
{
"AnimatedTexture"
{
"animatedtexturevar" "$basetexture"
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 20.00
}"TextureScroll"
{
"texturescrollvar" "$texoffset"
"texturescrollrate" .005
"texturescrollangle" 45.00
}"TextureTransform"
{
"translateVar" "$texoffset"
"scaleVar" "$texscale"
"resultVar" "$basetexturetransform"
}
}
}
If you don't really like my edited (turquoise) animated texture, let me know, I can send the original "silvery" one when I arrive home later today.
Try any of those approaches and check out how they look in-game, however, forget about real-time reflections, it's impossible to achieve it without the Water shader and the $reflecttexture _rt_WaterReflection / $refracttexture _rt_WaterRefraction.
Do not hesitate to give me a buzz if you need further assistance from me.
Quote from DaMaGepy on July 29, 2014, 10:50 amspeaking of waters.... anyone know how to lower the volume of that annoying loud soun when I step into a water? MAybe just replacing the wav that it plays with a lower volumed sounfile is enugh? Even if I only step into a small puddle it still plays that annoying effect.
speaking of waters.... anyone know how to lower the volume of that annoying loud soun when I step into a water? MAybe just replacing the wav that it plays with a lower volumed sounfile is enugh? Even if I only step into a small puddle it still plays that annoying effect.
Quote from josepezdj on July 29, 2014, 11:13 am@Damagepy: Well, looking into the file "portal 2/portal2/scripts/surfaceproperties.txt" you'll find the different sound entries each surface property will fire.
You've got "mud", "water" and "slime" here. But all of them fire these sound entries:
- Mud.StepLeft
- Code: Select all
"Mud.StepLeft"
{
"channel" "CHAN_AUTO"
"soundlevel" "SNDLVL_NORM"
"volume" "0.60"
"pitch" "90,105"
"rndwave"
{
"wave" "player/footsteps/mud1.wav"
"wave" "player/footsteps/mud3.wav"
}
}- Mud.StepRight
- Code: Select all
"Mud.StepRight"
{
"channel" "CHAN_AUTO"
"soundlevel" "SNDLVL_NORM"
"volume" "0.60"
"pitch" "90,105"
"rndwave"
{
"wave" "player/footsteps/mud2.wav"
"wave" "player/footsteps/mud4.wav"
}
}Those 2 sound entries are defined inside "portal 2/portal2/scripts/game_sounds_physics.txt", where you find the 4 sound files they're using:
- player/footsteps/mud1.wav
- player/footsteps/mud2.wav
- player/footsteps/mud3.wav
- player/footsteps/mud4.wav(all relative to /sound and inside the "pak01_dir.VPK")
The only way I can think of tweaking this is to create a DLC3 folder and a new pak01_dir.VPK file with any of the above changed/edited.
@Damagepy: Well, looking into the file "portal 2/portal2/scripts/surfaceproperties.txt" you'll find the different sound entries each surface property will fire.
You've got "mud", "water" and "slime" here. But all of them fire these sound entries:
- Mud.StepLeft
- Code: Select all
"Mud.StepLeft"
{
"channel" "CHAN_AUTO"
"soundlevel" "SNDLVL_NORM"
"volume" "0.60"
"pitch" "90,105"
"rndwave"
{
"wave" "player/footsteps/mud1.wav"
"wave" "player/footsteps/mud3.wav"
}
}
- Mud.StepRight
- Code: Select all
"Mud.StepRight"
{
"channel" "CHAN_AUTO"
"soundlevel" "SNDLVL_NORM"
"volume" "0.60"
"pitch" "90,105"
"rndwave"
{
"wave" "player/footsteps/mud2.wav"
"wave" "player/footsteps/mud4.wav"
}
}
Those 2 sound entries are defined inside "portal 2/portal2/scripts/game_sounds_physics.txt", where you find the 4 sound files they're using:
- player/footsteps/mud1.wav
- player/footsteps/mud2.wav
- player/footsteps/mud3.wav
- player/footsteps/mud4.wav
(all relative to /sound and inside the "pak01_dir.VPK")
The only way I can think of tweaking this is to create a DLC3 folder and a new pak01_dir.VPK file with any of the above changed/edited.
Quote from FelixGriffin on July 29, 2014, 11:16 amSince the surfaceproperties file isn't in a VPK, you could pak a copy into your BSP with the volume levels for those entries lowered.
Since the surfaceproperties file isn't in a VPK, you could pak a copy into your BSP with the volume levels for those entries lowered.
Quote from ChickenMobile on July 30, 2014, 7:00 amjosepezdj wrote:To me there are 2 possible shaders to use here, LightmappedGeneric and Refract to have water without the Water shader and therefore to be able to apply the material to brush entities. However the idea behind both is the same, you've already got 2 interesting animated textures (from the HL years) inside the pak01_dir.VPK:Believe it or not I fiddled around with these textures and the refract shader for around 2 hours or so on Tuesday. 'Refract' seems to fade very close to the player proximity (of around 2 meters) and again, doesn't look very good. I can see how this could be useful for making custom distorted glass, but for large bodies of water - not so good.
Thanks for the examples Jose, I'll give it a whirl and see how it turns out.
EDIT: The vertical wall water looks lovely! But... it fades like the rest of the refract textures
water0001.jpgEDIT2: I would assume that the texture would act differently on a model seeing as kleiner's tubes have almost identical .vmt structure.
Believe it or not I fiddled around with these textures and the refract shader for around 2 hours or so on Tuesday. 'Refract' seems to fade very close to the player proximity (of around 2 meters) and again, doesn't look very good. I can see how this could be useful for making custom distorted glass, but for large bodies of water - not so good.
Thanks for the examples Jose, I'll give it a whirl and see how it turns out.
EDIT: The vertical wall water looks lovely! But... it fades like the rest of the refract textures
EDIT2: I would assume that the texture would act differently on a model seeing as kleiner's tubes have almost identical .vmt structure.
Quote from josepezdj on July 30, 2014, 7:27 amYup. However, I discovered when I made those capsules that the texture scale in the brush textured with the material is important for that fading out effect. If you can, try to adjust it so the water keeps being visible along the necessary "meters" in the room containing that pool. I can't really remember how that worked exactly though, I think that lower scale values (< 0.25) will make the material visible for more meters...
EDIT: Well, maybe for my capsule models I achieved it, and it's true that I avoided the fading out effect. I can check when I arrive home... If you need me, I can turn your water brushes into models
Yup. However, I discovered when I made those capsules that the texture scale in the brush textured with the material is important for that fading out effect. If you can, try to adjust it so the water keeps being visible along the necessary "meters" in the room containing that pool. I can't really remember how that worked exactly though, I think that lower scale values (< 0.25) will make the material visible for more meters...
EDIT: Well, maybe for my capsule models I achieved it, and it's true that I avoided the fading out effect. I can check when I arrive home... If you need me, I can turn your water brushes into models
Quote from ChickenMobile on July 30, 2014, 7:39 amMaking a movable water model using the refract texture would be extremely useful... especially in places where you do not actually interact with it.
Might bring out the propper!
Making a movable water model using the refract texture would be extremely useful... especially in places where you do not actually interact with it.
Might bring out the propper!
Quote from josepezdj on July 30, 2014, 7:44 amYeah, off the top of my head I DO think that was one of the main reasons why I turned those capsule glasses into models.
If you can't propper it just post the VMF with your water brush and I'll propper it for you
Yeah, off the top of my head I DO think that was one of the main reasons why I turned those capsule glasses into models.
If you can't propper it just post the VMF with your water brush and I'll propper it for you