Project advice - Water surface animation

Hi guys,

For a university project, I’ve decided to build a water rendering system, to achieve this I’ve decided to use C++ in conjunction with OpenGL and GLUT. Unfortunately, I’m lacking advice when it comes to the implementation so I was hoping to gather some ideas here.

I’m currently working on displaying an animation of the water surface. I’ve been given a group of .obj files where each file represents a frame of animation. So far, I’ve loaded each of these files into my program with the help of the Open Asset Import Library, however I’m not sure how to proceed from here.

I haven’t used OpenGL in some time, so I’m a little rusty but what I was thinking of doing was to create a display list for each frame in the animation and add it to a vector or some other collection. Then I could iterate through this to animate.

Does anyone have any thoughts or advice about this? Am I roughly on the right track?

Many thanks in advance :slight_smile:

No replies :frowning:

Have I put my question in the wrong subforum maybe? Would anyone suggest somewhere where someone may be able to help me?

Depends on what u want. You can start with basic vertex shaders (displacement mapping using vertex texture fetch (http://developer.nvidia.com/object/using_vertex_textures.html) to realistic ocean simulation (have a look at Jerry Tessendorf’s work http://tessendorf.org/)
This also lists some interesting stuff http://www.vterrain.org/Water/
There is tons of material on this. Google it.

Simple way would be to use a sinusoidal function, moving regarding {x,y,z} and t, and to apply them to a mesh of polygons.
Then, update your mesh for each frame, with the function, updating it with the time.

What you’ve done could work too. You should know the framerate of your animation, then render each version of the animation until the time between 2 animation is inferior to 1/framerate.
This, however, will consumes more memory, but could be simpler.
I would also suggest you to store any animation step into a display list.

If that’s not good enough, please give more details.

Hi arts thanks alot for the feedback, this sounds exactly like the kind of advice I’m after :slight_smile:

Could you clarify the method you suggested? My understanding is to create a function which maps the time t to a given x,y,z for each vertex on the mesh?

I was concerned about the amount of memory my method would use, so I’m keen to find a way to avoid using so much if possible. One additional detail however is that I intend to map textures onto the surfaces meshes. The textures in question are the frames of a video where each frame from the video has a one-to-one mapping with each of the surface meshes I mentioned in the previous post.

Any advice regarding this would be welcome, thanks again for the replies :slight_smile:

Well, the most easy function would be something like this:


s(t) = ( x , y , µ.sin (y+t) )

with µ whatever the value you’d like to be, to increase or reduce the wave strenght. While increasing t, you’ll make the z value change for a fixed {x,y} couple, and thus make an impression of wave movement.

For about your methode, it all depends on the amount of vertices, of steps in your animation.