PDA

View Full Version : Motion path spline calculation



MiniFireDragon
10-06-2008, 12:15 PM
I am pretty sure this is somewhere on the web, but I wanted to start here. I am looking for how lightwave computes it's spline curve through key frames.

You know, F(x) = blah blah blah. Or something of that nature.

I am working on developing a plug in that lets you assign a speed to the key frame. I have not found any other person who has one that is still available (all the bread crumbs led to no where).

As of right now, I have a web app that will take the motion path and your assigned speeds and replot the motion path. Unfortunately it is a linear computation so all the pretty curves are destroyed.

I am building this because I have never found an easy way of setting speeds in lightwave. Sure you can open up the graph editor and click on show speed curve, but it's a pain adjusting. Then there are those that would say just adjust the bias and the constant and blah blah... You are only left with approximate.

zardoz
10-09-2008, 03:30 AM
well I found a few plugins that helped me in this but it's not like in 3ds max...I work in a company with around 20 people and I'm the only one using lightwave. So, I see them animating a camera flyby and it's as simple as creating the path (they have a gizmo for that) and then they just apply the camera (or object, or light, etc) to this path and edit a graph for the speed, and that's it.

So I tried to do the same in lightwave and couldn't. As you know, if you edit the curves in LW you change the path...and that's just a pain. So I searched for plugins and I found one that helped me but it's not the same thing as drawing some path and controlling the speed of the object.

It would be great to be able to have some object travel in some path and be able to change the speed without changing the path.

This is the link for the plugin
http://thespread.riot-inc.com/_theoldspread/PathAnimationIA.zip
http://thespread.riot-inc.com/_theoldspread/

I leave here the links to some of the threads I opened about this:
http://www.newtek.com/forums/showthread.php?t=88275
http://www.newtek.com/forums/showthread.php?t=88386
http://www.newtek.com/forums/showthread.php?t=85875

MiniFireDragon
10-09-2008, 08:45 AM
That is what my app does. it adjusts the time of the object, nott the x,y,z. I built a plugin a few years ago that let me actually say I want this object to go X MPH. Now I am building a new one that will analyze the keys and let you tell lightwave what speed you want each key to be.

My only issue is that the computation is linear based. So it draws straight lines between key x,y,z and plots the frames. So you lose any curve in the line you may have put there.

I was hoping someone from Newtek could actually post what computation they use to make there spline curve through the keyframes.

Then again, it could be a standard computation and I have to dig it up somewhere.

MiniFireDragon
11-06-2008, 09:41 AM
So, no one either from Newtek or Programmers deal with spline calculation?

kattkieru
11-12-2008, 07:49 PM
I don't know about Lightwave's internals, but I think most folks do spline calculations using Bezier formulas. You can find examples for them, and example code, all over the web.

If you're currently using the keys as linear interpolation points, you can do what I did a while back in Unity and generate bezier handles from the linear points. Bezier calculations require four points, so the handle tips actually become the second and third points to help the interpolation between the main keys. You can create handles by using points at between 0.25 and 0.33 / 1.0 of the distance between two keys, moved out along vectors tangent to the keys.

Pictures make more sense:

http://img.skitch.com/20081113-r6x1h8xke5aw31f136qemapd2q.jpg

Hope that helps somewhat.

MiniFireDragon
11-13-2008, 10:28 AM
Yes, I understand what you have here. But not knowing what calculations Lightwave uses internally for motion pathing could result in a path different then the one the animator has intended.

My goal here is to exactly duplicate the motion curve produced by lightwave, and then plant key frames.

Come to think about it, I saw a video tutorial done by I think Proton where he created keyframes for a curve. Maybe that will work for now. I need to go back and see what it was he was doing now.

Ty Catt
01-06-2009, 02:11 PM
Mini,

Hey! Did you ever find a solution to your problem?

I don't know if you remember me, I contacted you about a year ago regarding a similar thread, with the same problem.

We discussed using SMAC for accuracy, but most of those programs don't have the realism that LW offers. (We also use Visual Statement FX3)

But again, I was passed over for a project (by another company with Maya) for a car accident project. When I am given data, I cannot provide accurate recreations missing some crucial parameters such as MPH, distance, etc.

I feel your pain with curves- straight line movement constrained to an axis is doable, but any real situation is not!

Any new discoveries / plug-ins?

Thanks for your help!

Ty

MiniFireDragon
01-07-2009, 11:50 AM
Actually, I have slowly been working on one. As soon as I find the spline answer I can make it better. What I have done is 2 things. I have a web app I built that can take a spread sheet and convert it into a Lightwave Motion file. It allows up to 4 vehicles (x,y,z,t).


I also built a 2nd web app that allows me to import an existing motion path from lightwave and actually set key frame speeds. In the end, the app will add keyframes (right now 30 keys per second) and adjust the times of the existing key frames so the speeds are correct. But this is where the formula for the spline needs to come in. If you are on a curve, it will require more keyframed events to retain some kind of curve, as this app draws straight lines between keys.

Once I have time to sit down and find the formula I can rewrite the web app to optimize key creation as well as create a plugin that will do it.

Ty Catt
01-07-2009, 05:58 PM
Mini,

Thanks for the info.

Sounds like you've got your hands full!

Keep me posted!

Thanks again for your help,

Tyler

Matt
01-07-2009, 06:16 PM
What about the 'Cruise Control' motion modifier? That lets you set a speed for an items movement.

zardoz
01-08-2009, 02:17 AM
yes...but what if you want to change that speed through time without changing the items path?

Ty Catt
01-08-2009, 04:18 PM
Also, Cruise Control only works on straight paths, not curves.

If only car accidents happened in straight lines...:D

Ty

MarkWood
12-29-2009, 09:18 AM
I had an aircraft following the curvature of the Earth and used cruise control to set the speed to 500 mph and it seems to work, even with the aircraft not going perfectly straight. You can see the motion path curve down way in the distance.

MarkWood
12-29-2009, 10:03 AM
Just looked at path with the Cruise Control activated versus Cruise Control off, and the curvature completely goes away once Cruise is activated. Dammit....