Archived post by mattiasmalmer

Useful trick for filtering 3D tracked cameras:
“`
/* SMOOTHCAM
turn on constraints on your camera. add a constraint network (green squiggle button)
jump into the constraintnetwork. drop a “TransformWrangle and paste this code. press the create spare parameters button.
set the targetdistance to somwhere a ways away from the camera usually somwhere in the middle of your 3d tracked pointcloud enable the orange outputflag on the tranwsformwrangle
connect the getworldspace to input 0 of the wrangle.
drop a Filter set common/units to frames and perhaps something like 15 frames filterwidth and a couple of passes.
connect the filtered version of getworldspace to input1 on the wrangle
on the getworldspace set to ../.. and make sure its channel range is set to “use full animation range” or even longer to get good “ends” on your filter
remember to extend your cam animation with plausible slopes to get good filtering */
chopTRS c0 = c->fetchInput(0); chopTRS c1 = c->fetchInput(1);
matrix m0 = c->fetchInputMatrix(0); matrix m1 = c->fetchInputMatrix(1);
float dist=chf(“targetdistance”);
vector source=set(0,0,0)*m1; vector target=set(0,0,-dist)*m0; vector up=set(0,10,-dist)*m0;
up=normalize(up-target);
matrix3 orient=lookat(source,target,up); matrix TM=matrix(orient); vector rot=cracktransform(0,0,1,0,TM);
// Set transform @t = source; @r = rot;
“`

this helps by filtering the position of the camera but making sure that the pointing of the camera is unaffected at the target point distance so none of your position jitter ends up shaking your 3d track.

a classic use case is if an object is supposed to be really close to the camera but most of your tracking dots are some ways away.

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20254910/24/25/houdini_HrPUCSdRn5.mp4