GPU Water ripple effect - Desktop and iOS source code available

New Version with a Dx11 fix 3/4/2016.
New version of this is hosted here for Unity 5.
https://github.com/brianasu/water-ripple

Water ripple effect done on the GPU. Based on http://freespace.virgin.net/hugo.elias/graphics/x_water.htm

My last post if you are interested is here (2D shadows)
http://forum.unity3d.com/threads/180769-2D-dynamic-soft-shadows-(will-release-source-later)

I plan on making a series of free graphic demos and source.

1245702–53436–$water ripple unity.unitypackage (1.34 MB)

7 Likes

That is pretty awesome! Thanks for sharing!

This effect is amazing! Thanks for sharing it.

Hi,

Nice job. Much appreciated. Thanks for the share.

very nice job absolutely

is there any chance porting to unity free? (with smaller quality of course)

Good effect, and very very interesting job :wink:

Thanks for the comments. Yeah I think I’ll give the unity free version a try. I’m just scared of using Get and SetPixels since it is pretty slow but I might be able to compute it per vertex rather than per pixel. Glad you guys enjoyed it I thought it might be useful in games. I’ll be coming out with some more iOS friendly shader stuff next week.

1 Like

EDITED

Thanks ZJP, it works on Safari for me but for some reason my Chrome wasn’t. I guess I need to go check some of my user preferences… It was just opening up a tab with the link but nothing was being downloaded… First time I had that issue on these forums.

Thanks for sharing brianasu! This is going to be helpful.
-Dane

The link is fine with Firefox and Chrome for me. Doesn’t works with IE10

Here is the dropbox link https://dl.dropboxusercontent.com/u/17249329/water%20ripple%20unity%20v2.unitypackage

I’ve also did a small optimisation and fix to the pixel shader for anyone who wants an update.

Thanks so much brianasu! I am going to play around with it some today, looks really interesting.

-Dane

It’s interesting that the author of that article you mentioned claims that the water ripples need to lose energy. In a force based simulation, the waves eventually cancel each other out automatically anyway. It’s probably losing some energy automatically, due to precision errors, but there’s no need to actually apply an extra dampening force, because that happens automatically due to pressure. The waves get shallower over distance anyway, due to the force being applied to more and more pixels, resulting in less displacement per pixel.

Anyway, still a nice demo. What kind of precision textures does it require? If it only requires standard ARGB32 RenderTextures, that would definitely be an advantage over a more complex simulation.

Yeah you are correct RC-1290. You lose a lot of precision. I’m using just the red channel so 8-bit precision since I can’t seem to get depth or any floating point textures working on iOS. I haven’t tried it yet but it’s possible to pack float into the 32-bit argb but it requires like something like 4-5 multiplications * 4 texture samples to get the surrounding energy

Good job!
It’s very amazing! :slight_smile:
But why is the water surface shader not loading after I restart unity?

Haven’t tried it in a while. May have to update it for unity 4.5

1 Like

… and not working in Unity 5.0.2f1 :wink:

Time to fix it:) I’ll release the code on github after I update it.

1 Like

thanks for sharing it dude it’s amazing, please make it working in Unity 5 :slight_smile:

Should be no problem. Also, don’t forget to check out my GitHub I got a bunch of free stuff there.

1 Like

I’ve started porting it over to Unity 5. You can access it at GitHub - brianasu/water-ripple: Simple GPU water ripples in Unity 5.

I’ve only tested it on mac unity 5.0.2f so be warned. I’ll port over the mobile shaders later.

Enjoy!