|"Yikes! Please oh please, not a Particle Playground tutorial. That thingy makes the insides of my head go all wobbly and gooey."
There is no doubt that Particle Playground is one of the more difficult plug-ins to use. But be brave folks, the rewards are aplenty and with some gung-ho attitude and a guiding hand you should be able to create some decent stuff. Right now, just sit in for a comfortable ride. I'm sure that this tutorial won't hurt your head - too much.
At the end of this tutorial, you will be able to create Property Maps to control the movement and size of particles. You will have a firm understanding on Layer Maps and the different ways of preparing footage and applying it as a Layer Map. You will learn how to use the Repel parameter to create Collision Detection and how to use Kinetic Friction to create 'sticky particles'.
This tutorial is an attempt to create a simple game using Particle Playground. The objective is to have as many balls as possible stick to an icon situated at the top of the Composition Window. We will be shooting off a few particles using Particle Playground's Cannon and we will also create a few obstacles for the particles using Particle Playground's Grid System.
To begin, create a new AE project and import the two files, "CannonBall.psd" and "RedBall.psd". Download above where it says "Project file" if you haven't already.
Let's start off by concentrating on the use of Layer Maps. As you may now know, Particle Playground's default particles are square pixels. Within Particle Playground itself, you can change the default particles to text. The only way to have an image or a movie to be used as particles is by using the Layer Map option.
I've supplied a little Red Ball to be used as the source for our Layer Map. We will change the color of the ball using keyframes on Hue and we will also add numbers on top of our ball so that we can have a more vibrant look and feel to the entire sequence. The numbering is also an excellent way to get you to understand the Time Offset parameter that exists within the Layer Map option.
Begin by importing the images, "RedBall.psd" and "CannonBall.psd" into a new project in AE. Drag the Red Ball on top of the New Comp icon in the Project Window to create a new composition. Ensure that the Composition's duration is 60 seconds and name it "RedBall 4 Grid Comp".
Now, create a New Solid and name it "Numbers". Apply the Numbers plug-in, Effect -> Text -> Numbers with the following settings as seen in image below:
Depending on the font that you use, the optimal font size and Tracking values may differ. I've used the Impact font for this tutorial.
Create a keyframe for Value Offset at time = 0 with a value of 1. Create another keyframe for Value Offset at time = 60 Seconds with a value of 1801. This will ensure that each frame will increase the Number value by exactly 1 for the duration of the composition. Precompose the Numbers layer, CTRL+SHIFT+C, and select the option, "Move all attributes into New Composition"<. Name the PreComposition "Numbers PreComp". Now, create a Mask to block out the leading zero from the "Numbers PreComp" Layer. You may have to tweak the position of the layer to align it to the center of the ball.
With "RedBall.psd" selected, apply Effect -> Adjust -> Hue/Saturation. Create a keyframe for Hue at time = 0 at the default setting. Goto the end of our composition at frame 59.29 and create another keyframe with a setting of 6 full revolutions. Select both keyframes and apply Window -> The Wiggler with the settings as shown in image below:
This setting will ensure that the color of the ball changes once every three frames.
Perform a Ram Preview by pressing 0 on the Alphanumeric Keypad. You should see the colors of the ball change and the numbers cycle from 0000 at the beginning of the composition to 1800 at the end. That's it for now. We have just created a Precomposition that we will use for the Layer Map option for our Grid in Particle Playground.
We will use image "CannonBall.psd" as a Layer Map for the Cannon.
Now let's get on with the fun stuff.
Create a new 20-second long Composition at 480 x 600 pixels. Name it Final Comp. Create a new layer and name it "PP Ball Grid" then select Effect -> Simulation -> Particle Playground.
By default, Particle Playground's Cannon is "On" as denoted by Particles per Second while the Grid is switched "Off" as denoted by the Particles Across and Particles Down parameters. Let's switch off the Cannon by setting the Particles Per Second parameter to 0. Within the Grid parameter, create a keyframe for Particle Radius at time = 0 at its default setting of 2. Now create a second keyframe at time = 1 frame with a setting of 0. Select both keyframes and change their interpolation method to Hold, CTRL+ALT+H. Now set the rest of the Grid settings as shown:
With a setting of 0 at frame one we have told Particle Playground to stop producing particles after frame 1. This procedure precludes Particle Playground from creating new particles for each and every successive frame. Now let's switch of Gravity by setting its Force to 0.
Move the Timeline Indicator to time = 0. Your composition should resemble that of the image below:
Let's replace the default particles with the Precomposition, "RedBall 4 Grid Comp" that we created earlier on. Drag and drop "RedBall 4 Grid Comp" from the Project Window into the Final Comp composition. Switch of this layer's visibility with the key combination CTRL+ALT+SHIFT+V.
Select layer "PP Ball Grid" and press "F3" to access the Effects Window. Under the Layer Map option, select "RedBall 4 Grid Comp" to be used as a Layer Map. Set Time Offset Type to Absolute and Time Offset to 1. Time Offset is measured in seconds.
What we have just done is to tell Particle Playground to replace the default particles with images taken from a precomposition and to select each image for the Grid (which starts from the top left-hand corner and works its way across and down from left to right, top to bottom. Your composition should resemble the following image:
Notice that the number on each subsequent instance of the particle (ball) increases by a value of 30. The Time Offset setting of 1 second ensures such a situation. Try setting Time Offset to 10 frames; Type in the following in the Time Offset parameter, 10/30.
For a five-frame offset, type in 5/30. Notice how the numbers increase from one particle to the next with each Time Offset setting.
Advance the Timeline Indicator to frame 1. Notice that nothing changes in our composition window. This is so because we selected Absolute as the Time Offset Type. With this setting, the Grid System picks up images from the Layer Map precomposition without updating the images in subsequent frames.
Now let's switch Time Offset Type to Relative with a setting of 1 second, see image below:
Ensure that you are at time = 0. You'll notice that the Composition Window looks identical to what we had with the Absolute setting. But forward to frame 1 on the Timeline and you will notice that the number on each of the balls have incremented by a value of 1, see the following image:
Goto frame 2 and you should notice a similar increment.
You should keep in mind that Layer Map picks up the first frame of its source movie that is the same as it's starting point. In our example, frame 1 of the precomposition used as a Layer Map was sampled because it matched the starting frame number of our Particle Playground layer. If we wanted our particles in the Grid to start from frame 30 of our source then we would have to shift the in-point of our precomposition to frame 29.
Do not perform the steps contained within this paragraph for now but just have a look at the images provided. Take a look at image below:
Notice that the in-point for both the Number's layer and the "RedBalls.psd" layer are now set to -29 frames. Correspondingly, take a look at the next image:
Look at what the Grid looks like with the offset that we've applied to the source. Notice that the first particle now starts with number 30 and not 1. With that done, let's take a look at Time Offset Type, Absolute Random. Notice that Time Offset now reads as Random Time Max instead of Time Offset. Leave this at 1 second and notice the changes that take place in the Composition Window. What Absolute Random does is to pick the images to use as particles from the source precomposition based on the Random Time Max. These images are placed at random, onto the Grid. With a Random Time Max setting of 1 second, only images in the first 30 frames are sampled. With a Random Time Max setting of 40 seconds, we can have a larger number of frames to sample, as evidenced by the larger numbers seen in the next image:
Advance the Timeline Indicator to frame 1 and you'll notice that there is no change in any of the number on the balls.
Now, back to the hands-on bits. Set Random Time Max to 1 second. Let's take a look at the Time Offset Type, Relative Random. Notice that this is similar to Absolute Random in that the particles are sampled from the first 30 frames (1 second) of our source, see image below:
The difference is that the each particle will advance by one frame in accordance with a similar increment along the timeline of the Particle Playground composition, see image below:
This is a snapshot of the Composition Window at time = 1 frame.
Whew! Now that wasn't too difficult was it? You should now have a decent understanding of how to use the Layer Map option in Particle Playground.
End of Part 1.
We will now move on to creating the obstacles for our game by making a few of our particles within the Grid repel against particles shot off from the Canon. We will also use a Selection Map to switch off a few particles in our grid so that we can have a customized look to our grid.
To speed up our workflow, let's set the Time Offset Type to Absolute as this renders the fastest amongst the four options that we have. Set Time Offset to 0 as this is the fastest setting. Your composition Window should look identical to the image below:
Let's render a frame from our Composition Window which we will then use as a guide as we create a grayscale image to be used with the Property Mapper options. Since a Selection Map only reads grayscale values, we'll only need to render the Alpha Channel of the Composition Window. Press the key combination, ALT+CTRL+S to render out a single frame.
Within the Render Queue Window, Under Output Module Type, select Alpha Only, see image below:
Within the Output Module Settings Window ensure that you set Post Render Options to Import and that you select Photoshop Sequence as the output Format, see the following image:
Set the name of the file to "Guide4_SelectionMaps.psd" and render away.
When the render is done, double-click the "Guide4_SelectionMaps.psd" comp icon which should reside in your Project Window. Now create a few rectangular masks so that your comp window looks like the next image:
Pressing the key combo ALT+4 will allow you to have a look at your composition's Alpha Channel. Doing so, you will notice that your Alpha Channel looks like the image below:
What we want is a clean Alpha Channel that is fully opaque. Adobe After Effects will automatically create a fully opaque Alpha Channel for any imported footage that doesn't have an embedded Alpha Channel. Therefore, all we need is to render a single frame of this composition without an Alpha Channel. Don't forget to set the Post Render Option to Import the file. Name this file "Map_4Scale.psd".
From the Project Window, select the newly rendered file, "Map_4Scale.psd", and "CTRL+/" this clip to place it in the Timeline of "Final Comp". Ensure that it starts at time = 0 and switch off its visibility, CTRL+SHIFT+ALT+V. Select layer, "PP Ball Grid", then press F3 to access the layer's Effects Window. Under Persistent Property Mapper, you will see a parameter named, Use Layer As Map. Select the clip "Map_4Scale.psd". For "Map Green To", set it to Scale with a minimum setting of 0 and a maximum setting of 1, see image below:
With our customized Grid in place, we will now work on the Cannon and applying collision detection to the particles that form our customized Grid.
Drag and drop clip, CannonBall.psd from the Project Window onto the Timeline and switch off its visibility. We will use this clip as our Layer Map. Create a new Layer and name it, "PP Ball Canon". Ensure that this new layer is below layer "PP Ball Grid" in the Timeline Window. Apply Particle Playground to this layer. Create a keyframe for Particles Per Second under Cannon at time = 0 to 30. Create a keyframe for Particle Radius under Grid at its default setting of 2. Advance to frame on the Timeline Indicator to frame 1 and create another keyframe for Particle Radius with a setting of 0. Advance to frame 5 on the Timeline and set a keyframe for Particles per Second to 0. Select all four keyframes and convert them to Hold Keyframes, ALT+H. Take a look at image below for the other settings for Cannon and Grid.
Remember to set the Layer Map to CannonBall.psd. Switch off Gravity for this layer with a setting of 0 for Force.
We will now go about with the settings that will make the Cannon particles collide with the obstacles (Grid) that we created earlier. We will also create a Wall around the perimeter of our Composition Window so that the Cannon particles will bounce off the wall and not disappear into 'deep space'. With the "PP Ball Cannon" layer selected, simply Double Click the Marquee Lasso tool in the Toolbox Window. Select the Pen Tool, or press "G" to switch to the Pen tool and add a mask point to the rectangular mask. Take a look at the image below to see where it is that you need to add this point.
Take a look at the next image to have a look at the settings for the Repel option.
What we have done here is to set the Grid particles as repellers which will only affect particles from the Cannon. Further only Grid particles that are within the Selection Map act as repellers.
Now let's work on the two Property Mappers. Take a look at the image below for a view of the required settings.
Using the Affects option, we've used the Persistent Property Mapper to only affect particles from the Cannon and the Ephemeral Property Mapper to only affect particles from the Grid. For now, we've used the Ephemeral Property Mapper to affect the scale of the Grid's particles. Notice that we've thus far only used one Map, or grayscale image throughout the entire exercise. This actually shows how intricate and powerful Particle Playground truly is as we have been able to build a rather complex relationship between the Cannon and Grid's using nothing more than a single grayscale image.
Now render the Composition to see how the collision detection works.
That's all there is to it. However, it's not much of a game if there's no objective other than to spray a few balls across the Composition Window that bounce off a few obstacles. It's interesting considering that we're doing it all within AE but being AE dudes and dudettes we need a little more, don't we? ? ;-) To crank up the fun factor, let's add a target for our balls to hit. Not only that, we'll also ensure that the balls stick to the targets when the balls hit their mark.
To do so, we'll need to work on the Kinetic Friction parameter found under the Persistent Property Mapper. Kinetic Friction forces particles to either slow down or to stop moving when they hit a luminance value within a grayscale image used as a Property Mapper.
To spice up our game, let's create a grayscale image which we'll use to control the Kinetic Friction parameter. Before doing so, notice that the two Property Mappers work on the Red, Green and Blue channels independently.
To create an image with independent Red, Green and Blue grayscale channels, we will need to rely on the Set Channels filter which is found under Effect -> Channel. Begin by creating a 20-second long composition at 480x600 pixels. Name it "PersistentProp Comp". Create a white Solid and name it "Kinetic Friction Map". Draw a small rectangular Mask at the very top of the Composition Window, see image below for a little guidance.
Now create a full frame (480x600) black Solid and place it under the "Kinetic Friction Map" layer. Precompose the two layers and name the precomposition, "Kinetic Friction Map PreComp". Drag the "Map_4Scale.psd" from the Project Window into this composition. Switch off the visibility of both these layers. Create a new Solid and apply Effect -> Channel -> Set Channels to this new solid. Set the Red and Green channels to point to "Map_4Scale.psd" and the Blue channel to "Kinetic Friction Map PreComp", see image below:
That's all we need to do for our Property Maps. Let's jump back to the composition, "Final Comp" and nest "PersistentProp Comp" there. Select layer, "PP Ball Cannon" and under the Persistent Property Mapper, change the Use Layer As Map parameter to point to "PersistentProp Comp". Change the option for the Blue Channel to Kinetic Friction and set the Minimum setting to 0 and the Maximum to 0.8.
All we need to do now is to select layer "PP Ball Grid" and change the Layer Map settings to Relative and Time Offset to 1 second. One thing to keep in mind about rendering a Particle Playground composition is that you should render at full resolution. Rendering at a quarter or half resolution will result in a totally different movie from one rendered at full resolution. To save a little on rendering time, you can use the Stretch option within the Output Module Window to stretch (contract) the composition size down to speed up preview-sized renders.
It's now time for some post-render thoughts. A small wish list would include separate Layer Maps for Cannon and Grid. A Property Mapper that includes Offset X and Offset Y values and a wild request for pre-collision and post-collision behaviors. Hmmm, that would be interesting. Additionally, using multiple masks to create a Wall would also be an added bonus. Finally, a Force parameter for the Wall property could also come in handy.
For you, it's a good idea to try and create a customized Wall and to add some eye-candy to decorate the game's layout. See the images below for a couple of examples:
You should also try setting the Cannon particles to repel against each other. Another idea is to use an animated grayscale to switch the Grid particles on and off at different points in time. There are a few more ideas floating around, but this Particle Playground thingy makes my head hurt. ;-)
That's it for now from CreativeCOW, the ideas above should keep you busy for awhile. Thanks for your time and as always, God Bless.
--Roland R. Kahlenberg
Please feel free to discuss this technique in the After Effects forum at Creativecow.net