Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Project advice - Water surface animation

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2011
    Posts
    3

    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

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2011
    Posts
    3

    Re: Project advice - Water surface animation

    No replies

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

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: Project advice - Water surface animation

    Depends on what u want. You can start with basic vertex shaders (displacement mapping using vertex texture fetch (http://developer.nvidia.com/object/u..._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.
    Regards,
    Mobeen

  4. #4
    Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    458

    Re: Project advice - Water surface animation

    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.

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2011
    Posts
    3

    Re: Project advice - Water surface animation

    Hi _arts_ thanks alot for the feedback, this sounds exactly like the kind of advice I'm after

    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

  6. #6
    Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    458

    Re: Project advice - Water surface animation

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

    Code :
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •