So first of all, I’ve fixed a little bug in the water flow shader which basically inverted one of the texture coordinates and made all of the flow animations look weird or just wrong. This is how the flow map from my last tutorial looks in action now:
And it’s WAY more impressive when animated!
Next, I thought that the way of creating flowmaps I’d described before is a little bit too complicated and so I created a little flow editor in Qt to make preparation of flowmaps more straightforward. You can sketch the flow as you see fit and the rest will be interpolated using Natural Neighbor algorithm. Due to the nature of NN the more flow points you add, the faster it works (recomputation of Voronoi diagram is faster, read NN description if you want to understand). The example flow field takes just a couple of seconds on one 3GHz core.
And this is what it looks like in Unity with little debug info added:
and without debug:
It’s WAY WAY more impressive with animation, you can actually see the water interacting with obstacles. I tried going back to Simple Daylight Water from Unity and it looks like a child’s play now when my water is INTERACTING with the environment. Pretty cool. Thanks Valve (guys from Valve came up with this idea at SIGGRAPH 2010), GraphicsRunner (guy who wrote all about it and prepared a demo in C#) and Alzahiel (guy who prepared the initial port to Unity). I’ve modified Alzahiel’s shader a little bit and now I’m contributing the flow editor. Enjoy! 🙂
DOWNLOAD: Flow Editor
PS. You can also try the updated monkey game
DOWNLOAD: Monkey Dodge – Unity Game