Track Averging alteration?

What type of scripts do you need?

Moderator: byronnash

hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

I recommend to opt for expressions as it's faster and changes on the initial trackers/layers will be automatically reflected on the solid.
This makes sense, but it has me wondering - what if I had two new averaged tracks that were expression-dependent, and I tried to average THEM together? Would it work? Or does it only work if there are actual keyframes on the layers you are trying to average? I do alot of averaging, then additional averaging using the new layers.
if it's not fun, what's the point?
http://www.mackdadd.com
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

Hey hype,
yes that should work...

Here is the new version: TrackerViz.zip

I've made quite a lot of changes. Among other things I've added
  • position+scale
  • incremental naming
  • cycle colors option (similar to the built-in cycle colors for masks)
  • four new functions: shape to tracker/layers and tracker/layers to shape, this means that the script now integrates a "rototrack" feature (you can associate mask vertices to track points and convert (analyzed) track points to animated mask, possibly rotobezier), you can also animate a mask based on the position of some layers (the reverse too), and more...
  • many error checks, alert messages or warnings that should prevent any problem (bad selection, confusing layer names for example)
  • added new About dialog (with a brief description of every function)
  • more comments for those who want to look inside the code, corrected bugs and improved code in general
I didn't extensively test all options (12 functions that are supposed to work with 2d and 3d data, possibly animated by keyframes, expression or both, that represents a lot of stuff), so again please let me know if you find something that doesn't work.

Note: since I also modified the prefs part, it may be a good idea to remove the old entry (do a search for "Viz") in your prefs file.
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Wow, that's quite a list of changes!!! :D :D :D :D

The mask/tracking stuff certainly sounds interesting, as do all the new features! Great idea about cycling colors as well!

I'll give a test run tonight, just downloaded it!

Thanks a million!
if it's not fun, what's the point?
http://www.mackdadd.com
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Ok, running some tests with it. Some things are great and work perfectly, some things are a little confusing to me.

The cycling of the colors and the incremental solid naming is working perfectly, and I love the new little boxes that pop up when you do something wrong. And the "?" tab is wonderful, awesomely informative!

Yep, the averaging works with expressions, like I was wondering about in that earlier post. That's awesome!!

So here's some of the things that are confusing to me now. I took screen shots to illustrate. First I'll explain.

The first thing is the parenting seems to be messed up for some reason. In Picture 1, I tracked 4 things in the scene, then selected all four tracks and ran the Pos/Rot/Scale on it, using Layers and Keyframes. I then parented the Mack/Dadd logo to one of the original un-averaged tracks. Works fine, just as it should. It does NOT alter the Mack/Dadd layer, just parents it's position.

Image

In Picture 2, I parent the Mack/Dadd logo to the new Pos/Rot/Scale solid, and it goes all deformed. It shouldn't do that. It should remain in it's original position and simply inherit the transformations starting from whichever frame I parent it at.

Image

So Picture 3 shows the Mack/Dadd logo unparented after being parented to the Pos/Rot/Scale solid, and now it's rotated funny. This isn't a big deal, I'm just pointing it out because it shouldn't be changing position at all as I do a parent and unparent, yet here it's changing inexplicably at both operations.

Image

That's one of the things I found. Picture 4 shows another thing. I selected tracks 1 and 2 and ran Pos/Scale on it (set to Layers & Keyframes again). I'm wondering how the script decides which track to use as position and which to calculate the scale from. Does the order the layers are selected in make a difference? Because in this example, it seems to have chosen track 2 as the position, when it seems more natural that it would use track 1. It works this way with Rotation, too. It's just a bit odd, since I'm expecting the new solid to appear somewhere and it ends up appearing somewhere else.

Image

And, I'm noticing that the incremental naming is apparently driven by some preference the script is saving, right? Because even if I delete new solids that it makes, it still continues with the naming convention right where it left off. For example, in Pic 4 you can see it made Tracker 13. I have no other solids named "Tracker #" in there, so I imagined if I deleted Tracker 13 and ran the script again, it would make Tracker 1. But it makes Tracker 14. This is not an issue at all, I don't mind, I honestly don't care what it calls it as long as it's something different. But am I someday going to be making Tracker 1,253,754? Or is there a number where it stops and goes back to Tracker 1?
it may be a good idea to remove the old entry (do a search for "Viz") in your prefs file.
I actually have no idea how to do this! :lol: Where is my Pref file at?

Ok, now the mask tracking. It could be that I just don't understand how it's working yet. But I want to! RotoTracking in this palette would be AMAZING!!! So, please help me to understand how it's working.

Picture 5 shows me running it on 2 tracks with Keyframes set to 5s. It appears to have made a very strange mask shape that consists of only 2 mask points, and no mask edges. It also appears to have keyframed in the follwing manner: Keyframe, skip 5 frames, Keyframe, etc... There are keyframes on frames 1 and 7, skipping the 5 in between.

Image

So now in Picture 6, I wanted keyframes on every frame, so I set it to 1s. It made the same weird mask vertices (no edges), and there are now keyframes at frames 1 and 31, skipping the 29 frames in between.

Image

Ok, that's all I have so far. Like I said, maybe I'm just not understanding some of these new features, and I'm not using them correctly. Please just let me know if I'm doing something wrong. I really appreciate all the work that's going in to this!!
if it's not fun, what's the point?
http://www.mackdadd.com
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

Thanks for testing.

I'll take a look at the parenting stuff, though I'm not sure the problem is related to the script. Anyway I'll do some testing in that direction to see what's going on...

"I'm wondering how the script decides which track to use as position and which to calculate the scale from."

The first selected tracker or layer is chosen for position and scale is determined by the length between the two track points or layers.

"I'm noticing that the incremental naming is apparently driven by some preference the script is saving, right"

A numerical suffix is simply added at the end of the 'base' name written in the settings palette. It doesn't make some sort sort of 'intelligent' naming as this would require much more code and would lead to some problem at some point (with previous expressions for example). It's just a quick way to avoid identical names. The 'counter' is reset to 1 each time you close the palette and rerun the script.

Prefs file is located at "C:\Documents and Settings\YOUR_USER_NAME\Application Data\Adobe\After Effects\8.0"

For picture 5 and 6, apply a stroke effect to the "Linking Shape" layer, and you should see a line between the two layers.

To RotoTrack:
- draw a mask, select its mask path property and execute Shape To Tracker
- 'Analyze' track
- select the tracker and execute Tracker To Shape to obtain a mask that follows the track points

You should enter the number of keyframes PER SECONDS (noted " / s" in the palette), so for instance if you want a keyframe at each frame, type in 30 (for a 30fps comp). Key time is rounded to the nearest frame to avoid keys between two frames.

And final remark, you seem to always select "Keyframes" mode, I think "Expression" is a better choice (which is available for most functions).
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Ok, I'll give it another run through first chance I get! thanks!
you seem to always select "Keyframes" mode, I think "Expression" is a better choice
Yeah, I do. I like actually seeing the keyframes in the layer. That's part of the reason I made a request for a script like this, I like being able to *see* all the data in the timeline and in the viewer, so I can analyze it visually and modify it all by hand if I have to. That's why I like the little solids, I can watch them moving and see what the track is doing before I decide to use the track. There's alot of hand tracking and matching things up by eye in visual effects, and alot of times when adjusting a tracked solid, I like to grab the keyframe and nudge it around a bit. That's trickier using the expression based solution, since I would have to go and alter the dependant tracks, and then my nudging would be averged before I saw the result. I know it's realtime updating, but if i have 4 tracks averaged, and want it nudged 1 pixel on 1 certain frame, it would be kind of confusing to get it nudged right. Does that make sense? It's just the way I've been working for over 6 years now, so I'm kind of used to it. If I'm just doing a simple track average, I have no problem using the expression option. But if I'm going to be tweaking and messing with the tracked solids, I'll probably stick with the keyframe option.

The tracking sounds interesting when you lay out the workflow like that. It sounds like you draw the mask, and it makes little trackers. Then you run the trackers. Then you execute Tracker To Shape and it assigns that data to the mask points. Right? This is alot like that roto tracking script that Alejandro Pérez made.
http://www.aenhancers.com/viewtopic.php?f=3&t=329
If I am correct and this is the way it works, is there a way to make it so that you could use the data from the little tracked solids to apply to the mask points? I guess one way would be to copy the position data from the solid to the assigned tracker, then execute Tracker To Shape. But is there an easier way, a way using the solids themselves, without copying and pasting data?
if it's not fun, what's the point?
http://www.mackdadd.com
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

I had another idea for TrackerViz, based entirely on something I had to do last night working on the fx for the DVD extended edition of "Semi-Pro". Of course, please disregard it if it's too much to add in. :) I'm just throwing it out there in case it's super easy to include. Please don't feel obligated to add it in.

Track Combine. Like, say you do a track and over the course of the frames, it drifts slightly. So you make another solid (or null, or whatever) layer, parent the tracked layer to it, and set maybe 2 or 3 keyframes manually on that new solid to correct the drift of the original track. Track Combine would then let you select those two layers, one parented to the other, and create a new track which is the same result. It could just be another option in the pulldown menu.
if it's not fun, what's the point?
http://www.mackdadd.com
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

Hey hype.

What I mean by "parenting is supported" is that if the layer containing the selected trackers (in trackers mode) or the selected layers (in layers mode), are parented to other layers, the script takes this into account and calculates the appropriate values. What you describe above with the parented logo (the first pics) has, in my opinion, nothing to do with the script since the values have already been generated and they seem to be correct. Suppose that you have animated the pos+rot+scale layer by hand and then parent the logo, the end result will be the same. The layer is scaled up or down (not uniformly in both axis) and rotated too. The child inherits these transformations and that's why your logo is deformed.

I should point out that pos+rot+scale (like pos+rot and pos+scale) needs only two things, 2 trackers or 2 layers, so the script should send a warning message if you "selected all four tracks and ran the Pos/Rot/Scale on it".

As for the rototrack thing, yes that's the same principle as in the script posted by thehardme. The little addition is that you can choose the frequency of the keyframes and also select rotoBezier mode.

You can play with mask shape and tracker but also with layers. For example if you animate a star mask, say you modify scale and rotation of the mask over time. Then you apply Shape To Layers on this mask and the script creates a layer for each point of the star and animate it so that it follows the corresponding mask vertex. This is easier to try than to explain.
The reverse is possible too, i.e. animating a mask from layers animation. So to the question "is there a way to make it so that you could use the data from the little tracked solids to apply to the mask points?" I would answer yes, just select the layers and apply Layers To Shape.

I've added "Track Combine" to the new version TrackerViz.zip. Select the position of the stabilizer first (a null layer for instance) and then select the tracker by Ctrl+Clicking it (the order of selection is important). If the tracker has multiple track points, every track point will be 'corrected'. But how do you plan to use such a function ? I mean, track points are only visible in the layer panel, so how can you make precise ajustment with the parent layer (which is not visible in the tracked layer panel) ?

ps: my girlfriend is the only person who can oblige me to do something :lol:
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Suppose that you have animated the pos+rot+scale layer by hand and then parent the logo, the end result will be the same. The layer is scaled up or down (not uniformly in both axis) and rotated too. The child inherits these transformations and that's why your logo is deformed.
Hmmm... It should definitely inherit the transformations, but only over time. For example, say I'm putting a matte painting into a hand held shot that has a slow zoom in. I'm going to want pos/rot/scl all tracked perfectly, but on another layer (a null, or a little 20x20 solid set as a guide layer). Then I take the first frame of the footage into photoshop and create my matte painting. Then I bring it back into AE as it's own layer, above the main footage. On frame 1, it lines up perfectly, so I parent it to the 20x20 solid layer at that frame, frame 1. It shouldn't change on that frame. It should inherit the movement from that point on, so now it matches into the moving footage perfectly. The way TrackerViz was working in that example I posted above (picture 2), it seemed to APPLY the transformations right at the parenting frame, warping it.
But how do you plan to use such a function ? I mean, track points are only visible in the layer panel, so how can you make precise ajustment with the parent layer (which is not visible in the tracked layer panel) ?
I haven't had a chance to try out Track Combine yet (work has been busy), but I can certainly answer the question of how would I use it. Also, you ask how can I make precise adjustments with track points only visible in a certain place. This is PRECISELY why I started this thread! :) At work just about every single thing we do is dependent on precise, perfect tracking. Absolutely PERFECT tracking, on 2K and 4K film footage. This is also why we use little 20x20 solids. Because they are just little blocks of color, and we can see the exact placement and movement of all of them at the same time. If you look at the pic I posted in the first post when I started the thread, you can see I have about 24 trackers there, just to perfectly pin that blood stain on the guy's shirt. I had also deleted alot of the trackers I had used to get those trackers that are left. Using the little 20x20 blocks, we keep working with them until we get perfect tracks. Then we simply parent the elements in our composites to the perfect tracked 20x20 solids. This is how we analyze as many tracks as we want all at the same time, right in the main comp window.

Track Combine is because sometimes, to get a usable track, we have to set the track options to "Update feature on every frame". This feature is sometimes the only way to get a track throughout an entire footage sequence. But, using that feature introduces a slight drift in a track, so that by the time you get the end of the footage, even though the track is still relatively accurate in it's frame by frame movement, it may be not directly on top of the feature you had started out tracking. It "drifts" over the course of the footage. The easiest way to fix this is to create another 20x20 solid, then parent the drifting solid to it, and then go through the footage setting only a few positional keyframes on the new 20x20 solid. With the drifting solid parented to it, when you shift it, the drifting solid shifts as well. if you set 2 keyframes, one at the beginning, and one at the end that shifts it back over top of the feature you intended to track, you have effectively taken the drifting out of the drifting track. But, you cannot parent anything to either of these, because if you parent to the drifting one, you don't get the correction movement of the other 20x20 solid, and if you parent to the correcting one, you don't get any of the track, only the slight shifting correction. The solution is to calculate a new 20x20 solid which matches the movement of the corrected (parented) drifting solid. Does that make sense?

This weekend I can make some screencaptures to better illustrate some of these things. I'll show you how the proprietary scripts work, so you can see the functionality I'm looking for. :)
if it's not fun, what's the point?
http://www.mackdadd.com
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

About parenting:
. create a new comp and create a 100x100 solid.
. change its position, scaleY, and rotation (and also its anchorPoint since the script also modifies the anchorPoint).
. set a keyframe for these 3 properties.
. move forward, say 100 frames, and set new position, new scale and new rotation.
. go back to frame 0.
. import your logo into this comp and parent it to the solid.

What do you see ? (your logo should be deformed...)
This weekend I can make some screencaptures to better illustrate some of these things. I'll show you how the proprietary scripts work, so you can see the functionality I'm looking for.
great ! because the script is about 3000 lines, so I think it's time now to know what functionality you're really looking for :mrgreen:
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

I haven't forgotten about this, nab! Just been super busy the past couple weeks! I'll be getting back on this first chance I get! :D

sean
if it's not fun, what's the point?
http://www.mackdadd.com
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

nab, I PMed you a video link. :)

sean
if it's not fun, what's the point?
http://www.mackdadd.com
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Hey nab,

Ok, like I PMed you, now that the averaging stuff is all sorted, I'm dabbling with the rototracking stuff. Something cool I noticed, the Keyframes per second now defaults to 30! Cool! Or does it read the frame rate of the comp and default to that (so if it was 24fps or 25fps, would it default to that?)? Also, here in the US, we use 29.97fps for broadcast. Would TrackerViz work if that was typed in as the fps?

I also noticed that the Shape to Layers and Layers to Shape functions are gone, and there's only the Tracker to Shape and Shape to Tracker. Is that something that can easily put back in? Ideally, it would be awesome to be averaging little solids together, correcting them if they drift, then using that repaired data to drive a mask vertex.

Wow! I just gave it a test run using trackers (multiple track points under 1 tracker)! Worked flawlessly!!! I totally get it now, its super easy to use! Can we get it to work with Layers as well (the standard 20x20 solid we've been using)? I'm not sure how exactly it would work, since the way it works now is to select the 1 tracker that has all the points, and then it calculates it based on the sequential order of the track points. It it possible to use sequntially named Layers as well? To have the power to average and correct the tracks before applying them to the mask shape would be astounding!!!

Wow, we are REALLY close to finishing this! You've done awesome work on this thing!!!

Sean
if it's not fun, what's the point?
http://www.mackdadd.com
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Hey nab,

Since we're so close, I thought I'd try and come up with a logo for TrackerViz!!

Do you like it? I can change it, if not. Is it even possible to get a JPG ir GIF into the palette like this? I think it makes it look quite a bit like a professional tool! :)

Image
if it's not fun, what's the point?
http://www.mackdadd.com
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

New version available here: TrackerViz.zip
I've added an icon button at the top of the palette and corrected one or two things in the code...

Your icon is great but a little too big, if you don't like mine, you could send me your creation as a 240x26 png file.
hype wrote:Shape to Layers and Layers to Shape functions are gone
they are not gone, but the functions list dynamically updates according to the selected option in the Work With dropdown (if Layers is selected, then Shape to Layers and Layers to Shape are displayed...)

I will take a look at the fps stuff next week-end.
Post Reply