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 8 of 8

Thread: Animation

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    las vegas, NV, USA
    Posts
    5

    Animation

    I've written a class to load a 3D MAX file and display it. Most everything works so far, material properties, normals, etc. Now the big step...ANIMATION!!! I've written a function that uses the keyframe information stored by 3D MAX to display animated files. I'm having a lot of trouble and I wonder if anyone knows where I can find information on this topic.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    237

    Re: Animation

    Iīm interested in this too!

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    las vegas, NV, USA
    Posts
    5

    Re: Animation

    I'm amazed at how hard a time I'm having finding information on simple Keyframe animation. It seems like you can't find information that's useful until it's out dated when it comes to game programing. Anyway, if you're interested in what I have so far, I'd be glad to email you the file reader/converter, and the display program. They are actually 2 seperate programs.

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    San Francisco, CA, USA
    Posts
    22

    Re: Animation

    Originally posted by rolfewiz:
    I'm amazed at how hard a time I'm having finding information on simple Keyframe animation. It seems like you can't find information that's useful until it's out dated when it comes to game programing. Anyway, if you're interested in what I have so far, I'd be glad to email you the file reader/converter, and the display program. They are actually 2 seperate programs.

  5. #5
    Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Portugal
    Posts
    267

    Re: Animation

    I'm interested too rolfewiz
    If you can mail me , i would be very gratfeful..
    my email is brunomtc@hotmail.com
    thanks
    bruno

  6. #6
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    237

    Re: Animation

    Sorry Rolfewiz,I was absent from this forum for some time so I didnīt realize your offer.
    Thanx a lot anyway,but I donīt really need
    your code īcause I already have a good source for this kind of thing(found a link on Opengl.Org someday but I cannot remember the location,so if youīre interested Iīll try to find the link again),the only problem is the Keyframing Part!

    [This message has been edited by XBCT (edited 05-07-2000).]

  7. #7
    Junior Member Newbie
    Join Date
    Jul 2000
    Location
    Den Haag - The Netherlands
    Posts
    1

    Re: Animation

    I'm writing a camera-animation tool in which I think to solve the key-frame parts. But I'm not that far this moment (but hopefully very soon). My main problem is displaying 2d curves in opengl (and extract interpolated value form them - this is how I try to solve it). I did a lot of animations - so finding a nice key-framing method should not be the main problem. If you - or anybody else - just get me into displaying 2d curves in ogl - I share the rest with you as soon as I progress.


    [This message has been edited by Iebele Abel (edited 07-04-2000).]

  8. #8
    Guest

    Re: Animation

    Keyframe animation isn't that hard.

    For each frame, you have to determine if you are exactly at a keyframe, in which case you draw that particular frame. Else you have to "tween" the frames.

    I'm assuming you store all the vertexes as an array with indexes from 0 to N-1. I'm also assuming that your animation has M frames (from 0 to M-1). Thus, you can tween like so:

    Code :
    // This is just pseudo-code, it won't compile as-is
     
    class shape
    {
     vector<vector<vertex> > m_verticies;
    };
     
    shape::draw()
    {
     float tween = time_since_start*speed/1000.0;
     int base = floor(tween);
     if (base == M-1) goto animation_done;
     if (base == tween)
     {
      draw(m_verticies[base]);
     }
     else
     {
      draw_tweened(base, base+1, tween-base);
     }
    }
    It is very important that the "same" vertex has the same index for each keyframe!!! (I e, if the tip of the nose has vertex index 34 for the first frame, it has to have index 34 for all frames!)

    draw_tween() is implemented like so:

    Code :
    shape::draw_tween(int first, int second, float delta)
    {
     // optimize your storage the way you see fit
     vector<vertex> v;
     for (int ix=0; ix<N; ix++)
     {
      v.push_back(m_verticies[first]*(1.0-delta)+m_verticies[second]*delta);
     }
     draw(v);
    }
    I'll leave the imlementation of class vertex and draw() to your imagination. (They should be fairly obvious.)


    [This message has been edited by bgl (edited 07-03-2000).]

    [This message has been edited by bgl (edited 07-03-2000).]

Posting Permissions

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