Cluster

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Cluster // The Garage

1  |  

Post by Délé // Aug 4, 2007, 3:03pm

Délé
Total Posts: 1374
pic
Hey guys. I took a break from my other projects for a few days and wrote some new tS scripts. I had a project a while back where I had to make multiple copies of an object and randomly position them around the scene. This can only be done by hand in the workspace right now and is VERY tedious. Anyway, I wrote a few little "Cluster" scripts to help. These will take whatever object you have selected and make multiple copies. You can randomize the location, rotation, and scale of the copies within the defined areas.



IMPORTANT:

There are few things I want to make very clear. Please make sure you read and understand the following before using the scripts:



1. Make absolutely sure that the bridge is set to OFF before running any of the cluster scripts. I accidentally had the bridge on a couple of times when testing the scripts and it will very likely freeze up trueSpace. Always make sure the bridge is OFF before using these scripts.

2. Do NOT turn the bridge on after making many copies of an object with the script. Again, it can easily freeze up trueSpace.

3. Be careful not to set the number of copies too high. I suspect the amount of copies you can make will differ from machine to machine. I personally kept the number of copies below 1,000. It's up to you as to how many copies you want to try at one time, but know that too many could cause tS to freeze up.

4. Be careful how many copies you delete at one time with the script. When I tried deleting 1,000 at one time, my video driver failed twice and I had to restart my machine. So be warned. It's best to delete a large number of copies in smaller increments. 500 at a time worked just fine for me.

5. Do not try to encapsulate a large number of copies. I tried encapsulating 1,000 copies and tS froze up.

6. Make sure the desired object is selected before executing the script. If you have the script itself or any other object selected, it will make multiple copies of those. So make SURE that the desired object is selected prior to script execution.

7. Make sure your object has a unique name. By that I mean to just make sure it does NOT have a comma and a number, like (Object, 1). Something like (Object1) would be fine. The reason is because when trueSpace makes copies it adds a comma and a number. So when you use the script to clear a bunch of copies, it will delete your original if it has a comma and number.



How to use:

1. Click on the Handle (red sphere) in the 3d space and use that to position the area you want the copies to be.

2. Use the "Area Settings" on the script to adjust the area size.

3. Click on the "Scale" and "Rot" tabs at the top of the script to set the min and max random values for the scale and rotation of the copies.

4. Click on the "Default" tab and set the number of copies you want to make.

5. Select your object that you want to cluster and the click the "Check" button. Just below the check button it will show you how many faces and verts will be introduced into the scene when you execute the script. This will help you from accidentally introducing more geometry then tS can handle.

6. Make sure your object is selected. Make any "Cluster Setting" adjustments you desire and then press "Create".

7. If you are not happy with the results or you want to reduce the number of copies, set the clear amount to the desired amount you want to delete, and press "Clear".



Keep in mind that it can take several seconds if not minutes to make/delete the copies, depending upon the number of copies you're making/deleting and your machine specs. I tried adding a progress reader to the scripts but couldn't get it to work properly. I personally just hover over the view widget to see if it's still working. If the widget highlights, that means it's done. If the widget doe not highlight, then the script is still working.

Post by Délé // Aug 4, 2007, 3:05pm

Délé
Total Posts: 1374
pic
Scale and Rotation Settings:

7811

All of these scripts have a scale tab at the top. This allows you to set the min and max scale values of the copies. The script will randomly pick a scale size between your min and max values.

If you have the "Uniform" check box checked, then the min/max values just below the checkbox will be used. If it is not checked, you can set the min/max values for the X, Y, and Z scales independently.

7810

All of these scripts also have a rotation tab at the top. This allows you to set the min and max rotation values of the copies. The script will randomly pick a rotation angle depending on your min and max values. You can set the independently for them Yaw, Pitch, and Roll.

Post by Délé // Aug 4, 2007, 3:08pm

Délé
Total Posts: 1374
pic
7812

Cube Settings:

Check Button - This allows you to check the number of faces and verts that will be introduced into your scene before it is actually executed. This allows you to make sure your not going to bog down your scene too much. Just select the object you're planning to cluster and then click the "Check" button. Just below the button you will see the faces and verts number update depending upon how many copies you have the script set to. Note that tS reads faces differently depending upon if you have a regular object or and object that is a flattened SDS. If your object had SDS applied and you flattened it, tS will read the tris that you don't see instead of the actual faces that you do see.

Invisible Checkboxes - The Handle and Area invisible checkboxes allow you to set the Handle or Area view to invisible.

Area Settings - Here you can set the X, Y, and Z scale of the cube area. You can set each axis independently. The copies will cluster within the cube area.

Cluster Settings - Here you can adjust the way the copies cluster within the cube. You can have them cluster more toward the front or back, top or bottom, or left or right. Just select the radio buttons where you want them to concentrate. Then set the scrubbers below. You can set them from 0 to 100%. The higher the value, the closer to the wall they will cluster. If you have it set to 100%, it will cluster on the wall.

Clear Button - This allows you to delete copies. You can set a minimum and maximum amount below the button. For instance, if you have made 400 copies of an object and you want to delete the last 200, set the first value to 200 and the last to 400. Then make sure you have your original object selected and push the "Clear" button. It will delete the last 200 copies and you will be left with 200. If you wanted to delete all 400 copies just set the first value to 1 and the second to 400. I highly recommend not deleting more then 500 at a time. It can take several seconds, possibly minutes to update.

7813

Cylinder Settings:

Check Button - Same as cube check button (see above).

Invisible Checkboxes - The Handle and Area invisible checkboxes allow you to set the Handle or Area view to invisible.

Area Settings - Here you can set the X, Y, and Z scale of the cylinder area. You can set each axis independently. The copies will cluster within the cylinder area.

Cluster Settings - Here you can adjust the way the copies cluster within the cylinder. The "Cluster XY" value will make the copies cluster more toward the center of the cylinder. You can set this value from 0 to 100%. You can also make the copies cluster more toward the top or bottom. Check the radio button for top or bottom and then set the value below. You can set it from 0 to 100%.

Clear Button - Same as cube clear button (see above).

7814

Ring Settings:

Check Button - Same as cube check button (see above).

Invisible Checkboxes - The Handle and Area invisible checkboxes allow you to set the Handle or Area view to invisible.

Area Settings - Here you can set the X, Y, and Z scale of the ring area. You can set each axis independently. You can also set the "Thickness" of the ring from 0 to 0.5. The copies will cluster within the ring area.

Cluster Settings - Here you can adjust the way the copies cluster within the ring. You can choose between top or bottom with the radio buttons. Then you can set the amount of cluster from 0 to 100%.

Clear Button - Same as cube clear button (see above).

7815

Sphere Settings:

Check Button - Same as cube check button (see above).

Invisible Checkboxes - The Handle and Area invisible checkboxes allow you to set the Handle or Area view to invisible.

Area Settings - Here you can set the scale of the Sphere area. The sphere scales uniformly. The copies will cluster within the sphere area.

Cluster Settings - Here you can adjust the way the copies cluster within the sphere. Setting the cluster value higher will make the copies cluster more towards the center of the sphere. You can set it from 0 to 100%.

Clear Button - Same as cube clear button (see above).

Post by Délé // Aug 4, 2007, 3:10pm

Délé
Total Posts: 1374
pic
Here are some simple samples of what can be done:



7817



7818



7816



7819

Post by frootee // Aug 4, 2007, 3:58pm

frootee
Total Posts: 2667
pic
Hm... looks like this could be the beginning for a particle system. Is it possible to generate these copies over time, rather than all at once?


Froo

Post by Délé // Aug 4, 2007, 5:21pm

Délé
Total Posts: 1374
pic
Hm... looks like this could be the beginning for a particle system. Is it possible to generate these copies over time, rather than all at once?

Froo

Well, I'm not sure to be honest. I had originally planned on trying to make some kind of simple particle system for the workspace, but now I'm a bit doubtful. The thing I found out with this experiment is that while the new architecture is great with high polygon counts, it's not so great with a large amount of objects. The LE gets bogged down pretty quickly. I also found that trying to encapsulate a large amount of objects is not so feasible. TrueSpace freezes up. I believe that a particle system would need to encapsulate the particles and have them all link up to an engine script to drive them.

So I do think it's possible to do through script technically speaking. I'm just not sure tS could handle it through script at the moment. I think any kind of useful particle system would have to be hard coded. I could be wrong of course, but right now it doesn't seem so plausible to me from a scripting standpoint.

btw, I thought I'd upload the rock I used to test with if anybody wants to use it to play around with the scripts a little.

Post by SteveBe // Aug 5, 2007, 9:41am

SteveBe
Total Posts: 282
pic
Thanks for the Cluster scripts Délé! I tried some at a resonable number of copies
and it was pretty quick. I tried 50 copies of a level 1 SS(refined) cube and
it took about 5 seconds. Then grouping took about 6 seconds.

I tried copying an object that had physics attribs and it worked great, not
a full blown particle system but it sure helps with the tedeum of creating
these kinds of groupings.

Short anim attached of the result:

Post by 3dvisuals dude // Aug 5, 2007, 1:27pm

3dvisuals dude
Total Posts: 1703
pic
Fantastic work Délé!!!

This will have hundreds of uses and is something we all needed badly in the Workspace.

Thanks for doing this!

- 3dvisuals dude

Post by frootee // Aug 5, 2007, 1:29pm

frootee
Total Posts: 2667
pic
Wow.. Just noticed Dele's number of posts is 666...
Dele... The Prince of Darkness? Who Knew?
Sorry Dele.. couldn't resist! :D

Thanks for the demos there too!

Froo

Post by Délé // Aug 5, 2007, 4:04pm

Délé
Total Posts: 1374
pic
Thanks guys. Hopefully they will prove useful. :)

I'm thinking about converting the cluster script into an array tool also. The only thing is, it wouldn't be as useful as the model side. It wouldn't be parametric or anything like that. It would just work like the cluster scripts. Might still be useful though. I'll probably go ahead and make it since it's easy enough to do and upload it sometime this week.


Wow.. Just noticed Dele's number of posts is 666...
Dele... The Prince of Darkness? Who Knew?
Sorry Dele.. couldn't resist!

lol, yeah I noticed that earlier too. If there is a prince of darkness around here though, my guess would be it's that crazy mouse. ;)
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn