Fake Water Shader

Testing “fake” water shader & trying to make a nice looking river scene (with unity free version..)

http://unitycoder.com/upload/demos/mFakeRiver4/ (*7mb)

Current “features”:

  • Terrain textures & stones are from: Advanced Terrain Shaders v2
  • Terrain modeled with heightmap, imported to Unity with mTerrain
  • Unity Terrain + normal  flat mesh plane for the river
  • Custom “water” shader: Kind of fake reflection/refraction look by using 2 textures (*image#2)
  • UV anim + Weird Waves “DepthBlur” or Refraction (?)
  • Problem: Cannot see through the water at all..

Ideas / Todo/ItWontWork:

  • Perlin noise for the waves?
  • Normal / Vertex Bump/Displacement?
  • Extra Texture layers (one more thin surface fx? more visible river bottom texture?)
  • Cubemap reflection?
  • Distance Blur?
  • Interactive object-on-water fx? (water texture color based on object distance? animated ripples coming out from the object?)
  • Sides should have slower speed +  less sky reflection + more ground color (transparency?)
  • Add particles for water splashing (but a rock on the river?)
  • Fake vignetting with unity free version? (screen sized plane, with vignette texture, drawn on top of everything?)
  • Fake Caustics with caustics map?, heres a nice Caustics Generator

Download source:


(below) Image#2 : Current water shader with 2 textures (12.02.2012)

(below) Image#3: Had to redo the shader.. couldnt make it work with 1 sided planes.. Now using 2 sided box.
Starting to get some see thru effects, just need to animated it and add the surface blurring again.
Made a quick cut on the terrain..doesnt look so nice (see the edges of the terrain near river), but enough for a quick test..

(below) Image#4: Notes
- Added Foam map (currently not moving and it looks like the river has thin ice and the water is flowing under it..)
- Added Cubemap reflection (not strong enough?..have to try fix that & need to find better cubemaps..
- Problems adding vertex waves, but actually rivers dont have “sea waves”.. have to try with moving normals..(?)
- Idea: Create Foam around objects (based on distance?..but then cannot have many objects to do that inside shader?)
- Added webplayer of this version (without the foam)

(below) Image#5 : Current water shader with 4 textures (13.02.2012)

(below) Image#6

- Water is more transparent now (Transparency is based on normals)
-  Got few highlights on the water, just by doubling some color values, not sure how(?) (still would need more “fake light highlights”)
- Tried speedMask texture (middle of the river flowed faster than the sides..but that caused texture stretching problems)
- Foam map failed with speedMask texture (strecthing)
- Tried “BlinnPhong”, but that killed Cubemap..(?) so back to “Lambert”
- In the image there are few stones in the water, looks ok thru the water also
- Maybe needs extra highlight map, middle depth map (some junk flowing inside water..)
- Stone should have foam around it.. (failed to get distance to stone in shader, trying again later..)
- Added webplayer

27 Comments + Add Comment

  • I am just wondering when and where you can download this shader(s)? This is most probably the best free water shader I’ve ever seen and I would really like to use it. Really nice looking work :)

    • The last version still has some “freezing pixels”-issues..and would need a bit of cleanup anyways, but i’ll try to publish atleast some version in a week or so..

  • Added example scene+shader download..(it doesnt have the AdvancedTerrainShader-pack or skybox included, so add those to make it look nicer..). Notes: its not optimized or cleaned up, the river is just fast cut to the terrain, doesnt look nice and cannot see / use bottom textures effects nicely..

  • Now, this really eats resources. My PC which isn’t slow, well perhaps I could do with a better video card, really slows down when I load the demonstration in my browser. Is it just me or the way it is?

    • yes thats the way it is : )..

  • Is there a place where i can download this from? It looks really good man!

    • Currently the download link is only in the toolbar.. (Links / UnityCoder.com / Sources / April2012 / FakeWaterShader.unityPackage)

      (But actually its not really usable.. would have to clean it up and fix many things)

      • okay thanks man

      • Actually seems the available pack in toolbar is not equal to that screenshots result above.
        It’s possible download the latest version from some link?
        Thanks in advance

        • That is the current latest version, but it has some problems and I dont have the previous version anymore (it was a bit better)..Oo

          Also terrain textures & stones are from those Advanced Terrain Shaders package (free from asset store)

  • I like fake river 4 because for large rivers like Thames or Danube you never get to see the river bed or any kind of transparency.

  • Really nice thankyou.

    But is there anyway to change the direction of the water flow?

    Using it in conjunction with free river script the water flows across the river rather than down.

    • Try editing the line with:

      Reverse direction:
      Or add the values to .x instead.. and so on.

      But I guess your river is not a straigth line..?
      Then it would need some more work.. maybe something like flow maps,

      • Thankyou for you reply. I instead found a quick and dirty work around. I dropped the y surface texture tiling down to .2 and this altered the direction of the water flow very nicely.

  • Here’s something nice, “precomputed two sets of tiling and cycling wave displacements”..

    Hmm, just would need to know, how to make loopable waves in 3ds max with free houdini waves plugin..

  • Hello
    Sorry for my English, I write through Google Translator.

    I really liked your shader for water.
    But I can not try it. I can’t download.
    I use UnityCoder.com toolbar, but for some reason it does not give me a link to the download. On the other files in your blog such problems.

    Please tell me what to do?

    • Hi,

      Easy solution: Use Firefox or IE for the download..

      With Chrome there are many problems.
      Sometimes disabling adblock helps.

      • Thanks
        IE helped to solve the problem.

  • Noticed that the shader was used here,

    Community sea shader would had been better there,

  • Why not supported IOS (iPhone4s) normally?
    What can i do to run this shader on iPhone4s normally ?

  • Hi, I really like this! I only have one problem. Part of the river, in the distance is not being rendered; as such when I view the river in game, I see the river perfectly at close/medium distance, but the segment of the river in the distance is not rendered. Any help on this one?

  • Animated Water Shader + flowmaps:

Leave a comment