[PD] watersurface

Mathieu Bouchard matju at sympatico.ca
Sun Nov 30 00:29:36 CET 2003

On Sat, 29 Nov 2003, marius schebella wrote:

> let´s say i want to render a watersurface with GEM or pdp (opengl) or
> gridflow. and use the mouse to click onto it and produce some waves.
> has someone already produced similar things and can give me some
> hints?

Alexandre Castonguay and I have presented a watersurface touchscreen at
Ottawa Art Gallery in June of this year. That will be shown in Montréal in
April 2004 or so. I did it using GridFlow, of course.

> Are there some general algorithms for that, or do I have to calculate
> lightreflections of tons of small squares and rectangles...


GridFlow does not provide a watersurface object, and instead provides the
building blocks for making one. I find it surprising how ordinary the
involved objects are (!).

You can compute the waterlevels in, say, 76800 buckets, by use of a
discrete wave ("Laplacian") operator (use @convolve) and a rather simple
recurrence equation (involving [@ -] and @store).

Then you can either differentiate it (@convolve) to find slopes and
imitate illumination (which I've done) or use it as a displacement map ([@
+], @for, @store) to simulate refraction, or both.

Here's a screenshot involving only refraction, over a camera stream. The
screenshot includes all information necessary to the recreation of the
effect in GridFlow.


It does it in 120*160 and then scales it, but I can also make it work in
240*320 @ 30 fps here if I tweak the patch a bit (eg: removing the second

I like the one with only reflection too, as it makes the actual wave most
easy to see on a screenshot:


The final version did both refraction and reflection all-in-one.

Mathieu Bouchard                       http://artengine.ca/matju

More information about the Pd-list mailing list