Advertisement

3D Water

Started by May 22, 2000 12:46 AM
20 comments, last by Jallen 24 years, 5 months ago
an alternative approach:

most of you have probably seen the java water drop effects. moving objects are trailed by ripples, drops cause ripples as well, and you can have as many ripples or waves as you want without affecting the speed. here''s how this is done: you have an array of oscillators. the oscillators are defined as two extremes that are flipped every frame, all of them initially set to 0. the extremes of the oscillators are also averaged and dampened every frame. it''s a fairly simple algorithm and there are a few documents about it floating around the net.
now, here''s how it translates to 3d: at the lowest level of LOD, the visible oscillator extreme is set as a texture. at the highest level of LOD, it affects geometry on vertex basis. waves right next to the camera are actual waves, and waves around the horizon are just textures. quadtrees would come in rather handy here. the advantages of this algorithm are that it''s constant time for any amount of waves and allows for anything from wind effects to rain drops to ripples trailing a ship. the disadvantages are that it *may* be an overkill as far as CPU time goes, and floating point errors may cause undesired fluctuation (i.e. ripples that never quite go away).

anyway.. my two cents.

-goltrpoat


--
Float like a butterfly, bite like a crocodile.

--Float like a butterfly, bite like a crocodile.
A while ago whilst looking for OpenGL examples I came across a demo prog where you looked down on a background texture of some leaves. When you clicked the mouse it created a fantastic ripple effect from that point which propagated throughout the image.

Not to put too fine a point on it - this looks f**king amazing.

It''s done by placing the texture on a polygon mesh (uniform z depth) and altering the texture''s u-v coordinates rather than the polygon vertices.

Unfortunately, I don''t have the URL for the code to hand, but I''ll look it up when I get back home, so check back.
If I can''t find it, I can always email you the code/exe.

Laters, Barry


//////////////////////////////
int main()
{
sleep(1/0);
return 0;
}
//////////////////////////////

This topic is closed to new replies.

Advertisement