Raphael Schaaf
Forum Replies Created
-
Raphael Schaaf
March 10, 2012 at 12:15 am in reply to: time offset based on brightness of different layerThank you very much 🙂
-
If you want to reverse one side just call the tracked video “left” instead of “right”.
The names of the tracked videos are only used to orientate the 3d movement correctly.Another little info about the script:
If you change the position of your 2d-null, the position of the 3d-null should automatically be recalculated without rerunning the script. -
Hi Mr. da Silva ^^
Here’s the script file:
Use it like this:
1. Place the videos you tracked on top of all the layers of your comp.
2. Name them after the side you filmed them from, i. e. “front” and “right”.
3. Select your two null layers with the 2d-tracking data. The null belonging to the first video should be on top of the other null, otherwise the x and z data get interchanged.
4. Run the script. I use the German version, but it should be something like this: file > script > run scrip > MoCapNullCon.jsxIf you have done everything wright you have now a null with the 3d data.
I wrote the script in AE CS4, hope it works fine in other versions….
If not contact me an I will try to fix it. -
and it works =D
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Created by Raphael Schaaf 2011
//Motion-Capturing Null-Conector{
app.beginUndoGroup("Nullconector");thisComp = app.project.activeItem;
var Name1 = String (thisComp.selectedLayers[0].name);
var Name2 = String (thisComp.selectedLayers[1].name);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//this part will compare the first 2 layers name and orientate the position of the new null correct
front = new String ("front");
back = new String ("back");
right = new String ("right");
left = new String ("left");var video1 = String (thisComp.layers[1].name);
var video2 = String (thisComp.layers[2].name);if (video1 == front) {
var expr1 = 'x = thisComp.layer("' + Name1 + '").position[0];';
}else{
if (video1 == back) {var expr1 = 'x = thisComp.layer("' + Name1 + '").position[0] * (-1);';
}else{
if (video1 == right) {var expr2 = 'z = thisComp.layer("' + Name1 + '").position[0];';
}else{
if (video1 == left) {var expr2 = 'z = thisComp.layer("' + Name1 + '").position[0] * (-1);';
}else{
alert ("choose compatible videoname")
}
}
}
}if (video2 == front) {
var expr1 = 'x = thisComp.layer("' + Name2 + '").position[0];';
}else{
if (video2 == back) {var expr1 = 'x = thisComp.layer("' + Name2 + '").position[0] * (-1);';
}else{
if (video2 == right) {var expr2 = 'z = thisComp.layer("' + Name2 + '").position[0];';
}else{
if (video2 == left) {var expr2 = 'z = thisComp.layer("' + Name2 + '").position[0] * (-1);';
}else{
alert ("choose compatible videoname")
}
}
}
}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//this part takes the average of the height of the 2 nulls to make the height of the new null more accurate
var expr3 = 'y = (thisComp.layer("' + Name1 + '").position[1] + thisComp.layer("' + Name2 + '").position[1]) / 2;';
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//this part takes all the position information together
var expr4 = 'value + [x,y,z];';
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//this part puts the single parts together to a single expression
var expr = expr1 + expr2 + expr3 + expr4;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//this part creates the new null, names it, makes it 3d, moves it to the end, and sets the initial position to 0
var newTrackpoint = thisComp.layers.addNull();
var trackName = 'Trackpoint';
newTrackpoint.name = trackName;
newTrackpoint.threeDLayer = true;
newTrackpoint.moveToEnd();
newTrackpoint.position.setValue ([0,0,0]);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//this part writes the expression into the null
newTrackpoint.position.expression = expr;app.endUndoGroup();
} -
Ok, i\’m an idiot and you\’re a genius 🙂
It all works now there was realy just one little detail that ruined the whole thing. I created the new null before i created the final expression variable, and so the selected layer wasn\’t any longer the trackpoint, it was the new null.
Because of that it followed itself and always stayed in the middle.
But i don\’t know why the expression was empty yesterday, i didn\’t change the script and today it was written in…Anyway, thank you so much
I will post the whole script if it is finished =D -
hmm… still doesn’t work
i try to figure out which part of the script isn’t working, it has to be some little detail, because the 3 position “numbers” of the new null turn red, as if it had an expression, but the expression doesn’t get written in the null.
and so it doesn’t animate and stays in the middle of the comp.
also the little “stop-watch” next to the position of the new null isn’t activated, maybe it has something to do with that…?i’m trying to get it work…
P.S. what does the “/rvalue” in the expr1_2 mean?
-
it works with an expression, i already had this before i even started with the script:
x = thisComp.layer(“Null 4”).position[0];
value+[0,0,x*(-1)]
………………………………………………….i just wrote it into one of my nulls and the other null is “Null 4”.
but i just don’t get it working in the script… and i don’t want to write this expression in every null, would be a boring solution 🙂
with the script i learn at least something 🙂 -
Thanks for the answer. My english isn\\\’t very good, but i try to explane it better.
Basicaly i want to do a motion capturing effect and then export the data to use it in cinema 4d to animate a 3d model.
I have 2 cameras, one in front and one left or right of my actor. The actor has markers all over his body.
The markers get tracked in after effects and the tracking data is applied to nulls. At this point i have 2 nulls for every marker on the actor, one from the front and one from the side.
Now i want to create a new null which moves 3dimensional, left/right from the track of the front video, forward/backward from the track of the side video and up/down from the average of the 2 tracking points.
The first 2 layers in my comp are the videos. They get named front back left or right so the script knows from which sides they got filmed and orientates the nulls acordingly in 3d space.
The next layers are the nulls that are tracked from the first video, after them those which are tracked from the second video.
Now i select the 2 nulls i want to conect and run my script and hopefully it takes the positionkeyframes of the 2dimensional moving nulls and creates a new null that moves 3dimensional that is at the end of my layer list so it doesn\\\’t screw up the order of the other layers.I hope you know now what i want to achieve 🙂
-
Raphael Schaaf
January 31, 2011 at 5:38 pm in reply to: question: how to parent different positions to a nulloops, i just realized that i posted it in the wrong forum, thanks man 🙂