PDA

View Full Version : random object distribution ?


afox
12-18-2003, 01:11 PM
I am really new to mel scripting and just started to learn it, but i guess that should not be too hard.

Ultimately I want to create a forest. My Plan is to make pictures of different trees and use them to texture simple planes.

So the mel script should distribute the planes randomly over an area that i define, for example the ground plane,
i should be able to define a minimum and maximum distance between the trees,
scale them randomly ( again within certain maximum and minimum values)

Because i will use different pictures of different trees the script should also use the planes randomly
(perhaps with a possibility of favouring some trees)

ok thats it for now

I really want to do that, but i simply donīt know where to start, perhaps someone can point me in the right direction, or tell me where to find a script that does something similar so i can learn from it, etc...
Of course if there is a better method of doing a forrest i am also eager to hear it.

thanks in advance

Marc

ajk48n
12-20-2003, 06:19 AM
Well, what you should probably look at is makeing a plane, then duplicating it. Then you get all the planes in an array, and move over each one to randomly distribute them.

Specific commands to look at are "duplicate", "ls -sl", "rand".

If you want more info on how to specifically do it, just ask.

afox
12-25-2003, 06:14 PM
Thanks ajk48n,

i know that i can duplicate the planes, but i wanted to avoid moving each one by hand, but thanks a lot for the mel commands, i will look into them.

PS: Sorry for the late reply, but i hadnīt access to an internet connection for a few days.

Marc

ajk48n
12-26-2003, 03:03 PM
You don't need to move the planes by hand. You can take the move, or xform command, and pass it random values for a place to move the planes to.

For instance,

if you had 10 planes in an array $planes, you could run

for ($p in $planes)
{
xform -t rand(1,10) rand(1,10) rand(1,10) $p;
}

I forget the exact syntax for "rand" at the moment, but the idea's the same.

Or is there something else you meant by not wanting to move the planes by hand?

larryvm
12-30-2003, 11:45 AM
i dont remember well, but one time i use the paint script tool to made something similar, i dont remember the way i did but you can look it, i remember that was easy and a good way to do this jobs.

jdj
01-04-2004, 08:44 AM
Hi there

Check out the following thread:

http://www.cgtalk.com/showthread.php?s=&threadid=84740

I would go for particle instancing in your case.

Cheers!
/ Daniel
:beer:

CGTalk Moderation
01-17-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.