You’ve just played Bioshock… Wandering through the underwater streets of Rapture, you’re amazed by how effective the water shaders are that line the walls, creating a shimmering, warping effect that makes it seem like you’re under the sea… and now you want to know how to achieve that effect in Source. Good news. It’s possible, and here’s how.

Firstly, you’ll need two programs, which if you’ve been following this blog you’ll already have, but if you’ve arrived here via Google, download them below and follow the installation instructions given:

Boot up Photoshop, and create a blank canvas, 512 x 512 in size. Use the Cloud Filter with white and light blue (or any colours), and create a nice looking effect similar to below:

Bioshock Style Water Texture

Now you’ll need to use the Offset Filter (described in the Tiling Textures tutorial) to make the texture tile perfectly for when we animate it later. Save this texture as underwater_glass.vtf using Nem’s VTF plugin and drop it into a “textures” directory in your materials folder of your mod. Now go to Filter; NVidia Tools; NormalMapFilter.

Bioshock Style Water Texture

A window will appear, this is the NVidia Normal Map Filter plugin, and it allows you to create Normal maps for your textures. Use the following settings to create a second texture based on the first.

Bioshock Style Water Texture

Once done, add a Gaussian Blur from Filter; Blur; Gaussian Blur.

Bioshock Style Water Texture

Adjust it to look similar to this:

Bioshock Style Water Texture

Save this file as “underwater_glass_normal.vtf” using Nem’s plugin and change Template in the window that opens to “Normal Map”.

Go back to your original file again, and open the NVidia Normal Map Filter again (Filter; NVidia; NormalMapFilter). This time we’re going to create a DuDv map, so use the settings below to create it:

Bioshock Style Water Texture

The result should look like the image below:

Bioshock Style Water Texture

Save this file as “underwater_glass_dudv.vtf” and change the Template setting to “DuDv”. Now you need to create a single VMT file using Notepad to control how the texture works. So open up Notepad and paste the following code inside, which includes fallbacks when using older versions of Direct X.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"Refract"
{
"$model" "1"
"$bluramount" "1"
"$surfaceprop" "glass"
"$refractamount" ".100"
"$scale" "[1 1]"
"$normalmap" "textures/underwater_glass_normal"
"$dudvmap" "textures/underwater_glass_dudv"
"$REFRACTTINTTEXTURE" "textures/underwater_glass"

"Proxies"
   {
      "TextureScroll"
      {
         "texturescrollvar" "$bumptransform"
         "texturescrollrate" .1
         "texturescrollangle" -90
      }
   }


   "Refract_dx90"
   {
      "$refractamount" "0.100"
   }
   
   "Refract_DX80"
   {
   "$refractamount" ".025"
   "$REFRACTTINTTEXTURE" "textures/underwater_glass"

       "Proxies"
           {
      "TextureScroll"
      {
         "texturescrollvar" "$bumptransform"
         "texturescrollrate" 0.1
         "texturescrollangle" -90
      }
      }
   }

   "UnlitGeneric_dx8"
   {
        "$basetexture" "textures/underwater_glass"
       "Proxies"
           {
            "Sine"
               {
                   "resultVar"    "$alpha"
                   "sineperiod"   15
                   "sinemin"      0.1
                   "sinemax"      0.1
              }
      }

   "UnlitGeneric_dx6"
   {
        "$basetexture" "textures/underwater_glass"
       "Proxies"
           {
            "Sine"
               {
                   "resultVar"    "$alpha"
                   "sineperiod"   15
                   "sinemin"      0.1
                   "sinemax"      0.1
              }
      }
   }
}
}

Save the file as “underwater_texture.vmt” and include the quotation marks to ensure it saves as a VMT file and not a TXT file. Now just load up Hammer, and place your texture where you want it! Once you’re happy, compile your map and check it out in game! If all has gone well, it should look like this, only better as it’s actually moving and refracting the objects behind it!

Bioshock Style Water Texture

Now you’ve just got to promise me you didn’t steal the images directly from this tutorial and use them! It’s far more fun to do it yourself!

13 Responses to “Textures: Refraction – Bioshock Style”

  1. Theory Says:

    If you don’t have Photoshop, there’s always Normal maps in GIMP. :-)

  2. Wills Says:

    There are? Like, in built into GIMP?

  3. Connway Says:

    Yup, it’s built in. Filters -> Map -> Bump Map.
    CrazyBump is pretty good too.

  4. Jakob Says:

    hello Wills

    Can you upload the final file on, example file-front ?

    i really can’t find out making this. xD

  5. Jakob Says:

    —>And maby post the link :)

  6. Vidster Says:

    Should the texture appear as a black and purple checkerboard?

  7. Wills Says:

    I’ll upload the final result later today for you guys. And to Vidster, no it shouldn’t. Check your VMT file for spelling errors and any context mistakes.

  8. Jakob Says:

    THANKS! :)

  9. Wills Says:

    http://www.jailbreaksource.com/betafiles/bioshock_glass.zip

    Make sure to either change the names or locations within the VMT files, or just stick them inside materials/jb_textures to make them work!

  10. Jakob Says:

    Not that it has to much to do with the subject
    but, if you want to see what i have been doing latly
    here is a link:

    http://forums.tf2maps.net/showthread.php?t=7199

  11. Jakob Says:

    “lately” sorry :)

  12. Jono Says:

    Hey, any chance of uploading the files again please?

    I tried it myself but there must be an error somewhere in my vmt somewhere but for the love of things I can’t find it and I keep getting the purple and black checkers :(

  13. Jono Says:

    Actually wait, its okay I managed to get it to work :D

    Cheers for tutorial anyway :P

Leave a Reply