10 Replies Latest reply on Apr 20, 2010 7:48 AM by Rick Gerard

    Problem with rotating a 3D Precomp

    Blue_Devil1 Level 2

      I have a comp  with layers

      1.  Video layer - 3D switch on

      2.  Solid color layer - 3D switch on

       

      I want to rotate both layers on Y axis so when they get past 90 degrees, the solid layer shows up and the video layer is no longer seen.

       

      I precomped the comp  and turned on collapse transformation, and made the precomp 3D.  However, when I rotate the precomp on Y axis, when I get past 90 degrees, the video layer shows up but is reversed.and the solid layer remains behind the video layer instead of covering it. 

       

      I was thinking of using a second solid in front of the video layer set at 90 degrees to start, since it would be invisible initially, but I want the whole comp to rotate and move along a motion path, so I can't figure out how to link the two solid layers so during the Y rotation, layer 2 would stop at 90 degrees when the front layer started moving, and vice versa .

       

      Sorry if I didn't explain it well.  Is there another way to create the effect of the precomp rotating so a solid layer would appear to cover the video once it rotated past 90 degrees?  Perhaps some sort of complex expression?

       

      Thanks in advance.

       

      John Rich

        • 1. Re: Problem with rotating a 3D Precomp
          BlackCalvus

          So if I understand correctly you have a video layer and a solid parallell with each other, but slightly apart on the z axis.  And the idea is to rotate them around so you see the video from one side and the solid from the other?

           

          Your problem is that when you rotate them both they each rotate on their own axis.  So the video layer remains in front of the solid layer.

           

          To fix this place a null in between the two layers, parent both objects to the null, and rotate the null instead.  This way the two layers rotate around the null rather than around themselves.

           

          If you switch your camera to the Top view you can more easilly see what's going wrong.

           

          Hope this helps.

           

          Jon Bagge

          Editor, London, UK

          • 2. Re: Problem with rotating a 3D Precomp
            Mylenium Most Valuable Participant

            As Jon said, parent them. You don't even need a Null, you can directly parent one layer to the other, then only rotate the parent layer.

             

            Mylenium

            • 3. Re: Problem with rotating a 3D Precomp
              Blue_Devil1 Level 2

              Thanks for the help.  I had a hard time explaining what I had in mind, so I took the liberty of making this screen capture.  I guess I had a hard time figuring out why the back layer didn't show up when the whole comp was rotated and if there was some way to fix that other than just put another layer out front of the comp?  If you guys have time to look at this I would appreciate it.

              Thanks in advance.

              John Rich

               

              http://vimeo.com/10956366

              • 4. Re: Problem with rotating a 3D Precomp
                Mylenium Most Valuable Participant

                Mmh, I still don't fully understand your problem, as this is one of those usually easy things that just should work. The one question that lingers in my mind after seeing your video is whether you are using layer styles in any way, e.g. the bevel on the frames. If that really is the case, then it would explain the problems - layer styles break 3D rendering order. The fix then would be to add another level of pre-comping. It should look like this:

                 

                - main menu comp, contains cards with collapse transformations

                --- card front + back

                ------- card front with layer styles

                 

                If you obey this hierarchy, you should have no problems getting the effect you want. Let us know if it works.

                 

                Mylenium

                • 5. Re: Problem with rotating a 3D Precomp
                  BlackCalvus Level 1

                  Layer styles inside the precomp will break it, but not in the main comp (I just tried).

                   

                  I can't tell from your video, but are the layers inside the precomp actually placed differently in z space? When you turn on the 3D switch layer order is ignored, but if they're in the same location in z space it will use layer order (or sometimes weird stuff happens).

                   

                  So if you rotate them around in the main comp and they're in the same location, you'll just see the top layer no matter what.

                   

                  Jon Bagge

                  Editor, London, UK

                  • 6. Re: Problem with rotating a 3D Precomp
                    Blue_Devil1 Level 2

                    Guys,

                    Thanks for looking at the video.

                    Millinium, I had applied bevel and emboss to two layers "Background and Frame" in Photoshop, but no effects in AE.  I went back and took off the BandE  and reopened in AE, but it still "does it".  I also precomposed both layers inside the secondary comps, but again no joy.

                     

                    Jon,

                    All layers in both buttons' precomps are in the same Z space.  I actually tried moving the back layer (Background), back in Z space, but for some reason the screen and frame still show when the whole button ie precomp in the main menu is rotated.

                     

                    However, I just precomped the bottom layer (Background) AND moved it a couple of pixels in Z space behind the rest of the layers, and even though it still it has the bevel and emboss applied, it now behaves like I think it should.  That is when it rotates to the back you see the back layer and not the front of the layers as it was doing before.  Wierd.  I know you're busy, but since I'm pretty much of a novice, it would be great to have a pro confirm this.  Perhaps there is some mathematical reason.

                    Anyway, you guys were great.  Thanks.

                    John Rich

                    • 7. Re: Problem with rotating a 3D Precomp
                      Rick Gerard Adobe Community Professional & MVP

                      The easiest way to make a layer invisible when it is not facing the camera is by using an expression. Layer space transformations can be used to determine whether a layer is facing the camera. Rather than getting into the math let me go through the procedure for making this work.

                       

                      1. Set up a composition with the card front and back at the default positions.
                      2. Make both Front and Back layers 3D.
                      3. Parent the Back layer to the Front layer
                      4. Rotate the back layer 180º
                      5. Add the following expression to the Opacity property of each layer
                        1. if (toCompVec([0, 0, 1])[2] > 0 ) value else 0
                          
                      6. Now animate the Front layer Y rotation property

                      As you rotate the front layer it will stay visible until it becomes perpindicular to the camera, then the back layer becomes visible. The back layer be visible only when it is facing the camera.

                       

                      If you want to pre-compose the carl layers into a card comp this will still work as long as you rotate the card layers in the pre-comp and not in the main composition. You could add a null to the main composition, rename it CardControler, Add an Expression Control > Angle controller to the null, Rename the Angle Control to "Angle Control 1",then add the following expression to the Card Front Rotation property:

                      comp("Main").layer("CardController").effect("Angle Control 1")("Angle")
                      
                      

                      You can add as many Card Pre-comps as you like and as many Angle Controllers. Just rename each angle controller to a different number. This will allow you to keep all of your keyframes inside the main composition.

                       

                      I know this seems a little complicated. To make things easier to understand I've put up a CS3 sample comp here.

                      • 8. Re: Problem with rotating a 3D Precomp
                        Blue_Devil1 Level 2

                        Rick,

                        I really appreciate your taking the time to explain that so thoroughly.  I'm still trying to work through it (I feel like I got a tutorial from Stephen Hawking).

                         

                        I re-looked at the ideas of Mylinium and Jon and came up with something I can use in the meantime.  I made a mistake above so I'll just recapitulate here what I finally decided to use for now.

                        As long as there are no layer styles (either Photoshop or AE)  applied to any layers in the button precomps , all I have to do to make the back layer show up when I rotate the precomp in the main comp is to go into the precomp, select the bottom layer and in the top view hit the UP arrow key once and the bottom layer is moved behind the others.  Then when I rotate the precomp in the main comp, the back layer shows up at the appropriate time.

                         

                        However, if layer styles are applied to any layers in the precomp, each layer has to be precomped and the back layer has to be moved back in Z space one pixel to make it work.

                         

                        Thanks again to all for your help.

                         

                        John Rich

                        • 9. Re: Problem with rotating a 3D Precomp
                          Rick Gerard Adobe Community Professional & MVP

                          The expression I gave you will do the switching for you and eliminate the need to rasterize your layer effects.

                           

                          I made up another sample composition that uses a Photoshop file (included) which has layer styles applied. In this sample comp I start with the card back to the camera. After making all layers 3D the card front is parented to the card back, the card front is rotated 180º in Y and position and rotation keyframes are added only to the card back layers.

                           

                          Check out the CARDS2.ZIP file for a CS3 project that shows a much simpler way to accomplish your animation, preserve layer styles, and make animation easier. No Pre-comps, the freedom to animate both the cards and the camera, and no worries about offsetting layers in Z space. 

                           

                          Here's the expression for opacity in case you need it:

                          if (toCompVec([0, 0, 1])[2] > 0 ) value else 0
                          

                          • 10. Re: Problem with rotating a 3D Precomp
                            Rick Gerard Adobe Community Professional & MVP

                            I should probably clear up the composition structure for the Cards2 project file. The original Photoshop file had layer effects applied but when I imported the file as a comp I chose to convert those effects to Editable Layer Effects in AE. This means that changing the effect in Photoshop will not make any changes in the AE project's composition. If you wish to modify the layer effects you must do that in the AE Timeline by revealing the Layer Effects property.

                             

                            The example was only intended as a demo of the technique, not as a template. There may be problems with motion judder and/or display issues in this sample. Layer styles may also break the 3D rendering order if not applied correctly. Also, not all Photoshop layer effects make it into a CS3 comp. Many are not supported. It would probably be a better practice to not import the PSD file with editable layer styes. This will eliminate many potential rendering order errors.

                             

                            I hope this clears up any problems you may be having with the sample comp or understanding the process. One last thing, it's always best to turn on motion blur for any layers that are moving. Rotation without motion blur enabled can look especially funky.