Monday, October 6, 2014

Stabilizing footage after tracked

After you have tracked footage (scale and position), you can stabilize it with the following expression:

Anchor Point: (Paste in the tracked position keyframes)
Position: (Paste in the first tracked position keyframe (Single keyframe))
Scale:

start = 300.1255; //(first scale keyframe of track)
temp = (100*start)/(thisComp.layer("BG_Tracker").transform.scale[0]);
[temp, temp]

Rotation:
StartRot = -7.7137; //(first rotation keyframe of track)
r = thisComp.layer("BG_Tracker").transform.rotation;
StartRot - r;

Monday, July 21, 2014

Finding the Global Position in 3d of a Parented 3D Null

Trapcode Particular can use Position XY and Position Z as an emitter location, but it's not possible to just pickwhip a parented null's position, since that's just an offset from the parent layer.


For Particular, paste the following:


Position XY:
the3Dchild = thisComp.layer("Null 2"); posXY = the3Dchild.toWorld(the3Dchild.anchorPoint); [posXY[0], posXY[1]];



Position Z:
the3Dchild = thisComp.layer("Null 2"); posZ = the3Dchild.toWorld(the3Dchild.anchorPoint)[2];



For a plain old 3d Layer, we can use:



Position:
the3Dchild = thisComp.layer("Null 2"); the3Dchild.toWorld(the3Dchild.anchorPoint);


Scale:
the3Dparent = thisComp.layer("Null 1").transform.scale;
the3Dchild = thisComp.layer("Null 2").transform.scale;
[(the3Dchild[0] * the3Dparent[0])/100, (the3Dchild[1] * the3Dparent[1])/100, (the3Dchild[2] * the3Dparent[2])/100 ];

Rotation:
the3Dparent = thisComp.layer(Null 1").transform.rotation;
the 3Dchild = thisComp.layer("Null 2").transform.rotation;
the3Dparent + the3Dchild;

Tuesday, March 11, 2014

Converting After Effects 3D Camera Tracker to 2D Track

1) Track Camera
2) Select 2 track points and convert them to nulls
3) Create 2 additional nulls (2d)
4) Add expressions to the nulls:  L = thisComp.layer("Track Null 1");(L.toComp(L.anchorPoint))
5) Convert expressions to keyframes
6) Create a dummy 2 point track on layer.
7) Copy keyframes onto Attach Point
8) Apply track to an additional null.

Sunday, May 12, 2013

Assigning a seperate material to a selection of objects

Sometimes when I import .obj files, they consist of separate meshes with no materials assigned.  I wrote a super simple script to assign a new material to each mesh selected, and then it merges them all together, filter points (0 tolerance), quadralates it, and then matches the transforms to a different mesh.

VB Script:
set oSelection = Application.Selection 
for i = 0 to (oSelection.Count - 1) 
 ApplyShader "$XSI_DSPRESETS\Shaders\Material\Lambert.Preset", , , , siLetLocalMaterialsOverlap
 next
ApplyGenOp "MeshMerge", , oSelection , 3, siPersistentOperation, siKeepGenOpInputs
SetValue "polymsh.polymsh.mergemesh.tolerance", 0
TransferAllPropertiesAcrossGenOp "polymsh.polymsh.mergemesh", "polymsh", , True, True
TransferAllPropertiesAcrossGenOp "polymsh.polymsh.mergemesh", "polymsh", , True
CopyAnimationAcrossGenerator "polymsh.polymsh.mergemesh", 0
SetValue "polymsh.polymsh.mergemesh.inputreadregion", 0
DeleteGeneratorInputs "polymsh.polymsh.mergemesh"
MatchTransform "polymsh", "DrugCartel1", siSRT
SelectAllUsingFilter "Vertex", siCheckComponentVisibility
ApplyTopoOp "FilterPoints", "polymsh.pnt[*]", siUnspecified, siPersistentOperation
SetValue "polymsh.polymsh.filterpointsbydistancesop.distance", 0
SetValue "polymsh.polymsh.filterpointsbydistancesop.deletedoublepolygons", False
SetValue "polymsh.polymsh.filterpointsbydistancesop.collapsedoubleedges", False
ApplyTopoOp "Quadrangulate", "polymsh", siUnspecified, siPersistentOperation