Archived

This topic is now archived and is closed to further replies.

Memir

KEYFRAMING [Interpolation, Rotation-Angles]

Recommended Posts

Memir    129
Okay, The 3D part of my lib. is getting really powerful now. I''ve built a Converter, which converts .ASE - > .M3D (Memir 3D)... My problemo dewds is: The keyframe data in 3ds MAX is pretty powerful/complex. It has like Bezier (sp?) interpolation etc. I only know how to do the standard interpolation, you know Linear interp. Can anyone tell me where I can find information on Keyframing (Key-Frame interpolation side of it). Also, I can succesfully interpolate (linearly) the Position/Translation & Scale of the objects. But Rotation is kinda fux0red-up. For example: (The rotation is stored in x,y,z, Theta - where x/y/z are -1 to 1, and Theta is just an angle) FRAME 0: (1,0,0 - 0 rads) FRAME 10: (0,0,1 - 3.14 rads) So how lets say, what is the (x,y,z - Theta) for Frame (n) where n is a value between 0 & 10. I hope this is clear enough. I''m sure if someone has done this Keyframing lark, then they would know what I''m on about. Thanks! /Memir

Share this post


Link to post
Share on other sites
Ionut Costica    122
Well, if i understood correctly, you need something like this:
    F0: (1,0,0 - 0)
F1: (0.9,0,0.1 - 0.314)
F2: (0.8,0,0.2 - 0.628)
F3: (0.7,0,0.3 - 0.942)
.
.
.
F9: (0.1,0,0.9 - 2.826)
F10: (0,0,1 - 3.14)
.
.
.
auxrotx=(f[10].x-f[0].x)/10; // 10=(framenumber-1)
auxroty=(f[10].y-f[0].y)/10;
auxrotz=(f[10].z-f[0].z)/10;
auxangle=(f[10].angle-f[0].angle)/10;
for(i=1;i<10;i++)
// 1=(firstframenumber+1)
// 10=(lastframenumber)
{
f[ i ].x=f[0].x+auxrotx*i;
f[ i ].y=f[0].y+auxroty*i;
f[ i ].z=f[0].z+auxrotz*i;
f[ i ].angle=f[0].angle+auxangle*i;
}
And that's about it...


"Everything is relative." -- Even in the world of computers.

Edited by - Ionut Costica on July 21, 2000 5:41:04 PM

Share this post


Link to post
Share on other sites
Memir    129
Thats what I first thought, But I was thinking:

The Angle "1,0,0 - 0" is the same as the Angle "0,1,0 - 0" and the same as "0,0,1 - 0" when we''re talking about rotation operation. i.e they all do nothing to the Rotation, they rotate the object by 0 Radians about the (1,0,0) Vector, or (0,1,0) Vector, or (0,0,1) Vector. Rotation of 0 Radians means do Jack-Shit.

Hence if I interpolate from (1,0,0 - 0) to (0,0,1 - 3.14), it *SHOULD* be the same as interpolating from (0,0,1 - 0) to (0,0,1 - 3.14)

I haven''t really tried the straightforward linear interpolation. This rotation around Axis stuff can get a little complex, so who knows I could have the Wrong concept of whats going on, in which case I''ll try a linear interpolation (But I have the feeling my Computer Will Go BOOOOOOM). But thats life - A total fux0ring mystery!!!

/Memir

Share this post


Link to post
Share on other sites
Ionut Costica    122
I thought that 3dsmax did this exact thing. because the computer doesn't KNOW that (1,0,0-0)==(0,1,0-0)==(0,0,1)...
Maybe the easyest way would be if you put an if-statement and say:
    
check to see if u have 1, 2 or 3 rotations here that
will be transformed as we pass through the frames, and
only consider those that are BOTH in f[0] AND in f[10];
the rest put on 0.
example:
if(f[0].angle==0)
{
if(!(f[0].x&&f[10].x)) f[0].x=0;
if(!(f[0].y&&f[10].y)) f[0].y=0;
if(!(f[0].z&&f[10].z)) f[0].z=0;
}
if(f[10].angle=0)
{
if(!(f[0].x&&f[10].x)) f[10].x=0;
if(!(f[0].y&&f[10].y)) f[10].y=0;
if(!(f[0].z&&f[10].z)) f[10].z=0;
}

Now do the same stuff&calculations as i said in my previous post...

"Everything is relative." -- Even in the world of computers.

Edited by - Ionut Costica on July 21, 2000 7:45:35 PM

Share this post


Link to post
Share on other sites