15 Replies Latest reply on Nov 14, 2014 10:54 AM by nikolaig

    Wind Shake Effect Around Z Axis

    nikolaig Level 1

      I would like to create a "Wind Shake Effect Around Z Axis". I have a image of the leave in vertical position standing on its stem and would like it to have an appearance as if it trembles in the wind.

      I applied Wiggle effect. However it wiggles/distorts in all possible directions but the Z axis. What would be my course of actions/direction to try to emulate a slight rapid shake around the Z axis in the front veiew.

      In other words you look at the leave and see its right edge coming at you and left edge away of you and then in reverse. Pritty much like skewing in 3D with exception of X and Y axis.

       

      I use AE CS6 on Windows.

        • 1. Re: Wind Shake Effect Around Z Axis
          Mylenium Most Valuable Participant

          Limit the wiggle by filtering out its Z component with this simple expression:

           

          seedRandom(index, true)

           

          leafJitter=wiggle(3,30);

           

          leafJitterZ=leafJitter[2];

           

          Mylenium

          • 2. Re: Wind Shake Effect Around Z Axis
            A. Cobb Level 3

            You might have your axes mixed up.  The Z axis of a layer will be perpendicular to the plane of the layer.  If the leaf is oriented with the stem at the bottom of the layer and the tip at the top, based on your description of the desired motion, you might want to wiggle the Y axis. To do this, you can use the wiggler, but I prefer to use an expression like: wiggle(15, 50, 2) What this does is offset the original value of the property (i.e. the value derived solely from its constant value or from the interpolation of its keyframes) using a noise function.  The first parameter (15 in my example) represents the frequency of the largest scale wiggles.  The second parameter (50) represents the maximum amplitude of the wiggle (this is a radius around the resting position, so it can go up to 50 and down to -50).  The third parameter (2) represents the number of "octaves", or different scales of noise which will be combined.  The more octaves, the more turbulent and complex the wiggle will be, with little tiny tremors and big sweeping motions.  1-3 octaves are probably good for most purposes. There are additional optional parameters, but this is likely all you need to start. All that said, a leaf wiggling in the wind will likely wiggle on more than one axis, with a pivot point near the stem, so you might want to try wiggling multiple axes with different amplitudes (but keep the other parameters the same).

            • 3. Re: Wind Shake Effect Around Z Axis
              nikolaig Level 1

              Thank you for your reply.

              Looks like I will need step by step direction as I was not able to successfully implement your suggestion.

              Here is what I tried.

              1. With the Wiggle Gelatin effect applied to my "Leaf" layer and 3D turned on I clicked "P" on the keyboard which opened Position in under layer's "Transform". Holding down "Alt" I pressed stop watch on the Position and entered your code:

                  seedRandom(index, true)

                  leafJitter=wiggle(3,30);

                  leafJitterZ=leafJitter[2];

               

              I got this error message:

                   After Effects warning: Class'Array" has no property or methid named '2'

                  Expression disabled.

               

                  Error occured at line 3.

                  Comp:'shake leave test'

                  Layer:1 ('Green2')

                  Property;'Position'

               

              2. Same as all of the above, but I selected "Position" under "Effects" of the layer and got this error message:

                   After Effects warning: expression result must be of demension 3, not 1

                  Expression disabled.

               

                  Error occured at line 0.

                  Comp:'shake leave test'

                  Layer:1 ('Green2')

                  Property;'Position'

               

              3. I deleted the Wiggle Effect all together and applied you three lines of code ot Position. This produced no results.

               

              Please let me know where I messed up or you need more specific info on my set up?

              • 4. Re: Wind Shake Effect Around Z Axis
                nikolaig Level 1

                Looks like I did mess up my axis. I do want the wiggle happen aroun the Y axis as you pointed it out.

                However I do want the leave to be stationary in X,Y positions and it only transorms in depth slightly rotating around the Y axis.

                I was applying Wiggle gelatin effect.

                After your suggestion I deleted wiggle effect. and put the line of code under Transform/Postition by clicking Positions stop watch and holding the Alt key.

                The result is moke like an earth quake/camera shake effect where the leave shakes on the screen changing its X,Y coordinates.

                I want those not change. I only want the leave to roate toward and away fromthe viewer around its Y axis.

                In other words the change happens in perspective, but not an entire object gets closer/further away froms us. The leave is fixed in its central Y axis and rotates toward/away from us. Not a full rotation but a slight tremble in prespective around the Y axis. X and Y coors do not change.

                Is that possible?

                • 5. Re: Wind Shake Effect Around Z Axis
                  A. Cobb Level 3

                  Sorry, I should have been more specific.  Try applying the expression to the Z Rotation, not position (make sure the layer is set to be a 3D layer, or you won't see this property).  Also make sure your anchor point is set at the stem of the leaf.

                  • 6. Re: Wind Shake Effect Around Z Axis
                    nikolaig Level 1

                    I am a little rusty with AE. I used to work with it and now coming back after a few years. Maybe I am missing some other basic step along the way.

                    This time I have none of the wiggle effect applied. Please confirmed if any of them should/should not be implemented on my layer.

                    I opened "Z Rotation" under "Transform", put the code in, here is the error message I get:

                     

                         After Effects warning: Class'Number" has no property or method named '2'

                        Expression disabled.

                     

                        Error occured at line 3.

                        Comp:'shake leave test ZRotaion'

                        Layer:1 ('Green2')

                        Property: "ZRotation'

                     

                    Here is the code I have from you:

                    seedRandom(index, true)

                    leafJitter=wiggle(3,30);

                    leafJitterZ=leafJitter[2];

                     

                    Just confirm my leaf is trembling in the perspective/depth around its Y axis. No changes are in the X,Y coors. Only leaf's right/left edges are coming in and out to the viewer at trembling effect. Another words changes are happeneing in Z coors around centered Y axis.

                    • 7. Re: Re: Wind Shake Effect Around Z Axis
                      A. Cobb Level 3

                      Sorry my earlier reply above came through as one big chunk of text -- I keep forgetting that this forum strips out carriage returns unless you use the full editor.

                       

                      You only need the wiggle function in this case.  Try just using:

                      wiggle(3,30)


                      The "3" represents wiggles per second (i.e. frequency).  The "30" represents amplitude, or the maximum amount the value will wiggle around the original value (30 means it will wiggle up to +- 30 degrees, in this case).


                      Add the third "octaves" parameter for more complexity in the wiggle:

                      wiggle(3, 30, 2)

                       

                      This will create smaller scale wiggles (half the size of the big wiggle, by default) to give the impression of turbulence.

                      • 8. Re: Re: Wind Shake Effect Around Z Axis
                        A. Cobb Level 3

                        And the reason for the error is that the wiggle function returns a value of the same type as the original value of the property.  So for position or orientation, it will return an array, which is what Mylenium's expression was trying to address.  But for the individual axis rotation properties, the result will just be a number, hence the error.

                        • 9. Re: Wind Shake Effect Around Z Axis
                          nikolaig Level 1

                          O.K.My center of coors is at the bottom of the stem. Leaf shakes and trembles beautifully left to right. It does not go up and down.

                          I wanted it to go forward bakward, i.e. in perspective.

                          How would I apply this effect to affect my leave shape in the depth measurements, leaving X,Y coors intact?

                          • 10. Re: Wind Shake Effect Around Z Axis
                            nikolaig Level 1

                            Unfortunately over my head.

                            Any chance of providing a proper code or suggesting where things should be changed/tweaked?

                            • 11. Re: Wind Shake Effect Around Z Axis
                              nikolaig Level 1

                              Wow! Kindly disregard my previous message. I had to apply your code to Y Rotation which I did not do before. Now it shakes wonderfully!!!

                               

                              Any chance of controllin this shake in ebbs and flows, i.e. it increases and decreases in waves?

                              • 12. Re: Re: Wind Shake Effect Around Z Axis
                                A. Cobb Level 3

                                To control it over time, or to just make it easier to tweak, you can add slider controls to your leaf and link properties like the amplitude, frequency, and octaves to the siders' "Slider" properties.

                                 

                                So, add a couple of Slider Control effects.  Rename them "Wiggle Amount", "Wiggles Per Second", and "Wiggle Complexity" (this is for example, you can name it whatever you like).

                                 

                                Then in change your expression to read:

                                wiggle(effect("Wiggles Per Second")("Slider").value, effect("Wiggle Amount")("Slider").value, effect("Wiggle Complexity")("Slider").value)

                                 

                                Then adjust/keyframe your sliders to control your wiggle.  Just note that animating the wiggles per second over time can lead to unexpected results, since the frequency might not change smoothly.  Amplitude is typically the one you want to animated to make it look like the breeze picks up and drops off.

                                • 13. Re: Wind Shake Effect Around Z Axis
                                  nikolaig Level 1

                                  O.K. I kind of did this code trying to figure it out on my own. Seems to work.

                                  Do you see anything wrong with it or something which will couse problems?

                                  I applied it all on the same layer (i.e. without creating camera and null layers)

                                   

                                   

                                  shakeyCam = effect("Slider Control")("Slider");

                                  wiggle(15, shakeyCam, 5)

                                  • 14. Re: Re: Wind Shake Effect Around Z Axis
                                    A. Cobb Level 3

                                    No, that's exactly right.

                                    • 15. Re: Wind Shake Effect Around Z Axis
                                      nikolaig Level 1


                                      Your One line of code (instead of mine two) works perfectly well too:

                                      wiggle(effect("Wiggles Per Second")("Slider").value, effect("Wiggle Amount")("Slider").value, effect("Wiggle Complexity")("Slider").value)

                                       

                                      Thank you for your help, and I marked you answer as a correct one.