|
|
On Sat, 29 Mar 2003 14:35:45 +0100, "Tim Nikias v2.0" <tim### [at] gmxde> wrote:
>Yikes!
I like it.
>What does your algorithm look like, how
>does it interact with the objects, in order to get
>that kind of effect? I don't understand why the
>surface would suddenly rise to meet the
>top rim of the containter, and then drop down in a
>circular fashion as seen on the animation
>(which you might have made smaller, the effect is clearly
>visible on smaller scale as well).
Sorry will do, in future :-(
>Do you use that "magic algorithm", whic you can
>find all over the net (and at Hugo Elias' page)?
>
Well the algorithm is, I assume, the "magic algorithm". I know it as the water
effect.
Actually it's a variation of it using three arrays
buffer(2, W, H) = ((buffer(1, W + 1, H) + buffer(1, W - 1, H) + buffer(1, W, H +
1) + buffer(1, W, H - 1)) / 2) - buffer(0, W, H)
// Swap the buffers
buffer(0, x%, y%) = buffer(1, x%, y%)
buffer(1, x%, y%) = buffer(2, x%, y%) - (buffer(2, x%, y%) * damp)
buffer(2, x%, y%) = -1 'This line is what caused the
surface to suddenly rise to meet the
top rim of the container
I'm sure you get the drift.
For a circular edge, I ignored all elements that lay outside the circle in the
wave calculations. I must say that I'm no programmer (this is probably obvious),
and struggle with it. But it looked impressive I thought. I hope some others
will post interesting mistakes.
Regards
Stephen
Post a reply to this message
|
|