16 Replies Latest reply on May 28, 2013 10:53 PM by Rick Gerard

    Multiplaning without affecting scale due to the Z axis?

    victoriavanpatten

      I'm currently working on an animated film which makes extensive use of the puppet tool and, like most animated films, the surrounding world of the film makes use of perspective and perceived 3-dimensional space.

       

      I very much appreciate the functionality of using 3d space in after effects to avoid having to animate every individual item (this background is quite cluttered) but as I have everything drawn and illustrated to the exact dimensions I want it to be seen as on screen, is there any option to effectively modify an object's placement in 3d space without allowing the Z axis to perform its natural function of making things larger as they come closer or smaller as they are pushed away? I am not going to be rendering any scenes that make use of altering position in the Z axis, so that's not an issue.

       

      I tried moving the objects on the Z dimension, then adjusting the size of the items to make objects that are closer smaller (so they're essentially the size they started out as) and objects further away bigger (again, to make them the same size as they were to begin with) but to do this I have to do a lot of guesswork and I'd really appreciate just being able to move "prop items" where I want them to be without distorting their scale so I can pan through a scene with a nice multiplaning effect and the freedom of not having to animate every individual object.

       

      I know this is a rather complicated request, but I'm assuming there must be some way to do it and I'm just not knowlegeable enough to figure it out on my own.

        • 1. Re: Multiplaning without affecting scale due to the Z axis?
          lasvideo Level 4

          Zaxwerks Layers Tools Z distribution plugin. I have used this one.

           

          http://zaxwerks.com/layertools/index.shtml

           

          AE Scripts. Multiplane

           

          http://aescripts.com/pt_multiplane/

          • 2. Re: Multiplaning without affecting scale due to the Z axis?
            victoriavanpatten Level 1

            Thank you so much! This is exactly what I needed!

            • 4. Re: Multiplaning without affecting scale due to the Z axis?
              Rick Gerard Adobe Community Professional & MVP

              There's also very simple expression that multiplies the scale by the ratio between the distance from the camera and the zoom value. I use this one all the time. It's nothing more than a simple division problem.

               

              Try applying this to the scale position of your 3D layer:

              C = thisComp.layer("Camera 1");
              L = thisLayer
              CP = fromWorld(C.toWorld([0,0,0]));
              LP = fromWorld(L.toWorld(anchorPoint));
              d = length(CP, LP);
              z = C.zoom;
              r = d/z
              r * value
              

              Okay, the expression looks a little complicated, but it's really simple.

               

              Let me try and explain what's going on here. First thing I'm going to do is define the variable C as the camera, and the variable L as the current layer. Using variables makes things easier to read, and saves typing.

               

              I tend to use a lot of parenting in my compositions. When you assign a parent the position value of the child is relative to the parent. This is going to cause problems in the calculations so the next two lines use the layer  space transformation method to set the position value relative to AE's 3D world. CP is the position of the camera relative to AE's 3D world. LP is the position of the layer relative to AE's 3D world. Adding a parent to the camera or the layer will now not complicate the calculations.

               

              The next method is AE's length function. It simply measures the distance between two points. In this case, d equals the distance between the layer and the camera.

               

              The variable z is set to the camera's zoom value.

               

              Now we can calculate the ratio (variable r) by dividing the distance by the zoom value.

               

              All that is left is to multiply the ratio by the current value of the scale property. As a result, the layer, no matter what the distance from the camera, will always appear to be the same size. This will solve your scale problem. Multiplying the ratio by the value also allows you to set keyframes or adjust the scale of the layer manually and still keep the same apparent size as the camera moves around the comp.

               

              Once you have set this up, select the scale property for the layer and save this setup as an animation preset. Now you'll have it to use any time you need it. I've saved out a couple hundred of these expressions and I use them all the time.

              1 person found this helpful
              • 5. Re: Multiplaning without affecting scale due to the Z axis?
                lasvideo Level 4

                Rick, it would have been helpful if you had first presented the full expression in one line, then broken it down. I find it difficult to follow without the the expression as a whole.

                 

                And honestly, after seeing the detail of your fine explanation, for simplicities sake, I would run out and get one of the to items I mentioned instead of having to remember the expression every time I need to do multiplane stuff  ;-)

                • 6. Re: Multiplaning without affecting scale due to the Z axis?
                  Rick Gerard Adobe Community Professional & MVP
                  Rick, it would have been helpful if you had first presented the full expression in one line, then broken it down. I find it difficult to follow without the the expression as a whole.

                   

                  You don't usually write expressions on one line. Complex expressions become impossible to troubleshoot or check for typeos if you put everything on one line. Just as in HTML, Java, or any other kind of code, nicely laid out code is easier to work on.

                   

                  While

                   

                  C = thisComp.layer("Camera 1"); L = thisLayer; CP = fromWorld(C.toWorld([0,0,0])); LP = fromWorld(L.toWorld(anchorPoint)); d = length(CP, LP); z = C.zoom; r = d/z r * value

                   

                  would work, it's very difficult to read or troubleshoot. BTW, I did notice that I missed a ; at the end of the L= thisLayer line.

                   

                  Saving the expression as an animation preset is just as easy as running a script or applying a plug-in. I've got about 200 effects presets that I keep in my library. Most contain expressions. Some use several plug-ins. Eight out of ten of my projects use at least one preset that I've written. This one is an old standby that is used in about half of my 3D comps.

                   

                  And honestly, after seeing the detail of your fine explanation, for simplicities sake, I would run out and get one of the to items I mentioned instead of having to remember the expression every time I need to do multiplane stuff  ;-)

                  Note the last line in my post... Even though I'm pretty good at expressions, there's no sense in rewriting something I've already done.

                   

                  Just in case you'd like to start a collection of custom presets here's this one. Enjoy.

                  • 7. Re: Multiplaning without affecting scale due to the Z axis?
                    lasvideo Level 4

                    Ric, I am in awe of your facility with expressions. And sites like AE Scripts are a treasure house of useful things for AE. But I must admit, I get slightly naseous when I gaze on the raw expressions. Must be my Math Allergy kicking in  ;-)

                    • 8. Re: Multiplaning without affecting scale due to the Z axis?
                      Rick Gerard Adobe Community Professional & MVP

                      I've taught a bunch of folks how to do expressions. It's a lot more straightforward than PHP or MySQL programming.

                       

                      I highly recommend that you play around with expressions for just a bit. Most of it is just declaring variables and doing simple fourth grade math. Almost all of the methods are available right from within AE. There's really very little to memorize.

                      • 9. Re: Multiplaning without affecting scale due to the Z axis?
                        lasvideo Level 4

                        I have dipped my toe in the water with wiggles and using Pick Whips. But I will religate anything more to those that relish it.

                        • 10. Re: Multiplaning without affecting scale due to the Z axis?
                          DanR123

                          that's a great script Rick, thanks a ton!

                           

                          I'm amazed at what people come up with using expressions

                          • 11. Re: Multiplaning without affecting scale due to the Z axis?
                            DanR123 Level 1

                            Rick, any quick fix if I have extremly wide (3000px wide or more) images? I want to have a pan with near and far elements

                             

                            I can crank up the focal length or cut up the layers, but was wondering if there was something other than the layers anchor point for postioning I could use in the expression?

                            • 12. Re: Multiplaning without affecting scale due to the Z axis?
                              philament

                              Rick, this is a great expression and i appreciate the detail you added in explaining it. hoping you might be able to explain something about using the camera to zoom in to the objects.

                               

                              i put two squares in a comp, set up a 50mm camera and zoomed past them. when i added your expression to the squares, however, instead of zooming past them, they went almost directly sideways out of the comp window. i switched off the expression and they came toward the camera again.

                               

                              any idea what might cause that behaviour?

                              • 13. Re: Multiplaning without affecting scale due to the Z axis?
                                Dave LaRonde Level 6

                                It only takes experienced AE practitioners three times as long to work in 3D than 2D.  Chris Meyer, an extremely well-known AE artist, jokes that this truth is the reason why there's a "3" in "3D"

                                 

                                Think about the way the Disney animators created Mickey Mouse cartoons.  They stacked cel on top of cel.  You can do the same thing by stacking 2D layers, and fake any depth of field issues by adding the proper kind of blur to the appropriate layer.

                                 

                                Who says you have to do this in 3D?  

                                • 14. Re: Multiplaning without affecting scale due to the Z axis?
                                  Rick Gerard Adobe Community Professional & MVP

                                  The expression keeps the items the same apparent size in the frame but it doesn't control position or orientation. The layers went to the side because the camera was not moving directly to their anchor points or the layers were set to orient towards camera. Take a look at the move in the top view or left view and you'll see the camera still moving past the cameras.

                                   

                                  The purpose of this kind of an expression is to fake a background not to move in on a layer. With the layer set to orient towards camera and the camera pointed directly at the anchor point of the layer a 3D layer will act like a 2D layer. If you were to use this to create a distant horizon and then put your other 3D elements in the scene you could move around without loosing the background.

                                   

                                  I hope that explanation makes sense.

                                  • 15. Re: Multiplaning without affecting scale due to the Z axis?
                                    Cris is Bliss Level 1

                                    I haven't used the expression yet, but shouldn't there be a semi-colon after the r = d/z

                                    • 16. Re: Multiplaning without affecting scale due to the Z axis?
                                      Rick Gerard Adobe Community Professional & MVP

                                      Cris said "

                                       

                                      I haven't used the expression yet, but shouldn't there be a semi-colon after the r = d/z"

                                       

                                      and the answer is yes. I typed that expression from scratch so I missed a little punctuation. I also provided a link to an effects preset that contains the expression.

                                       

                                      Here it is again. I would highly recommend that you save your expressions as effects presets. Build yourself a library of things that you'll use again and again. It will save you a lot of time. I have more than 200...