As I cleared in the second post, I was looking for the way connecting animated object to particles node. I found I can make the scene by using Particle Instancing. Although, Instancing is like connecting the master object with particles so I need to animate particles as well. However, it will save a lot of time than animating bunch of butterflies individually. In this post, the focus will be on instancing object with particles first.
Instancing?
An instance is similar to a duplicated object but the difference is, it is not actual object. Let's say you are in a room surrounded by 100 mirrors. If you lift one leg, many of you in the mirror will lift one leg too. But it doesn't mean every you in 100 mirrors are "actual" you.
An instance contains no actual surface information, but is just a redrawn version of an original object. The original object acts like a master to all of its instances like you in the mirror room. Instances will be updated as the original is updated on all shading and surface characteristics.
Instances contain less information than duplicates so they can be handled and redrawn faster.
Particle Instancing
Particle instancing is the process of using the position and behaviour of particles to control the position and behaviour of instanced geometry. Although some complex results can be obtained using particle instancing, it is important not to interpret it as a full-featured behaviour animation system or flocking system. There are no behavioural relationships between the individual instanced elements.
1. Create new scene. Make any fly looking object with polyCylinder and polyPlane, it doesn't need to be descent looking. If you already have a model, use it. I made the model like below, renamed and made a group.
2. Animate and keyframe both wings frame by frame.
Frame 1 : wings down
Frame 2 : wings straight
Frame 3 : wings up
Frame 4 : wings straight
Frame 5 : wings down
3. Select both wings, go to
Window - Animation Editors - Graph Editor.
Set the
Pre-Infinity and
Post-Infinity to
Cycle. It will make the fly flap its wings repeatedly.
4. Select
Particle - Particle Tool - Option box. Set the following.
Particle Name : flyParticles
Conserve : 1
Create Particle Grid : On
Particle Spacing : 12
Placement : With Text Fields
Minimum Corner : -25, 0, -25
Maximum Corner : 25, 0, 25
Click anywhere in the viewport and press
Enter.
5. Add below expressions as creation expression in the
position attribute under Per Particle
Attributes of
flyParticles.
float $randY = rand (-3,3);
float $randXZ = rand (-1, 1);
vector $offset = <<$randXZ , $randY, $randXZ>>;
position = position + $offset;
6. After create the expression,
Rewind the time slider to offset the particles.
7. With theflyParticles selected, select
Solvers - Initial State - Set for Selected.
Delete the creation expression.
8. Select the fly group in the outliner.
Select Particles - Instancer (Replacement) - Option box.
Set Particle Instancer Name to flyInstanced. Make sure the fly is the only listed object
in the Instanced Objects list. Press Create.
9. Select the original fly group and hide it by pressing
Ctrl+h.
10. Open the flyParticlesShape attribute editor. Select Add Dynamic Attributes - General.
Set the following under the New tab and press OK.
Attribute Name : flyScaler
Data Type : Vector
Attribute Type : Per Particle Array
Add Initial State Attribute : ON
11. Right mouse click onto the box next to flyScaler in the Per Particle Attribute,
select Creation Expression. Type following expression and Create.
$rand = rand (0.4, 1.5);
flyScaler = <<$rand, $rand, $rand>>;
12. Select flyParticleShape, expand the Instancer (Geometry Replacement) tab.
Under General Option, Set Scale to flyScale.
13. Delete the flyScale creation expression. Select Solvers - Initial State - Set for Selected.
14. Select particle object and select Fields - Uniform. Set the following settings
Direction X, Y, Z : 1, 0, 0
Magnitude : 15
Attenuation : 0
15. Playback the animation.
Analyze Expression
1.
Randomly offset the particles
float $randY = rand (-3,3) :
Get random value between -3 and 3 into float type variable called $randY
float $randXZ = rand (-1, 1) :
Get random value between -1 and 1 into float type variable called $randXZ
vector $offset = <<$randXZ, $randY, $randXZ >> :
vector type $offset is evaluated by the components $randXZ, $randY, $randXZ
position = position + $offset :
The value of position is assigned by the sum of default position value and $offset
2.
flyScaler
$rand = rand (0.4, 1.5) :
$rand's value is evaluated by random number between 0.4 and 1.5 for each particle
flyScaler = <<$rand, $rand, $rand>>;
Value of flyScaler is assigned by the vector value which has $rand as X, Y, Z components.
Reference
- Autodesk Maya 2011, 2010. Autodesk Maya Online Help : Introduction. [online] Available at : < file:///Applications/Autodesk/maya2011/docs/Maya2011/en_US/index.html?url=./files/GS_Introduction.htm,topicNumber=d0e1838 > [Accessed 25 February 2011].
- Marc-André Guindon., 2005. Learning Maya 7 : The Special Effects Handbook. Unknown: Sybex