Archived

This topic is now archived and is closed to further replies.

ByteMe95

rendering a ripple

Recommended Posts

I''m trying to render a RIPPLE, like the ripple you get when a drop of water hits a still pond, but i want it to be repetitive and loop around. I''ve tried for the life of me and I cant get it to work at all. I was basing the idea on the flag effect (Lesson 11, nehe.gamedev.net), but it was much harder than i thought. Any ideas howt o do this? I pretty much want the flag effect, but it should be a circular area, not rectangular. The more detailed the responses are the better off I''ll be Thanks ByteMe95::~ByteMe95() My S(h)ite

Share this post


Link to post
Share on other sites
You should take a look at the article in the special effects programming section called "The Water Effect Explained."

It does a good job of explaining how you can simulate a water wave effect using area sampling .. It shows you how to make the effect in 2D, but it shouldnt be that hard to port to 3d. good luck!

Share this post


Link to post
Share on other sites
just checked outt hose articles, they''re WAY too outdated. They go perpixel, I would hav eto lock the backbuffer for that.
I want a polygon rendering of this if possible.

ByteMe95::~ByteMe95()
My S(h)ite

Share this post


Link to post
Share on other sites
The article maybe old, but the theory can still be applied in 3D. Instead of per pixel you can use per vertex. Your water plane is like a height map. Perform the calculations on the NxM array "height map" and then render the height map.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
as digicube says you can model this as a heightmap.. The wraparound effect you are referring to I think is bouncing? You can easily get this by storing zeroes at the border of the heightmap. This effect also occurs in nonterminated cables (bouncing of signal) and looks cool.

To get used to heightmaps I recommend first maybe coding fire. It''s similar, but easier (no doublebuf, easier matrixoperation).

pieter (earx)

Share this post


Link to post
Share on other sites

I coded a simple ripple effect with a 50*50 grid. When you let down a drop of water somewhere, you can simply calculate what effect this has at a point somewhere in the grid.

If you know the distance and time from the original place of the drop in the grid, you use the sinus function to calculate how some points should be affected. Of course you need to keep in mind that the height of a wave decreases over time.

The great thing with this approach is that if you have multiple waves, you can just add the height changes of the different waves at one point in the grid.

So just simple sinus/cosinus math needed for this to work...

Edo

Share this post


Link to post
Share on other sites