Results 1 to 4 of 4

Thread: Connecting rotations

  1. #1
    Member Contributor
    Join Date
    Feb 2001
    Location
    Hungary
    Posts
    60

    Connecting rotations

    I have a human model with an animation. If that animation is over, the prog starts another one. The only problem is, that the first anim and the next are not 'connected' to each other. I mean, there is like a rupture, a sudden jump from one anim to the other.
    I decided to create a tween animation (I think it is called like that) which connects the two. I just define how many steps (frames) this tween anim will last and then the app should calculate the rotations between the last frame's and the first frame's rotations.

    Can someone tell me, how I can 'connect' them? Do I have to use quaternions, or does OpenGL have something for this?

    I mean, surely not by dividing the angle, x,y,and z axis to 10 parts (for a 10 frame tween) and add these portions together frame by frame...

    Thanks

  2. #2
    Senior Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: Connecting rotations

    Hey Fortikur, is this a skeletal or key-frame animation?

    For tweening key-frames, like Quake2 models, usually a simple lerp (Linear intERPolation) is performed.

    For skeletal stuff, like Doom3 models, quaternions can be use to slerp (Spherical Linear intERPolation) between poses. And then a skin is fitted over the resulting pose.

    For stuff in between, like Quake3 models, a hybrid approch can be used. It all really depends on what you're doing.

  3. #3
    Member Contributor
    Join Date
    Feb 2001
    Location
    Hungary
    Posts
    60

    Re: Connecting rotations

    It's a key frame animation. No bones are used. I will see what I can find about linear interpolation math on the web. I hope this will work (I'm almost sure).
    Thank you for the answer - and the term I have to look for.

  4. #4
    Senior Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: Connecting rotations

    Yeah, for playing key-frame animations, where you're playing a series of composed vertex frames, you can lerp between the frames of the animation.

    Let's say you have some vertex from frame 1, V1, and its corresponding vertex in frame 2, V2. To find the tweened vertex, lerp between the 2 vertices based on the animation time between them:

    V = V1 + (V2 - V1) * t,

    or equivalently,

    V = V1 * (1-t) + V2 * t,

    where t is in [0,1]. You could also think of t as the fractional part of the frame number, and let the floating-point frame number increase based on time.

    You can interpolate other vertex attributes this way as well, including normals (you may need to normalize afterwards). OpenGL can do this normalization for you if you glEnable( GL_NORMALIZE ) (in case you didn't know).

    Then you can issue your GL calls with an intepolated set of vertices, possibly using vertex buffers, for example.

    The tricky part is dealing with a change of sequence in the midst of a currently playing animation. It's perhaps easier to let the current sequence reach a whole frame number, then begin a lerp to the new sequence. Otherwise, a bilinear interpolation could be used to take the current linear interpolation to the beginning of the next sequence.

    Anyway, I hope this helps.

Similar Threads

  1. Drawing Arcs Connecting Two Points on a Sphere
    By Gonff in forum OpenGL: General
    Replies: 1
    Last Post: 08-20-2006, 05:03 AM
  2. Connecting to A game
    By MudPuppy in forum OpenGL: User Software
    Replies: 0
    Last Post: 11-28-2003, 07:52 PM
  3. Circles & connecting them!
    By novation in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 09-04-2003, 02:44 AM
  4. Problems Connecting to servers in OpenGl.
    By in forum OpenGL: User Software
    Replies: 0
    Last Post: 06-08-2003, 09:44 AM
  5. Connecting graphics w/ coding
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-25-2002, 09:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean