Lightning Fast Animation in Element 3D (2014)
Chapter 7. Particle Replicator
Now that we've seen the limitations of Element 3D, let's take a look at its greatest strength. Element 3D was originally designed to work with 3D particles to create very cool and sometimes, really abstract imagery.
Let's say we got really lucky and Apple hired us to do an iPhone ad; but we needed to have it done, like, today. It's pretty easy with Element 3D. First, there just happens to be a free iPhone 5 model for E3D available on Video Copilot's websitehttp://video9.videocopilot.net/efc5e19e65fe9ca2cbd9818d45ac92a1/videotutorials/projects/134.zip. First things first:
1. Go get this model and install it in your E3D content directory (the same place we created the BookModels directory previously).
2. Now, create a new project (1080p, 29.97) and create a new solid layer (named Element001).
3. Load up the iPhone in Group 1 of an Element plugin.
4. Finally, create a camera with all the goodies just as we did before.
Your scene should look like the following screenshot:
Just to make things interesting, let's load in some music. If you've downloaded the content, look in the sound directory for iPhoneSong.wav. It's just something we whipped up in Pro Tools (the Pro Tools project is included in case you want to play with it). Now we have something to make our phones dance to.
Replicating the iPhone
We want a whole troop of dancing iPhones, so let's replicate it by performing the following steps:
1. In the Particle Replicator section for Group 1, change the Replicator Shape to Ring.
2. Also, set the Particle Count to 8. The replicator shape can give you very different results. For instance, setting the shape to Sphere makes a ball of iPhones, and so on. We're using Ring for now to keep things simple, but things will get more interesting later.
3. Turn down your Particle Size in the Particle Look setting to 7.03.
4. Let's also set up the camera with a point of interest in the center of the iPhones (using the methods taught earlier).
5. Turn on ambient occlusion and a single point light.
The result should look like the following screenshot:
Animating to the beat
We've inserted our music into the composition. Let's create markers for every beat of the song on the main timeline. Preview the audio with ".", and as the beat sounds, hit "*" (both on the number pad). Then, mark major changes in the music on the music track itself as shown in the following screenshot. This will give us a good reference to time when we want things to happen.
Creating a video screen
We can use an AEX layer as a texture. So, create a 30-second movie (I created one in the sample composition named Comp 1) and bring it into our main composition on layer 1. Make sure you make it invisible (by clicking the eye ball on the left side of the layer window). For best results, set it to 640 x 1152 pixels. This will fit perfectly on the iPhone screen. For mine, I used screenshots and made mock-ups of certain screens (for example, FaceTime and the video camera).
Just so we have it, create an ElementBG layer and load in your Environment object from the Starter Pack. Size it up so that it envelops the whole scene with a lot left over. This is now our spherical backdrop.
1. On your Element001 layer, in the effect controls, go to Custom Layers and then Custom Texture Maps.
2. On Layer 1, select the composition layer for the movie you created.
3. Now, go into your Scene Setup, and as we did in the texturing section of this book, select the texture for the screen and replace the imagemap with your custom Layer 1.
Now your movie plays on the screen of your iPhone. You can use this method to put any composition or layer on any texture. You can see the result in the following screenshot:
Moving them around
Since our music is set at 120 bpm (beats per minute), it makes things easy (one beat every 0.5 seconds). Whenever possible, if syncing to music, try to use music that is easily divisible by your time. All we really have to remember is to make keys either on :00 or :15.
Since our Element001 layer is set perfectly, duplicate it, turn off the original (click on the eyeball), and lock it just in case, as we don't want to recreate everything from scratch. Now we're working with Element002.
Advanced animating ("morphing")
The Animation Engine (as we're about to use it) is really kind of a particle-morphing engine. With only two keyframes (and a few parameter adjustments), you can animate unlimited numbers of particles. If you use your imagination (for example, maybe use expressions with audio levels), you could create automated animations that will dazzle any psychedelic flashback imaginable as follows:
1. Firstly, you will need to get into your Scene Setup and put the iPhone on both group 1 and group 2 (as shown in the following screenshot).
2. Copy and paste the properties (using Group Utilities) from group 1 to group 2.
3. On group 2, in Particle Look, you'll see Particle Rotation. In the Y Rotation Particle, enter the value 180.
4. Now you have one group of iPhones facing outwards and one group facing inwards.
They should be on top of each other, so it will really look like there are eight iPhones that are double sided. Don't worry, that will get fixed in the next step. What we've just done is created an original and a target. One group is how the iPhones will start, and the other group is what they'll morph into. They'll morph by changing whatever parameter has been changed as if it were keyframed and tweened on a per object basis.
Here we go…
1. In the Animation Engine twirly, tick the box that says Enable. You should see group 2 disappear. We're going to reverse things a bit though.
2. We want to start with the Apple logo facing outwards and make the iPhones spin around one by one. So, on the drop down that says Start Group (under Group Selection), select group 2, and under Finish Group, select group 1. Now you should see the phones flip around.
3. Here's where things get fun. Under Animation Type, select Shape Order. This will now make the phones flip around one by one in a clockwise order.
4. Move your time slider to 4:00 and set a keyframe on the Animation parameter.
5. Now, move the slider to 8:00 and change the Animation value to 100 percent. Again, the phones have flipped around.
If you move your slider back and forth, you'll see the phones spinning around, but they're not spinning one by one. Their motions overlap. This has to do with the Smoothness attribute.
6. Turn the Smoothness down to 0.
Now you can see why we made eight phones. Across 4 seconds (2 bars of music), there are 8 beats. With the smoothness turned down, a phone flips around on every beat of the music! The result should look something like the following screenshot:
By creating these morph targets and changing how we animate (from Shape Order, Uniform, to Directional, and so on), we can make very interesting particle array-based animations that look like geometric kaleidoscopes. But now that we've done it once, how do we keep doing it? Easy…
Repeat the process
Move your time slider to 8:00 (the last keyframe). Split the layer (Ctrl + Shift + D). Now, you have a choice. You can keep animating as group 2, starting and then morphing to group 1, or reverse the order. Either way, you need your first keyframe to be the same as the last keyframe from Element002.
Method for keeping the order
If we keep the order, we need to move both keyframes down the timeline. Snap them to the beginning of Element003. Now, we need to make group 2 a duplicate of group 1 (because our ending point for the last transformation needs to be our beginning point for the next). So, copy all of the group settings from group 1 (using Group Utility) and paste them to group 2.
Move your time slider to 12:00, and move the "animation" key that is set at 100 percent to this position. Now, you can transform group 2 to your liking. Check your work using the time slider to scrub back and forth. Make sure the iPhones aren't traveling through each other. I made the phones flop to landscape to show the video camera application.
Method for reversing the order
This is the easier method. You can keep the keyframe at the beginning of Element003 right where it is, and move the other keyframe (earlier in the timeline than this layer actually appears) out to where you want this transformation to end (12:00). Then, just changeStart Group to Group 1 and the Finish Group to Group 2. Now, all you have to do is edit group 2. The result should look like the following screenshot:
Rinse and repeat
Repeat this process (using either method) for the length of the timeline. Every time you want a transformation, make a spliced clip, move the keyframes, and then transform a group. You may even try a pulsing transformation (several keyframes on the Animationparameter to make the objects pulse). You can then animate the camera to make some interesting moves (maybe orbit while the transformations are taking place). Try other methods also (Directional, Uniform, and so on). Play around. You get to be uber creative here! Don't forget to use the motion graph to control the motion of your camera. Make it cool. Your final timeline should look something like the following screenshot:
Making the background cooler
We can use similar techniques to make the background really cool. Select the ElementBG layer. Reset the Element plugin so that we can start from scratch. We're going to be using tons and tons of objects to construct the environment sphere. So, let's choose a low polygon object.
1. In Scene Setup, assign Sphere_Low to group 1.
2. Also, apply the "chrome" surface to it.
3. Turn the diffusion color to a 50 percent gray with 1.25 diffusion.
4. Also, change the reflectivity to 162 percent with a Fresnel of -0.84 with a bias of 1. This will let the object take on some color attributes and still stay reflective.
5. Now, in the particle replicator, make the particle count 10000 (like I said, tons and tons).
6. Use a replicator shape of the sphere. We're going to make the environment sphere a bunch of balls! And guess what? They'll react to the music!
7. Scale the shape up to 142.80 and scale the particles down to 4.79.
8. Finally, make the color tint pure white and turn on the ambient occlusion with an intensity of 9.5.
9. In Render Settings, enable glow from Luminance with an intensity of 2.1 and radius of 1.4.
The result should look like the following screenshot:
Having the background react to audio
In the downloadable content, you'll find an audio file called iPhoneSong-Drums.wav. This is really just the bass drum with some effects so that it has a taper on its intensity. We'll use this to create an expression to animate our background.
1. Import iPhoneSong-Drums.wav and place it in the timeline. Be sure to turn off this layer's audio (by clicking on the little speaker). We want this file used but not heard on output.
2. Right-click on the new audio layer and select Keyframe Assistant and then select Convert Audio to Keyframes. This will create a new layer with three effects in it. The new layer is named Audio Amplitude. The effect we'll be using to drive our expression is the Both Channels expression. This effect essentially just has a value that corresponds to the amplitude of the audio file we generated from keyframed on every frame of video. Cool eh?
The result is what you see in the following screenshot:
Now, under the ElementBG layer's Element effect, create an expression on the Scatter parameter. It should read as follows:
thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")/2
This expression takes the Both Channels slider, divides the value in half, and assigns it to the Scatter parameter. Now, on the Surface Offset parameter (two items above the Scatter parameter), use the following expression:
This expression ties the surface offset to the Scatter parameter's value. There we have a cool background!
Finally, add the following expression to the "Glow" "Intensity":
thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")/2
This method can be used for any parameter and any effect. You can use audio to control all kinds of cool stuff in AEX.
Finally, let's change the comp's background color to white and turn on the depth of field. The result should look like the following screenshot:
In this chapter, we learned the basics of the particle replicator. We used the advanced Animation Engine to animate a real-world object. We also used advanced texturing techniques to place a movie on an iPhone screen. Finally, we used expressions to drive keyframes based on audio. All of this to create one great iPhone ad! Not bad for just a few hours, eh?
In the next chapter, we're going to learn how to optimize our scenes for performance, and get to know what affects performance, and what to look out for. There are some simple tricks that can keep your render times reasonable and some simple mistakes that can make rendering times ludicrously long.