Have anyone seen any fake interactive water surface?

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!

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

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:

Got your back bro

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

Actually, @simonschreibt has made a post about it here Left 4 Dead 2 – Puke | Simon schreibt.
though, I don’t think that’s where I remember it from…


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!

That was what I was looking for! Thank you! :slight_smile:

Neilan Naicker talks about what they did in UC4:

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

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)

1 Like

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

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.


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.


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.

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.