Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions question for trigonometry geniuses

  • question for trigonometry geniuses

    Posted by Daniel Crooks on May 5, 2009 at 3:21 pm

    hi people

    I’m looking for an equation to ‘linearise’ the pixel motion of a panning camera. I thought a simple Sine displacement map would do the trick but unfortunately the curve appears to be a little trickier than that. let me explain.

    I have a camera on a motion controlled pan head. the nodal point of the lens is perfectly on the axis of rotation. The camera is panning at a constant speed. In the shot I have a telephone pole which slowly moves across the screen from left to right. I want the pole to move exactly 1 screen pixel per frame. I have adjusted the pan speed of the motion control head so that the edge of the pole takes exactly 2048 frames to go from left edge to right edge of frame (I’m shooting 2k so 2048 pixels wide). I thought this would give me a pole moving exactly 1 pixel per frame. But No. At the start , middle and end the pole is in the right place (x =0, 1024 and 2048) but In between these points the pole accelerates and decelerates. I rendered a streak image of the pole and it appeared that the divergance was Sine based and given it’s a rotation situation I assumed that it must be correct. So I generated a 32bit displacement map using a horizontal ramp that went from 50% grey to white to grey to black and back to grey following a perfect sine curve. This worked really well but when I matched it to the curve of the moving pole it didn’t quite fit (mainly near the edges of the frame, teh pole seesm to move off quicker than a sine curve would dictate). So… I replicated my situation using a perfect computational camera in After Effects to see if it was real world lens errors but I got the same result.

    if any of that made sense to anyone I’ll be amazed.

    I have put up a small 1fps movie and a couple of jpegs of the after effects modeled version to help illustrate the problem.
    https://www.dlab.com.au/pan/perfect%20pan%20small-1fps.mov
    https://www.dlab.com.au/pan/perfect-pan-(00512).jpg
    https://www.dlabcomau:@dlab.com.au/pan/perfect-pan-map.jpg
    https://www.dlabcomau:@dlab.com.au/pan/displace-(00000)_1.jpg

    any suggestions on how to work out the right equation or how to otherwise create the perfect displacement map or any other means of mathematically correcting the divergence would be greatly appreciated.

    cheers../daniel

    Filip Vandueren replied 17 years, 1 month ago 3 Members · 4 Replies
  • 4 Replies
  • Peter O’connell

    May 6, 2009 at 1:30 pm

    Hi I think this has to do with the fact that all points on the plane are not equidistant from the camera (look at the top view to get an idea of what I mean).
    As far as a workaround, couldn’t you pull out the handles for the rotation in the graph editor (for the keyframes at the beginning and end) until they sync up at 25% and 75% as well?

    Pete

    roguekeyrame.com

  • Daniel Crooks

    May 6, 2009 at 2:13 pm

    hi Peter

    thanks for responding. In my case i need to keep the camera moving at a constant speed and just displace the final footage. But interestingly enough your graph is heading in the right direction. Turns out the function i was looking for is Tan based (and is also very specific to the field of view of the lens). My head started melting this afternoon but i finally got it to work.

    cheers../daniel

  • Filip Vandueren

    May 6, 2009 at 5:51 pm

    Hi there,

    just a quick reply:

    turns out it’s a Tangens, not a Sine

    This worked for me:

    r=degreesToRadians(thisComp.layer(“Camera 1”).transform.yRotation);
    [512,288] – Math.tan(r)*1422.2

    1422.2 is the distance from the camera to the solid

  • Filip Vandueren

    May 6, 2009 at 5:54 pm

    Woops, sorry, had this window open for way too long without refreshing…

    Actually I think it’s a natural byproduct of the filming proces, because, after the image wen through the focal point, you’re then projecting onto the film which is a flat, and not a circle-like curve. I think that’s why it’s a tangens

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy