Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Complex 3d Space Question

  • Complex 3d Space Question

    Posted by Dan Lachevre on November 25, 2006 at 12:55 pm

    Hi all

    Here is a question I’ve wanted to ask for ages and never got around to. Does anyone know of a simple way to take elements from a 2d space, such as a photo that has been cut up into pieces, and push these about in 3d space so when the camera is at it’s default position they appear perfectly aligned?
    …Kind of like how elementsd in 3d space appear when the camera is set to orthographic, but using a regular lense setting. There must be a simple algorithim that you could use as an expression that could automatically resize & reverse the lense distortion as you positioned it further or closer along the z axis. Maybe there is a plug-in that already does this? Any help from the Expression gurus out there would be appreciated.

    Danny

    Dan Lachevre replied 19 years, 5 months ago 5 Members · 7 Replies
  • 7 Replies
  • Mylenium

    November 25, 2006 at 1:33 pm

    Neither is there a simple algorithm nor technique nor any magic plugin. The simple truth is that you do not have access to the actual pixels of a layer or mask shapes and thus never exactly get the proper dimensions on irregular shapes. I believe a while back Dan posted some simple code for a projection matrix based on using the acos() function, maybe you can dig it out and work from there. Other than that – like they say in “Battlestar Galactica” at one point: “Mark 1 eyeball.” ;o)

    Mylenium

    [Pour Myl

  • Andrew Kramer

    November 25, 2006 at 8:49 pm

    https://forums.creativecow.net/cgi-bin/new_page_wrapper.cgi?forumid=2&page=https://www.creativecow.net/articles/kramer_andrew/3dcompositing/index.html

    If the camera is orthographic then the effect of having a camera will certainly be lost. In the tutorial above, I simply resize the layers to the comp size before proceding. Good Luck,
    Andrew Kramer

  • Dan Lachevre

    November 25, 2006 at 10:47 pm

    Hi Guys

    Thanks for the suggestions. You guys are always helpful and Andrew, your tutes are great. Hope they’re paying you the big bucks!

    Had a look at the two suggestions but Dan’s expession entry was a bit beyond me and Andrew, your tute isn’t exactly what I mean.

    There is a great experimental project by MK12:

    https://media2.mk12.com/v5_qt_html/2001/infinity.html

    that does exacly what I mean and I can’t work out how they’ve done it. It is best displayed at 1’37” where as the camera moves we can see the radioactive guy is actually shattered over the Z axis. It doesn’t appear any of the layers are moving so how does everything match so perfectly. I’ve come close by manually moving sections and merely eyeballing it but nothing close to this degree. It is obviously easier with less z movement and a less distorted lense but there must be an easy way of doing this.

    There is some great 3d stuff in the clip but it is this 2d/3d technique that is the most interesting.

    Danny

  • Dan Ebberts

    November 26, 2006 at 12:19 am

    This seems to work. It assumes your camera starts out on the comp’s z axis. Start with your pieces arranged at z = 0. Add a Slider Control to each piece and set the value to 100. Add this expression for Positon:

    cameraPos = [thisComp.width/2,thisComp.height/2,-888.9];
    zControl = effect(“Slider Control”)(“Slider”);
    v = (value – cameraPos)*zControl/100 + cameraPos;

    Make sure the z value in the cameraPos variable matches your initial camera z position (mine was -888.9);
    Add this expression for Scale:

    zControl = effect(“Slider Control”)(“Slider”);
    value*zControl/100

    Adjust the sliders – values smaller than 100 move the piece closer to the camera, greater than 100 move them away. There should be no apparent change in position or size as you adjust the slider – it only shows up when you move the camera (or change the view).

    Dan

  • Mike Clasby

    November 26, 2006 at 2:40 am

    It works… Great.

    Thanks dan811 for asking the question and Dan007, I mean Dan Ebberts, for answering.

  • Andrew Kramer

    November 26, 2006 at 8:45 am

    WOW! That’s a mean script. Excellent.
    Andrew

  • Dan Lachevre

    November 26, 2006 at 1:46 pm

    A huge thanks for that Dan! That is awesome. I have been looking for a way to do this for ages. Unfortunately my ability with expressions is pretty limited.

    This forum is always such a great source of help!
    Thanks again to all!

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