We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › ripples
Page Index Toggle Pages: 1
ripples (Read 4517 times)
ripples
Apr 28th, 2005, 8:33pm
 
I have been playing around with ripple code for a few months.  Decided to post my most recent version in hopes that you folk could improve it some more.

-video of the code in action-
http://www.flight404.com/processingBeta/_videos/ripples.mov

-source project folder-
http://www.flight404.com/processingBeta/ripples.zip
Re: ripples
Reply #1 - Apr 28th, 2005, 8:40pm
 
wow!!
it looks really nice!!!!
thanks for the code, I'm going to have a look at it right now
Re: ripples
Reply #2 - Apr 29th, 2005, 2:23am
 
Hey Robert,

Your sketches are awesome, but a lot of the time I don't have Processing on the computer (e.g., at a school lab) when I watch the cool movies. Is there any chance you could upload the applets outside of a Zip compressed archive?

As for ripples - it's more like waves, really. It's amazingly fluid (I suppose that was the point!) and smooth. Were you controlling it at all when it recorded, or is it autonomous?
Re: ripples
Reply #3 - Apr 29th, 2005, 2:34am
 
Hmm, not sure what you mean.  If you are asking if I could put the applets up to be viewed in a browser, I cannot (i think) because they use openGL for the rendering.  If this isn't what you mean, then talk me through it.  Wink

And yes, these were user controlled.  Mouse click and drag creates a ripple point.  And yeah, these are rather wave-like, but for the actual program, the waveheight multiplier is toned down a bit so they seem more like ripples than rogue waves.
Re: ripples
Reply #4 - May 3rd, 2005, 1:40am
 
Whoa I've just set down with P5 and I am halfway into making this ripple thing, and then I saw you've done it already! I'm gonna have A look at yr code if you don't mind because it looks a lot better than mine right now. Wink
Re: ripples
Reply #5 - May 5th, 2005, 11:46pm
 
Looks great, flight.  

I was really in to waves for awhile, and wrote a bunch of simulations based on a similar type of algorithm to what you're using.  Sorry if I've posted these already in the past!

The full "educational" applet:
http://web.mit.edu/mdanzig/www/waves2d.htm

Some variations:
http://web.mit.edu/mdanzig/www/rings.htm ,
http://web.mit.edu/mdanzig/www/field.htm

A Shockwave3D version (warning, this one can be kind of flakey, and will definitely hose browsers on a Mac, for reasons I've never quite figured out):
http://web.mit.edu/mdanzig/www/sw_waves.htm

I can probably dig up the source code if you're interested, but I think I did these in 0068 or something, so it won't be up to date.  I also had a 3d version of the Processing ones, but I think the source was lost when my laptop was stolen awhile back (bastards!).  

In any case, yours looks much better.  I really like the lighting effects you've added!  Have you tried taking 8 samples at each point, rather than 4?  I found that smoothed mine out quite a bit.  Also, what I found really great about this algorithm is that reflections/diffraction/interference falls right out of it when you start adding "walls" (see the first one I posted for an example).  Basically you just fix the positions of elements that are flagged as walls, and the waves will bounce right off them... good times.

Anyways, great work!

-mike
 
ps.  just started visiting this site again after an extended absence, and I'm really impressed with the new versions of Processing.  The OpenGL stuff is great, and everything seems much faster in general.  Good work, everyone!
Re: ripples
Reply #6 - May 7th, 2005, 6:50am
 
funny... i never realized how easy it would be to do walls.  you were quite right.  now to fine tune.

So, hypothetically speaking, how does one go about doing refraction of a 'submerged' texture?

Smiley

r
Re: ripples
Reply #7 - May 13th, 2005, 9:07pm
 
Well, the way I did the refraction stuff is a total hack, and not based on any real physics.  Basically, I have the "wave field" superimposed over the background image, and use it like a shader or something to modify the pixels that get drawn underneath it.  For the refraction effect, at each pixel I look at the magnitude of the wave field at that point, and calculate a new pixel from the original image to draw, based on a pre-set bias direction.  

So for example, if I'm trying to decide what pixel to draw under the field at (i,j), I look at the magnitude of the field at that point and calculate a pixel offset in the background image.  I think for the ones I linked up there it's just something like (i+offsetx, j+offsety) where offsetx and offsety are just integers proportional to the magnitude of the wave at (i,j).

This gives a kind of fake refraction effect, since the pixels that get drawn in an area with a big wave are from pixels in the backround image that are far to the upper left or lower right of the pixels in question.  Heh, sorry if that was a bad explanation.

-mike
Page Index Toggle Pages: 1