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

By Nicolas d'Haussy
Web: Open Site
| Your Rating:
rating star nonerating star nonerating star nonerating star nonerating star none
(0 Votes)
| 25483 Views
| 0 Comments
| Comments 0
Date Added: 9th December 2009
Software used:
Maya

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.

735_tid_image06.jpg
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.

735_tid_image07.jpg
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).

735_tid_image08.jpg
Sheep sizes have been a bit changed thank to the randomizeSelectedObjectsScale function





< previous page next page >

 
1 | 2 | 3
Related Tutorials

Tutorial

Gallery Image.



Keywords: 3dsmax, poly modeling, character

Go to tutorial
rating star fullrating star fullrating star fullrating star halfrating star none (3)
Comments 0 Views 6733

Tutorial

Gallery Image.



Keywords: Maya, Tutorial, Head, Model, Modeling, Mouth, Nose, Ear, Neck, Eyes, Face

Go to galleries 1
rating star fullrating star fullrating star fullrating star fullrating star full
Comments 0 Views 62696

Tutorial

Gallery Image.



Keywords: object, weapon, gun,

Go to galleries 1
rating star fullrating star fullrating star fullrating star fullrating star full
Comments 1 Views 49022

Tutorial

Gallery Image.



Keywords: Maya, Rigging, Animation,

Go to galleries 1
rating star fullrating star fullrating star fullrating star fullrating star half
Comments 2 Views 11676
Readers Comments (Newest on Top)
no comments!
No comments yet. Be the first to comment!
Add Your Comment