random object distribution ?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  12 December 2003
random object distribution ?

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

  12 December 2003
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.
  12 December 2003
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.

  12 December 2003
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?
  12 December 2003
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.
  01 January 2004
Hi there

Check out the following thread:


I would go for particle instancing in your case.

/ Daniel
  01 January 2006
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright Đ2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:25 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.