How to pan along a curve at linear speed?

NickHope wrote on 8/22/2013, 3:34 PM
I would like to pan across the map below in a smooth curve from position 1 to position 3 via position 2. The feint rectangles represent full screen on a monitor. I would like the speed of the motion to be uniform from the start to the finish.

According to the VP10 help, and previous posts on the forum, temporal smoothness is controlled by the keyframe type (right click), and spatial smoothness is controlled by the "Keyframe interpolation smoothness" setting (0-100).

Logic told me that I should set up a "linear" keyframe for each of those 3 positions and set the smoothness of the 2nd keyframe to 100.

But that doesn't work right at all. It accelerates up to the 2nd keyframe, slows abruptly, then speeds up again.

With further testing I am finding that the smoothness setting messes with the temporal smoothness (a lot) as well as the spatial smoothness, so uniform-speed motion along a curve seems pretty much impossible to achieve. I've tried this in VP8 and VP10 using both Event Pan/Crop and Track Motion.

Any suggestions?

Comments

TheHappyFriar wrote on 8/22/2013, 4:09 PM
Setting the keyframes to linear is all that needs to be done. You'll get a linear speed between Point 1 and 2, then between 2 and 3. The speeds will be based on the number of frames between the keyframes. IE, you want 5 seconds between each point, you move the keyframes for those points 150 frames apart (assuming 30fps).

If you want the same speed for both, find the distance between the points (|P2-P1| =D1, |P3-P2|=D2), figure out how long you want one of them to take (T = 5 seconds for the shortest part of the segment) and figure out how fast it will go (S = D1/T). That gives you the speed (S).

Now using the same formula, figure out the time the second distance should take (D2): S=D1/T. If my algebra is correct, is should ht T = D2/S. Plug your numbers in and that should give you the new time of the second segment, make your last keyframe that length of time from the first.
larry-peter wrote on 8/22/2013, 4:28 PM
This has given me fits on too many occasions to count. I generally give up and go to After Effects, but SOMETIMES I've been able to get "close enough" to what I wanted by:

Setting 3 keyframes (beginning with my areas of interest - i.e. your 1,2,3) set the middle keyframe type to smooth, and set keyframe interpolation to max on the middle keyframe. This generally never gives me what I'm looking for but by varying the time and/or space coordinates of the middle keyframe (moving the keyframe to a new point in time, as well as sometimes moving the spatial coordinates someplace other than my original region of interest) sometimes I can get the motion path to go where I had intended.

If anyone has a solid solution, I'd love to hear it. I don't think one exists. Setting a bunch of linear keyframes around region 2 may get you close, but it's nuts to have to go that direction. Anything other than linear motion, I go to another app.
johnmeyer wrote on 8/22/2013, 4:33 PM
Well ... in theory what Happy says is correct, but in practice it doesn't do what you want.

Ever since Sonic/Sony took away the curve tracks in the pan/crop box, I don't think it ever worked right.

I did make a little progress towards a solution, however.

First, like Happy says, I put the photo in my photo editing program and used its measuring tools to measure the distance between points 1&2, and then between 2&3. Of the total distance, point two is almost exactly 30% of the way from the beginning to the end (i.e., the total distance, from points one to three, going through point two). In the pan/crop menu I created a ten second event, and placed keyframes at the beginning and the end, and one keyframe at the three second point (30% of the total duration of the event). I zoomed in and placed the center of the pan crop for keyframe 1 over the middle of numeral 1 and then did the same with keyframe 2 over numeral 2 and keyframe 3 over numeral 3. All keyframes defaulted to linear, and all smoothness defaults on my setup to 100%. I then played the animation and it was awful. As soon as it gets to keyframe 2, it almost stops dead and then speeds up again.

I repeated the test on Vegas 7 and 10, and got the same results.

So, as I've long suspected, the keyframe controller in Vegas is absolutely horrible and has very serious problems.

I then changed smoothness for each keyframe from 100% to 0% and re-played the animation. This time the speed was absolutely consistent for the entire path.

So, the problem is the smoothness parameter which was introduced back in Vegas 6 & 7. It is interacting not only with the spatial characteristics but is also strongly affecting the temporal characteristics.

Finally, in an attempt to get something useful, I played around with every combination and permutation of Linear, Smooth, etc. for each of the keyframes. In the end I was able to get a reasonably pleasing result by setting the end keyframes to linear, but the middle keyframe to fast. The only downside is that the motion does slow down as it approaches the final keyframe, but that might be OK for this mapping travel application.

If perfect results are required, I think I can write a script that will generate the needed keyframes at each individual point.

Here is a VEG that shows the results of my work. I renamed the map image, so when you load the VEG into Vegas, you'll have to replace it with whatever the map is called on your computer.

Keyframe VEG

There are two events in the VEG. The first is what I described in my second attempt, where I set smoothness to zero. You will see that the motion is consistent, but the change in direction at point two is like one of those old "wild mouse" rides: very abrupt. The second VEG is my best attempt at getting what Nick wants, as described above.

johnmeyer wrote on 8/22/2013, 5:30 PM
BTW, if you want to introduce another variable, try moving the little black center point both ahead or behind the direction of motion for each keyframe. This point is intended for changing the rotation point when doing rotation in the pan/crop box (i.e., instead of rotating around the center you can instead "swing around" some other point in the video). However, it also impacts where the keyframes get created. Without much work you can actually get the keyframe generator to move the first few keyframes in exactly the opposite direction to where you want to go. This is not useful for the problem at hand, but I was able to change both the path and the velocity around each keyframe by playing around with this.

Once again, truly awful user interface, and the overall design is pretty awful.

Any Sony engineers listening?

Of course if they fixed it to work like it should, they'd have to do it as a new or parallel feature or else they'd break all existing VEG projects.
TheHappyFriar wrote on 8/22/2013, 10:44 PM
I followed my formulas and got the pan/crop moving perfectly linear (sudden start, constant speed, change direction, sudden stop) with no issues. My smoothness defaulted to 0, I never touched it. That smooths out the linear equation on that keyframe. From the sound of it, john's issue is that his Vegas defaulted to 100% smoothness for all the keyframes, my defaulted to 0. I'm using Vegas 10, could of been changed in 11 or 12. Here's my #'s.

D1 = 169.2
D2 = 424.6
S = 60 pixels/second
T1 = ?
T2 = ?

I decided on constant speed of 60 pixels/second instead of a set time.

S=D1/T1. If my algebra is correct, is should ht T1 = D1/S

T1 = 169.2/60
T1 = 2.82

T2 = 424.6/60
T2 = 7.076

Here's the veg file: here I miss the old lines showing you what the movement was but never noticed a changed in how it worked. I never found the UI for it confusing either. A little to simple imho.

EDIT: it's important to remember that for a setup like this, you want the speed constant between each point so you NEED to know the speed, distance and time. Estimating will make it look wrong.

EDIT2: I'm rereading the first post a couple times, are you looking for a curved path between point 1 and 3 that happens to land on 2? If you are I'd go about it slightly differently. To do it without a lot of manual keyframing you'd want a script to automaticly keyframe every frame for you. To do something like this handles on the keyframes in a graph are what you're looking for. The smooth & keyframe types in pan/crop effect the velocity, you want to effect the position with a biezer curve.
NickHope wrote on 8/23/2013, 1:08 AM
Thanks for the replies.

Yes TheHappyFriar, getting the motion to travel along a curve/spline is the problem. I had no problem getting the speed to be consistent (by doing some ratio calculations) but the motion is linearly along 2 sides of a triangle ("wild mouse" as John puts it) rather than a curve.

John, I think your solution of setting the 2nd keyframe to "fast" brings us as close as we're going to get with just 3 keyframes. But for me the motion is still not smooth enough. It's like the driver is taking is foot off and on the gas a couple of times as he drives round the bend.

So I think I'm going to do this the long way by plotting the desired positions of keyframes on a dummy copy of the map. Will probably start with a keyframe every 5 frames and then add more if necessary.

I do think there's an opportunity for a script to automate this sort of thing, but it's probably going to involve some heavy maths if splines like mine are involved. Tracking along circular curves (e.g. panning across the numbers on a clockface) should be more straightforward.
Grazie wrote on 8/23/2013, 2:17 AM
I looked at this in a different way. This any good?:




NickHope wrote on 8/23/2013, 2:43 AM
The video is private Grazie. Could you set it to public or unlisted?
Grazie wrote on 8/23/2013, 2:55 AM
Twit....

G

Grazie wrote on 8/23/2013, 2:58 AM
Try again.

G

NickHope wrote on 8/23/2013, 2:59 AM
This any good?"

Yes! Possibly a slight twitch on the throttle after the bend but I might be imagining that. How did you do it?
Grazie wrote on 8/23/2013, 3:06 AM
The twitch could be rectified - maybe? This was a quick n dirty . . .

I made a 36 second GenMed of this and then speedied it by squissing-down to 9 seconds, that's the Vegas 4x on Ctrl. Our eye and brain will put in the smoothness for us, plus Vegas appears to be getting you what you want. I think it's getting back to the basics of film making?

Basically, that which isn't smooth at real frame rates is being forced to cooperate by being speeded-up.

Have a go.

Grazie

NickHope wrote on 8/23/2013, 3:21 AM
Grazie, are you saying that if I simply make the motion happen over a much longer period (but with the same keyframe types and smoothness settings), then speed the rendered clip up, the result is different from genererating it at the correct speed to begin with?

Did you use 3 keyframes, and what were their "type" and smoothness settings?
Rory Cooper wrote on 8/23/2013, 3:54 AM
On track motion select x motion only = endpoint and start point
Make a parent for this track = parent track y motion only = 3 keys ,start,middle end. = all keys linear 100


Grazie wrote on 8/23/2013, 3:59 AM
Rory! Now THAT'S real smart . . . I was trying to get my head into Graphics-Space but the World of Film took over. Spectacular solution .. luv it!

Grazie

Rory Cooper wrote on 8/23/2013, 4:11 AM
Grazie if I was really smart I would be in the Comoros islands and not slogging at graft.

For your Y parent track make your first key and last key, start and end, then give the curve an eyeball and place the middle key in the middle.
Grazie wrote on 8/23/2013, 4:13 AM


(y'know, yah try to be nice . . but . . ?)


Grazie wrote on 8/23/2013, 4:25 AM


Do you want the Veg?

Grazie



Grazie wrote on 8/23/2013, 4:39 AM
Just had a thought, Nick, you could introduce a further control, using a Velocity Envelop to counteract any unwanted accelerations!

Grazie

NickHope wrote on 8/23/2013, 4:51 AM
Would be interested in the veg is it's not too much trouble Grazie.

Rory's solution is very clever. A nice workaround, but still not true uniform speed. I'll test it shortly.

In the meantime I've drawn my curve as a path on top of the map in Illustrator, divided it into 70 sections using the zigzag tool with a value of zero (one segment per 5 frames for the total travel taking 14 secs at 25fps), and deleted the alternate segments so I have the ends of the little lines to align to. Now I'm about to put it into Vegas and see how painful it will be to create and line up those 70 keyframes (or most of them) visually.

NickHope wrote on 8/23/2013, 5:25 AM
Actually that was really easy. I dropped down to one keyframe per 10 frames rather than 1 per 5 as the curve straightened out towards the top. I left all the keyframes as "linear" and 0 smoothness. I just zoomed in on the pan/crop window and visually aligned the centre of my rectangle with the ends of the little lines I had created in Illustrator. Then swapped back to the original map at the end. Probably about 30 mins work and the result is smooth.

But Rory's method is obviously simpler and a better way to do it in most circumstances. Thanks for that Rory.
TheHappyFriar wrote on 8/23/2013, 6:40 AM
Track motion won't work to well for this specific situation because it won't zoom in on the map, it will zoom in on the track. So if your map is a higher resolution then the track (project resolution) you'll have to render at a lower resolution then the project to not see the pixels. For this map it doesn't matter, it's low resolution anyway (the file in the first post) but if you're using a higher quality map you'll notice the issue.

Great idea though.

I simular thing as Nick did too: I used the biezer curve tool in Gimp, messed with the handles to get the second point on the curve, stroked the curve, saved the curve as a .png, brought in to Vegas, set the pan/crop start/end points to the start/end of my line.
farss wrote on 8/23/2013, 7:33 AM
atom12 said:
[I]" If anyone has a solid solution, I'd love to hear it. I don't think one exists"[/I]

As far as I can tell there is no solid solution because of the way Vegas is working. It uses the X and Y values of the keyframes and calculates how long it will take to move the X and Y position of the point between the keyframes. Various methods of smoothing can be applied but it's basically impossible to reliably emulate constant speed from this.

AE has some neat tricks to enable this such as converting a path to keyframes.

Bob.
set wrote on 8/23/2013, 7:34 AM
INPUT IDEAS FOR NEXT UPDATES / NEXT VERSION OF VEGAS :

- Need a new 'Floating keyframe' type, where the keyframe will adjust his position according to previous and next keyframe position.

- Further, in a complex 3D animation software, the keyframe for position is divided between X,Y,Z individually and rotation is also made different for X,Y,Z axis individually. This might needed for some situations, or possibly more creativity of motion or 'Kinetic Typography' can be made easier.

Ok, those are my inputs, hopefully can be discussed, just made difference between 'Basic Pan & Crop' where we usually know, and, 'Advanced Pan/Crop'.

Setiawan Kartawidjaja
Bandung, West Java, Indonesia (UTC+7 Time Area)

Personal FB | Personal IG | Personal YT Channel
Chungs Video FB | Chungs Video IG | Chungs Video YT Channel
Personal Portfolios YouTube Playlist
Pond5 page: My Stock Footage of Bandung city

 

System 5-2021:
Processor: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz   2.90 GHz
Video Card1: Intel UHD Graphics 630 (Driver 31.0.101.2127 (Feb 1 2024 Release date))
Video Card2: NVIDIA GeForce RTX 3060 Ti 8GB GDDR6 (Driver Version 551.23 Studio Driver (Jan 24 2024 Release Date))
RAM: 32.0 GB
OS: Windows 10 Pro Version 22H2 OS Build 19045.3693
Drive OS: SSD 240GB
Drive Working: NVMe 1TB
Drive Storage: 4TB+2TB

 

System 2-2018:
ASUS ROG Strix Hero II GL504GM Gaming Laptop
Processor: Intel(R) Core(TM) i7 8750H CPU @2.20GHz 2.21 GHz
Video Card 1: Intel(R) UHD Graphics 630 (Driver 31.0.101.2111)
Video Card 2: NVIDIA GeForce GTX 1060 6GB GDDR5 VRAM (Driver Version 537.58)
RAM: 16GB
OS: Win11 Home 64-bit Version 22H2 OS Build 22621.2428
Storage: M.2 NVMe PCIe 256GB SSD & 2.5" 5400rpm 1TB SSHD

 

* I don't work for VEGAS Creative Software Team. I'm just Voluntary Moderator in this forum.