PDA

View Full Version : Making a ripple

Structural
01-04-2003, 07:02 AM
Not sure if this belongs here, but hey, let's give it a shot.

Basically I need a few ideas of how to make a moving ripple in a surface. A ripple like when you drop something on a smooth water surface.
Texturing is not required, but I can't think of any way to pull this off.

TY

V-man
01-04-2003, 03:43 PM
There are a few options.

1. Using geometry, use this function
f(x, y)=sin(sqrt(x^2+y^2))
PS : Animate x and y

2. Using textures, use the above function to render to texture.

3. Using textures, make a ripple texture and animate the quad on which it will be mapped by stretching the quad and dimishing the alpha.

jwatte
01-04-2003, 07:16 PM
If you want to ripple actual geometry, then you can either solve Navier-Stokes (google for that) or just simulate a mesh of elastically connected quads where nodes (quad corners) can only move up/down.

Try this simple demo (press space to make it "go"):
http://www.mindcontrol.org/~hplus/ripples.html

Structural
01-05-2003, 02:04 AM
I've seen delphi code that uses a quad strip to draw a ripple. Does he basically lift the geometry in some place and connect them with the strip? Doesn't that result in quads whose points are not coplanar?

Jwatte: I've downloaded your demo (after I figured out your link needed an extra "/graphics") and I must say it looks very pretty. I am able to actually see what's going on. I think I can use this http://www.opengl.org/discussion_boards/ubb/smile.gif.

Thanks!

jwatte
01-05-2003, 11:31 AM
You're welcome. I think I flipped the delta-Y term in the normals in one version of the code; new archive is available. Although you're probably better off just reading the code and then implementing it for real on your own anyway :-)