To assign an image sequence to the sprites
These attributes specify the files available for use in the sequence. These attributes do not select the actual cached files. You do this by setting the Sprite Num or spriteNumPP attribute in a later step.
The Sequence Start and Sequence End specify the filename extension number of the first and last files available for the sequence. The Sequence Increment sets whether each frame is available for the sequence every other frame, every third frame, and so on.
For example, to use every file of a 30-file sequence starting with Smoke.0, you would set the Sequence Start to 0, the Sequence End to 29, and the Sequence Increment to 1. To use every other file of the same file sequence, you would set Sequence Increment to 2. In other words, you could cycle through Smoke.0, Smoke.2, Smoke.4, and so on.
When you added default Particle Render Type attributes for sprites in a prior step, Maya added a Sprite Num attribute to the particle object. Sprite Num sets which files are cycled from the pool of files specified by Sequence Start, Sequence End, and Sequence Increment. More specifically, Sprite Num is an index into the pool of files.
For example, suppose you have a file sequence starting with Smoke.0. If you set the Sequence Start to 0, the Sequence End to 29, and the Sequence Increment to 1, the pool of images and Sprite Num values that represent them are as follows.
Image | Sprite Num |
---|---|
Smoke.0 |
1 |
Smoke.1 |
2 |
Smoke.2 |
3 |
Smoke.3 |
4 |
— |
— |
Smoke.29 |
30 |
If you set the Sequence Start to 0, the Sequence End to 29, and the Sequence Increment to 2, the pool of images and Sprite Num values that represent them are:
Image | Sprite Num |
---|---|
Smoke.0 |
1 |
Smoke.2 |
2 |
Smoke.4 |
3 |
Smoke.6 |
4 |
— |
— |
Smoke.28 |
15 |
You can set keys or write an expression to animate Sprite Num and thereby cycle through the images. All sprites display the same image each frame.
For instance, if the start frame of your scene is frame 0 and you have 30 images named Smoke.0 through Smoke.29, you can use this creation expression:
particleShape1.spriteNum = (frame % 30);
and this runtime expression:
particleShape1.spriteNum = (frame % 30);
As the animation plays, all sprites cycle through the 30 images. At frames 0 through 29, the sprites display Smoke.0, Smoke.1, Smoke.2, and so on through Smoke.29. At frame 30, the cycle repeats for the next 30 frames.
See Expressions for details on writing expressions.
This adds the per particle spriteNumPP attribute to the particle shape node. The spriteNumPP attribute works like Sprite Num, but you can set spriteNumPP on a per particle basis.
For example, if the start frame of your scene is frame 0 and you have 30 images Smoke.0 through Smoke.29, you can use this creation expression:
particleShape1.spriteNumPP = rand(0,30);
and this runtime expression:
particleShape1.spriteNumPP = (particleShape1.spriteNumPP + 1) % 30;
When you rewind the animation (or the sprite is emitted), the creation expression assigns a random number between 0 and 30 to the particleShape1.spriteNumPP attribute. Each particle therefore starts its sprite display with an image randomly selected from the 30 images.
When you play the animation, the runtime expression executes each frame (before or after dynamics calculation) and increments each sprite’s number by 1. This makes each sprite cycle through the entire range of images. After Smoke.29 appears for a sprite, the animation cycles through the images again starting at Smoke.0.
For more information, see Sprite attributes.