Making flowmaps for Source: Part 2

Alright, let’s jump right in.

Open the Flowmap, and Foam images.

 

2

3Then copy the Foam into the Flowmap’s Alpha channel.

4Crop the image to a reasonable size:

5Then scale it down to 512*512,256*256, or 128*128

6You may want to boost the brightness of the Alpha Channel, so that your foam shows up better.

7

 

Now, the process of moving the map into OBJ and whatnot might have caused the image to be rotated or flipped, flipping in your image editor might not work ingame, use hammer’s rotate and scale to do this.

Note: I had to invert my Green channel, if your flow is going backwards to how it looks inside the simulator, try inverting the channels.

 

Save the flowmap image out into your game’s materials folder, a custom location for this like “materials/customwater/flowmaps/mapname_flowmap.tga”


On to:

VTFEdit

Import the TGA (Ctrl+I)

0_1

 

 

It’ll prompt for format information, you’ll want to use DXT5 for Normal and Alpha format, this will let you import the flowmap compressed, with an Alpha.

Those are thesettings I used for the flowmaps, there’s no need for mipmaps.

It will now be in VTFEdit

 

1_212Go ahead and save it as a VTF now.

0_2Now onto make the VMT

For this tutorial, I’m just going to copy an existing material, and just set it to our flowmap, plus one modification.

For this you can just hit “New” inside VTFEdit, and place this code (Portal 2!!)

Water
 {
 $forceexpensive 1
 $normalmap "liquids/water_river_normal_sharp"
 $flowmap "customwater/flow/custom_flowmap_tutorial"
 $flow_normaluvscale 160
 $flow_worlduvscale 1
 $flow_timeintervalinseconds 0.6
 $flow_uvscrolldistance 0.1
 $flow_bumpstrength 1.0
 $flow_noise_texture "liquids/water_noise"
 $flow_noise_scale 0.001
 $flow_debug 0
 $basetexture "liquids/toxicslime_color"
 $color_flow_uvscale 400
 $color_flow_timeintervalinseconds 4
 $color_flow_uvscrolldistance 0.08
 $color_flow_lerpexp 1.0
 $color_flow_displacebynormalstrength 0.009
 $reflecttexture _rt_WaterReflection
 $reflectamount "0.1"
 $reflecttint "{ 190 205 205 }"
 $reflectskyboxonly 0
 $reflectonlymarkedentities 1
 $abovewater 1
 $bottommaterial "nature/toxicslime002a_beneath"
 $fogenable 1
 $fogstart 0
 $fogend 100
 $lightmapwaterfog 1
$fogcolor "{ 58 35 20 }"
 $flashlighttint 1
 "%compilewater" 1
 "%tooltexture" "nature/water_frame01_normal"
 $surfaceprop slime
 }

 Note: the parameters for the water material are complex, please refer to the developer wiki on it for information what each line does.

You’ll want to switch “$flowmap_debug” “0” to “1”, so you can see what it looks like in hammer.


 

HAMMER

Open up your original map:

1You might need to clean up using the visgroups to hide stuff in the way, so you can see the water. Control select all the water faces, then apply your water texture.

0

Select “Treat as one”, and then click C, this will center the texture on your water, you can then scale and transform the texture until it fits what you saw in the flowmap generator.  This is the hardest part of the process, you may need to rotate as well.

Now it’s aligned.

1

From here you can finish whatever, then compile.

2

Once you get ingame, you’ll see it is still colored, you can disable this by changing the 1 to a 0 in “$flow_debug”

fmdbug1

There!

fmdbug0

Note: Sometimes the water flow will now be off-center and in the incorrect position: this can be because it’s wrongly rotated in the image editor, or because Source is being grumpy.  If you have these problems the best way to fix them is to just play around in hammer or the image editor until they work, trial and error time.


 

Watch the flows, and make sure they are actually flowing in the right direction.

It works!

It works!

As I said before, if they don’t flow in the correct direction, then try un-flipping the green channel, or flipping the red. change it until it flows correctly.


 

And you’re done! you now how generated flowmaps for your custom Portal 2 level.

You can download project files and a finished version for creating flowmaps here: http://glitchvid.com/textures/

Video of it in action:

Bookmark the permalink.

One Comment

  1. 2015-08-21 – Fixed some stuff.

    I’m due for a rewrite of this at some point in the future.
    I’ll probably do that once I get a reliable way to create the actual flowmaps using blender’s fluid sim. This depends on if my next project requires this tech again.

Comments are closed