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:

Hi everyone,

I was wondering if anyone might be able to do this for me. Hopefully it's easy. It's not for me, obviously, or I wouldn't be posting. :)

So, one of the VFX studios I work at has some proprietary scripts that I use both there and at home. I've been working with them for years, so they're pretty ingrained in me by now, for better or worse. The scripts are just a track averaging script and a rotation script. Occasionally I do video tutorials for After Effects, and obviously, I don't use these scripts in the tutorials because the viewer would not be able to do what I'm doing. I won't use anything in a tutorial that the viewer can't use, and because these scripts are proprietary, I respect that studio's work and won't use them.

I am aware that there is already an awesome track averaging script here written by Paul Tuersley:
http://www.aenhancers.com/viewtopic.php ... &sk=t&sd=a

And have even used it in a video tutorial already:
http://www.simplycg.net/viewtopic.php?t=2027

The request I'd like to make is just that the script work in a slightly different way. Right now, it works entirely under the Motion Trackers dropdown in the Timeline. I'm getting ready to do a series of video tutorials on removing things from footage (wires, rigs, crew people, reflections, pretty much anything), and I was wondering if someone here would be kind enough to make the script work on any layer with positional date. The way I've gotten used to working is with little solids. To check tracking, I make little 20x20 pixel solids and apply tracking data to that. Then I RAM preview it, and take the good ones and average them together to get rock solid tracks. Here's an example screenshot:

Image

That's what I'm asking. Is there any way to reconfigure Paul's averaging script so that I can select 2 layers with position keyframes, run the script, and a new layer (a 20x20 pixel solid) appears, with the averaged positional keyframes? I would use it extensively in this next series of tutorials I'm going to do, and would certainly pimp it all over the internet whenever anyone asked about tracking in AE. :) I'm guessing the math is exactly the same, it's just a matter of changing where it applies the data. Instead of making a new track under the motion trackers dropdown, could it just make a new small solid and apply it to that? I really, really have gotten used to being able to review tracks before committing to using them.

If it's not too hard, the new averaged layer could be automatically set as a guide layer, in case anyone forgets to turn off the visibility before rendering!

This would be such an incredible help to me, since I've gotten very dependent on that proprietary averager!

Oh, the rotation thing I mentioned... the way that one works is this: Apply tracking data to 2 little 20x20 solids. Select both tracks and run the rotation script. A new 20x20 solid layer appears with the new data. The position data from the first track is copied into the position of the new solid, and the rotation is derived from the second track. For example, say you have footage of a flower swaying in the breeze, then a bumble bee comes into frame and flies around. You want a line to point from the flower to the bee as they are all moving. You track both - the flower's center is the first track, the bee is the second. Then you select them and run the script. The position of the new layer is the 1st track, and the rotation is calculated so that it follows the 2nd track (the bee). Make sense?

I'm not a scripting person, I can't even write expressions, but you guys have done absolutely astounding things here. I hope this is something someone is able to help me with! I'd be so grateful!!

Thanks!!!

Sean

ps - here's all my tutorials, you can see I've also done one using that awesome mask tracking script here at AEnhancers!
http://www.mackdadd.com/html/visualfx.html
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:

What a colorful timeline panel :D

I'm not sure what you mean by "the rotation is calculated so that it follows the 2nd track", do you mean setting the rotation so that the horizontal axis of the solid points towards the second tracker point ?

As a starting point, you could give this a try: [*EDIT: see new script below]. I called it "TrackerViz" but you can change its name if you don't like it.

Here is a screenshot of the UI (actually that's not the real appearance but I had some fun in inverting colors :mrgreen: ) :
[*EDIT: see new UI below]

Let me know if that's not exactly what you wanted, it should be fairly easy to modify it.
Last edited by nab on March 2nd, 2008, 8:52 pm, edited 1 time in total.
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Wow, thanks! It looks great, I'll give it a try as soon as I get home tonight! Thanks so much!
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:

do you mean setting the rotation so that the horizontal axis of the solid points towards the second tracker point
Yes, I believe so.
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:

Wow, this was great!!! I love that it's its own little palette that I can leave open! Great interface, and the default settings box is wonderful!!

I tried it with 2 tracks first, then I selected all 4 tracks I had, and it appeared to work! Is that correct? Will it work with how ever many tracks are selected? Would it have to be an even number of tracks, like 2 or 4, or would it work with 3 or 5 as well?
Let me know if that's not exactly what you wanted, it should be fairly easy to modify it.
Ok, I feel bad asking, because it already works perfectly, though. Right now, it only works by selecting the tracks in the Motion Tracker list on the footage that was tracked. Is there a way to make it so that I could select ANY 2 LAYERS in the composition with position data and use them? I mean actual layers, not just the track data on the footage layer. That would be absolutely stunning! :)

The rotational part worked perfect, too! Nice work!
And, as I was playing with it, I thought of 2 other tiny things. The same way the rotational part works, could you make a scale button, too? So it would use the position of a 2nd track to create scale keyframes on the first track?
I was also wondering if it's possible to make the color setting in the Defaults box a color picker instead of a numerical value? These 2 things aren't a big deal at all, though. :)

Thanks for working on this for me! I can't tell you how much I appreciate it! If you can make it so that it works with any layers in a composition that have positional data, I would use this every single time I track for the foreseeable future! :)
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:

Okay, improved version should come on sunday...
Do you prefer a separate button for scale or do you want it included in a single 'Position+Rotation+Scale' button ?

By the way I didn't know your website so I watched some of your tutorials. I like how fast you manipulate masks for roto and your expression tutorials are hilarious :mrgreen: . I also like the way you comment the videos. (I agree 'Repeat Edge Pixels' should be ON by default :roll: ).

ps: for the first option, yes, you can average any number of trackers (>= 2)
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Wow, thanks, nab!! I'm extremely looking forward to Sunday now! :)
Do you prefer a separate button for scale or do you want it included in a single 'Position+Rotation+Scale' button ?
A seperate button for scale would be absolutely perfect!

And thanks for checking out some of my tutorials! TrackerViz is turning out so awesome that before I make my next little series of wire-removal tutorials, I'm going to make one specifically on how to use this!

Thanks again!
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:

I redesigned a new UI and made quite a lot of changes in the script. It should be more robust and (in my opinion) much more elegant.
I hope you'll find it intuitive and easy to use.

Image

First you select the type of data you want to work with (layers or trackers), then you choose a function (average position, position+rotation or position+rotation+scale) and finally you specify whether you'd like the solid animated by expressions (dynamic link) or standard (baked) keyframes.
I recommend to opt for expressions as it's faster and changes on the initial trackers/layers will be automatically reflected on the solid.

In the settings palette I added a "Save Prefs" option that allows you to write the script settings in AE's prefs file for next sessions. If you're on CS3, you will also see a color picker instead of numerical values, though my picker is a little bit experimental :)

You can watch a quick demo here that shows two small 2D layers and the solid created by the script.

The script is supposed to handle both 2D and 3D layers, and parenting too.

I spent most of the time on coding and not much on testing, please let me know if you experience bugs (or would like to -slightly- change some functionnality).

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

Downloading right now!! Very exciting, can't wait to give it a test run! :) Thanks!
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, I LOVE the new interface, and the color picker is great! So much nicer than the numerical one! And I absolutely LOVE LOVE LOVE the new options (expressions or keyframes, layers or trackers)!

In my testing, however, I did find a small problem/glitch. I took screenshots to illustrate.

The problem is that, for some reason, it doesn't like to average together tracks that were made by averaging other tracks. Does that make sense? I mean, say I track 4 points in an image. I can easily average them together by selecting all 4 layers with the keyframe data and averaging them. It works perfectly.
But, if I select 2 of those original tracks and average them together, then select the other 2 and average them together, I get 2 new averaged tracks. If I then select those 2 new averaged tracks and try to average THEM together, it doesn't work. It creates a solid the correct size in the middle of the composition, with keyframes all set to the center of the image.

I didn't try this in expression mode, I was using the keyframe mode.

Here you can see picking all 4 together and averaging them works great! :)
Image

So now I tried doing 2 sets of 2.
Image

And then I tried averaging those 2 new tracks together. The resulting track should be in the center of all 4 red tracks, and should be animated. Instead, it's in the center of the screen, not animated (even though it has keyframes on every frame).
Image

And in the function menu, would it be possible to also get a "Position+Scale" option?

And one last thing - is there a way I can pay you a little bit for doing all this? This is really going to be the most used script I've ever had, it's REALLY turning into a powerful little tool. It's going to get alot of use on major motion pictures. I know some people have those little "Donate" buttons on their websites for donating a bit of money via Paypal. Do you have something like that? I'd be honored to donate a little bit. :D
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:

Make sure the selected layers have different names and try again. I guess I could add auto-incremental naming. If this doesn't solve the problem, could you send me a little project that shows the bug.

I should also mention that the keyframing mode "Keyframes" takes into account the work area, so set it properly to avoid unnecessary keys.

As for Position+Scale (without rotating the layer), I'm not sure what you mean by that: just resizing it so that its width or height equals the distance between the two points, or something else ? An illustration would be great too. In fact more details I have, better the tool will be.

I could propose an update version next sunday (as I'm busy with other stuff during the week).

ps: check your private message for finding my Paypal address, thanks man.
hype
Posts: 94
Joined: November 27th, 2006, 11:08 pm
Location: Los Angeles, CA
Contact:

Make sure the selected layers have different names and try again.
Ok, I'll try tonight. :)
I should also mention that the keyframing mode "Keyframes" takes into account the work area, so set it properly to avoid unnecessary keys.
No problem!
As for Position+Scale...just resizing it so that its width or height equals the distance between the two points
Yeah, that's what I envision it to do. I suppose I could just run the P+R+S and then just turn off the Rotation stopwatch, deleting the keys.
I guess I could add auto-incremental naming.
That would be astounding, but I feel like I've already asked for too much! ;)

I guess some of this stuff sounds like weird requests, but honestly, this is all based on problems we've had over the years at a VFX facility that I work at that uses AE. That's why we have so many proprietary scripts there. We have individual scripts to do all this stuff. Having all this in one super handy little floating panel is a minor miracle, so I'm just trying to be thorough so it does everything I would need it to.
check your private message for finding my Paypal address, thanks man.
Thank YOU, nab! I can't tell you how much better this thing is going to make my tracking life! And I have no problem paying for something I'm probably going to use every single time I open AE. :)
if it's not fun, what's the point?
http://www.mackdadd.com
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

I'm following this thread with great interest, as I feel a lot of people in the AE VFX community will benefit from it. Nab, would you mind posting your final result in the Scripts Library section so it is easy to find?

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

Also, just for the record, as soon as it's done I'll be making a full-on in-depth video tutorial on how to use every feature in it, so everyone can see how awesome it is. :)
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:

Make sure the selected layers have different names and try again.
Yep, that solved it! :)

Which means the auto-incremental naming would make it even sweeter! There would be no time spent renaming.
if it's not fun, what's the point?
http://www.mackdadd.com
Post Reply