Keep up-to-date with Free tutorials!!


Sign up to our twice-monthly newsletter today for the latest tutorials, interviews and product information.

Sign me up to receive third-party emails from 3dtotal's partners, too!

- Latest news
- Exclusive Shop Offers
- Preview early content
- Plus much more


Not Ready to take that step? OK, Why not just Subscribe to the RSS Feed

submit tutorial
1 | 2 | 3
Object spreading methods

| Your Rating:
rating star fullrating star fullrating star fullrating star nonerating star none
(Score 3 out of 5 after 1 Votes)
| Comments 0
Date Added: 9th December 2009
Software used:

The particle instance options will window appear. Select an object and add it to the list. Lets tweak parameters (don't touch "cycle" related parameters). I advise you to turn the "Level Of Detail" to "BoundingBoxes" for a better workflow.

Lets take advantage of using particles... You could apply to the instanced objects complexes particle motion/effects such as using fields and collisions rigid solver (to reach the floor for example). Note that on creating a particle instance you can set many connection with particles attributes which affect the instanced objects.

How to bake particle instance? To do so, open the hypergraph, select your instance node, press Input and Output connections button. Then break the connection between the time node and the particle shape. Your spread instanced objects would keep this position in time

4 - Animation driven spreading

We are going to "bake" animation. A kind of solid ghosting effect. First, animate one object the way you want (using any animation helpers you need, such as motion path). Then we will bake animation by simply duplicating the object at its position on the frames required. Also you would have non animated objects correctly placed. ! Last minute note : If you are using Maya 4.5 or higher, use the tool called Create Animation Snapshot.

Animation baked so as to spread the animated object. Example using motion path animation

You can do it by hand by sliding the time slider and duplicate (CTRL+D) the object at this position in time. Or using this simple script (open the script editor and execute this script bellow to load this function). Select the the animated object(s) you want to bake animation, then is the command line (or in the script editor) type launch the function giving the arguments you want : bakeAnimation(3, 0, 25) for instance. This script does automatically what you would have done by hand... great!.

global proc bakeAnimation(int $step, int $startFrame, int $endFrame) {

    if($step < 1)  { error("bakeAnimation : the step argument must be at least higher than 1.\n"); }

    string $selection[] = `ls -sl`;

    for($object in $selection) {

        for($n = $startFrame; $n <= $endFrame; $n+=$step) {

            currentTime -e $n;
            duplicate $object;

        print($object + " animation baked.\n");

5 - Melscripting issue

Here is maybe one of the more interesting way to spread. You need simple melscripting knowledges (or other c-like scripting languages) . You must know some basics of melscripting... and especially the random function, duplicate function, transformations (move, rotate, scale) and the loop. Read the comments to understand the scripts steps.

Lets start code a simple object spreader. Simply duplicate several times the chosen object and place it randomly. The loop repeats several times this same action : returns random value for each axis, duplicate the object, place it with the random values. That is all!

global proc spreadObjects(
    string $object,
    int $duplicateNb,
    float $Xmin,
    float $Xmax,
    float $Ymin,
    float $Ymax,
    float $Zmin,
    float $Zmax

    for($n = 0; $n < $duplicateNb; $n++) {

        // Get location random values
        float $randomX = `rand $Xmin $Xmax`;
        float $randomY = `rand $Ymin $Ymax`;
        float $randomZ = `rand $Zmin $Zmax`;

        // Duplicate and place it randomly
        string $duplicatedObject[] = `duplicate $object`;
        move $randomX $randomY $randomZ $duplicatedObject;
    print($object + " duplicated and randomly placed " + $duplicateNb + " times.\n");

To use this procedure/function, first execute it in the script editor or source the melscript file, then call the function from the command line. For instance, you can use this function by typing spreadObjects("myObject", 30, -10, 10, -10, 10, -10, 10). This tool we've just coded is very useful and easy to use.

spreadObjects() function used to place randomly 60 sheep

Next, you might want to randomize the scale of this range of objects just created. Lets use a such as melScript one more time. This script applys a loop on selected objects to random their scales.

global proc randomizeSelectedObjectsScale(float $minScale, float $maxScale) {

    // Build the selected objects list
    string $objectsList[] = `ls -sl`;

    // Random scale of each object of the list
    for ($object in $objectsList) {

        // Get random value and scale object
        float $randomScale = `rand $minScale $maxScale`;
        scale $randomScale $randomScale $randomScale $object;
    print("Random scale on " + size($objectsList) + " selected objects done.\n");

For instance, type randomizeSelectedObjectsScale(1, 5).

Sheep sizes have been a bit changed thank to the randomizeSelectedObjectsScale function

< previous page continued on next page >

1 | 2 | 3
Related Tutorials

Game Animation Video Tutorials: Workflow Tips for Planning Animation

by Jason Shum
published on 2017-03-11

Keywords: game animation, Jason Shum, Maya

rating star nonerating star nonerating star nonerating star nonerating star none (0)
Comments 0 Views 9500

Computer Case Tutorial

by Martin Kostov
published on 2009-12-09

Keywords: object, computer, case, max,

rating star fullrating star fullrating star fullrating star fullrating star half (3)
Comments 0 Views 93168

The making of 'The Pussycat Dolls'

by Rao Rohit
published on 2014-10-07

Keywords: ZBrush, Cartoon, Character, Maya, Female

rating star fullrating star fullrating star fullrating star fullrating star full (27)
Comments 1 Views 61184

Making Of 'Sebulba'

by Joseph Szabos
published on 2009-06-22

Keywords: character, creature, sebulba, modeling, max,

rating star fullrating star fullrating star nonerating star nonerating star none (1)
Comments 0 Views 67811
Readers Comments (Newest on Top)
no comments!
No comments yet. Be the first to comment!
Add Your Comment..