PDA

View Full Version : Bezier interpolation



KILE
05-13-2002, 06:16 AM
Hi all.
I'm developing an 3D Studio MAX export to get the animation keys for use in my 3D Engine. The problem is that I don't know how to use the Bezier Position Keys. This keys are defined by: InitialPosition(Vector3D) FinalPosition(Vector3D) InTangent(Vector3D) OutTan(Vector3D). Now I only make a simple linear interpolation between the Initial and final position. How I can use the InTan and OutTan parameters?. I read some examples about bezier interpolation but this use 2 points (Initial, End) and other 2 control point. How I can convert this tangents to controls points?.
Thank to all.

nutball
05-13-2002, 07:50 AM
Control point 1 = InitialPosition + InTangent * Scale
Control point 2 = EndPosition + EndTangent * Scale

...where Scale determines how strongly the tangent influences the curve. Depending on how they are defined you might need to replace one or both '+' with '-'.
http://astronomy.swin.edu.au/~pbourke/curves/bezier/

KILE
05-13-2002, 09:15 AM
Thanks I will go to try this one. But about the Scale factor, do you know how I can export this one from 3D Studio MAX? http://www.opengl.org/discussion_boards/ubb/smile.gif

thank you

nutball
05-14-2002, 05:03 AM
Originally posted by KILE:
Thanks I will go to try this one. But about the Scale factor, do you know how I can export this one from 3D Studio MAX? http://www.opengl.org/discussion_boards/ubb/smile.gif

thank you

'Fraid not. Basically it just affects the "strength" of the tangent as the ends of the curve. The URL I supplied talks about this I think.

Devulon
05-14-2002, 09:59 AM
Don't quote me on this. In all my experience with max exports I have never gotten around to exporting bezier tracks but this is my guess about the scale. Max doesn't store a scale but i believe it will let the tangents (or more specifically the lines that represent the tangents) be of arbitrary length. All I mean is that the scale is the length of the tangent. Whether its a vector or 2 endpoints of a line it makes no difference. I don't know this for sure but this is my guess.

Devulon

Sundy
05-14-2002, 12:33 PM
Now getting the scale is really tricky from max, You cant just use the tangents and interpolate as the tangents are too small and u'll probably landup interpolating almost linearly with those tangent values. Somehere in the max documentation i saw that the scale is (DeltaT/3) where DeltaT is the time differebce between two Keys, but this does not work correctly. I have used 3*DeltaT but this closely approximates, but does not accurately give you Max's interpolation. Please do let me know if things work for you or you could get the scale factor.

-Sundar

KILE
05-18-2002, 08:38 AM
Sundy can you post your code. You said that this run but not as well as MAX. I want to see what you do http://www.opengl.org/discussion_boards/ubb/smile.gif