# Have anyone seen any fake interactive water surface?

**URL:** <https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974>\
**Category:** General Discussion\
**Created:** [October 17, 2016, 1:02pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974 "2016-10-17T13:02:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaxx](https://realtimevfx.com/user_avatar/realtimevfx.com/gaxx/32/501_2.png) [@Gaxx](https://realtimevfx.com/u/Gaxx)\
**Post date:** [October 17, 2016, 1:02pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/1 "2016-10-17T13:02:26Z")

</div>

Hello guys!

I remember that long time ago I saw some really nice effect in a game with fake fluid surface in bottles/glasses. Basicaly it looked like depening on the angle of the bootle the fluid compensated this angle by offseting its vertex positions so that it always looked leveled.

Maybe my memory of this is not that vivid but I surely remember that I saw something like that somehere and would like to incorporate this behaviour in my game.

I thought I saw that in one of the GDC’s Valve presentations but haven’t been able to find this.

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![Travis](https://realtimevfx.com/user_avatar/realtimevfx.com/travis/32/9559_2.png) [@Travis](https://realtimevfx.com/u/Travis)\
**Post date:** [October 17, 2016, 2:15pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/2 "2016-10-17T14:15:36Z")

</div>

I remember this too, so you’re not going crazy! I just don’t remember where either

---

<div class="post-metadata">

**Author:** ![Keith](https://realtimevfx.com/user_avatar/realtimevfx.com/keith/32/15_2.png) [@Keith](https://realtimevfx.com/u/Keith)\
**Post date:** [October 17, 2016, 3:17pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/3 "2016-10-17T15:17:05Z")

</div>

I beleive you might be thinking of Eben Cook’s crazy shader work for The Last of Us - he made a great GDC presentation all about liquid effects in TLOU, but at a quick browse I can’t find the full video’d version:

> **[Surface Tension: Liquid Effects in The Last of Us](https://www.gdcvault.com/play/1021278/Surface-Tension-Liquid-Effects-in)**
>
> In The Last of Us you spill a lot of blood during melee combat and gun fighting. It was important that the effects had a realistically rendered appearance even if the amount and use of blood was stylized. The blood and water in the game needed to...

---

<div class="post-metadata">

**Author:** ![Partikel](https://realtimevfx.com/user_avatar/realtimevfx.com/partikel/32/1283_2.png) [@Partikel](https://realtimevfx.com/u/Partikel)\
**Post date:** [October 17, 2016, 4:46pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/4 "2016-10-17T16:46:25Z")

</div>

Got your back bro

> **[Surface Tension: Liquid Effects in The Last of Us](https://www.gdcvault.com/play/1020476/Surface-Tension-Liquid-Effects-in)**
>
> In The Last of Us you spill a lot of blood during melee combat and gun fighting. It was important that the effects had a realistically rendered appearance even if the amount and use of blood was stylized. The blood and water in the game needed to...

However, I don’t think that’s the one they are after. I recognize what they are talking about and Eben doesn’t bring it up.  
If I’m thinking of the same thing, it’s this sort of thing, but done by vertexshader: [https://www.youtube.com/watch?v=7MPojMf\_WSQ](https://www.youtube.com/watch?v=7MPojMf_WSQ)

Actually, @simonschreibt has made a post about it here [Left 4 Dead 2 – Puke | Simon schreibt.](https://simonschreibt.de/gat/left-4-dead-2-puke/)  
though, I don’t think that’s where I remember it from…

---

<div class="post-metadata">

**Author:** ![Keith](https://realtimevfx.com/user_avatar/realtimevfx.com/keith/32/15_2.png) [@Keith](https://realtimevfx.com/u/Keith)\
**Post date:** [October 17, 2016, 7:33pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/5 "2016-10-17T19:33:37Z")

</div>

> [@Partikel](#):
>
> However, I don’t think that’s the one they are after. I recognize what they are talking about and Eben doesn’t bring it up.

Hmm… you’re right - he didn’t cover it in this talk, but I know he did somewhere. All well - those resources you shared are great too!

---

<div class="post-metadata">

**Author:** ![Gaxx](https://realtimevfx.com/user_avatar/realtimevfx.com/gaxx/32/501_2.png) [@Gaxx](https://realtimevfx.com/u/Gaxx)\
**Post date:** [October 17, 2016, 7:46pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/6 "2016-10-17T19:46:42Z")

</div>

That was what I was looking for! Thank you! 🙂

---

<div class="post-metadata">

**Author:** ![Frogspasm](https://realtimevfx.com/user_avatar/realtimevfx.com/frogspasm/32/2895_2.png) [@Frogspasm](https://realtimevfx.com/u/Frogspasm)\
**Post date:** [October 17, 2016, 8:15pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/7 "2016-10-17T20:15:25Z")

</div>

Neilan Naicker talks about what they did in UC4:

What is this fast fake fluids trick that you did, for simulating animated drinks?

NEILAN:  
There are two different techniques I came up with, one’s a realtime method for the crowds in the auction that the player can bump his way through, but we also needed some sloshing and pouring liquids for a few closer shots of whisky and wine glasses in cutscenes.  
I decided we’d do them as prebaked animations, so for a few, I got a little bit crazy and did some DOP fluid simulations, but there was no way I was going to have enough time to do that for all of them. I hacked something together that worked out pretty well, it’s just a constrained Bullet rigid body on a pendulum which drives a water surface, with SOP noise for sloshing based on the velocity of the pendulum.  
It let me get away with a lot of keyframing, like easily raising/lowering liquid levels or motion at specific timings, without having to deal with all the eccentricities of fluid simulation. So that made it extremely fast to turn around in Houdini, then every “simulation” is shrinkwrapped with a fixed point count surface so we can get it into Maya as a joint animation.

(unfortunately the videos in that article are broken)  
[https://www.sidefx.com/stories/fx-adventures-in-uncharted-4-a-thiefs-end/](https://www.sidefx.com/stories/fx-adventures-in-uncharted-4-a-thiefs-end/)

---

<div class="post-metadata">

**Author:** ![Partikel](https://realtimevfx.com/user_avatar/realtimevfx.com/partikel/32/1283_2.png) [@Partikel](https://realtimevfx.com/u/Partikel)\
**Post date:** [October 17, 2016, 8:22pm UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/8 "2016-10-17T20:22:59Z")

</div>

The videos work. They just have a broken security cert. If you don’t feel like taking the risk, I saved them here for ya: [Videos for FX Adventures in UC4](https://drive.google.com/drive/folders/0B3t1VDbLkxufZlVrSjhkbmlVM3M?usp=sharing)

The technique is essentially the same. The difference is UC4 did it offline in houdini and maya while the L4D one is realtime. I love the idea.

---

<div class="post-metadata">

**Author:** ![simonschreibt](https://realtimevfx.com/user_avatar/realtimevfx.com/simonschreibt/32/737_2.png) [@simonschreibt](https://realtimevfx.com/u/simonschreibt)\
**Post date:** [October 18, 2016, 6:05am UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/9 "2016-10-18T06:05:42Z")

</div>

And don’t forget the Update at the bottom of the article where Tyler showed a nice UE solution: [Left 4 Dead 2 – Puke | Simon schreibt.](https://simonschreibt.de/gat/left-4-dead-2-puke/#update1)

---

<div class="post-metadata">

**Author:** ![alex.underhill](https://realtimevfx.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@alex.underhill](https://realtimevfx.com/u/alex.underhill)\
**Post date:** [October 18, 2016, 10:39am UTC](https://realtimevfx.com/t/have-anyone-seen-any-fake-interactive-water-surface/974/10 "2016-10-18T10:39:29Z")

</div>

I did a bunch of these for Arkham Knight & helped out on the Arkham VR one with Dongsub Woo (I dont think he’s on this forum?) I think even the coffee pot in the intro to AK is a fake, pixel shader surface. I also did a virtual plane inside the shader using the same plane-height like the link, to add an internal.

If I were to ever do these again - I’d shift away from pixel shaders & do a vertex based one.  
The example there is good until it’s in production & people start to want to see the fluid surface itself, rather than a masked fluid line. It’s another effect that starts to bring in a lot of edge-cases to be fixed. As above, you can do that in a pixel shader but at some point it becomes more desirable to just throw a mesh in there.

A mesh plug is nice as it should just work. The most detailed part isn’t setting a fluid plane, but instead, needing to constrain the fluid volume to the shape/size of the container. As we’ve seen, if you just move a top-cap, you end up getting a slight mismatch in container/fluid relation ships.

With that in mind, here’s the majority of a vertex shader for constraining verts to a Z-Plane - just choose which verts you would use by masking them, eg the top of a cylinder. The wave direction could be done by sending in wobble directions & weighting them in world space, should be pretty simple.

 ![](https://realtimevfx.com/uploads/default/original/1X/c17d6b641ec21491d6ab63a4bf0a9975d9d04e39.PNG)

The second half of this shader would be to constrain all those verts to a cylinder - which is pretty much the same system here. Find a target position, and travel towards that.
