Your online Softimage Educational Resource

The blog has been online for more than 4 years and there’s still not a single post even remotely related to the delicious brew called coffee… Perhaps it will someday, but in the meantime you can read the articles about Softimage. Most of the material are tutorials and Q&As I’ve written for 3D World Magazine sometime between today and 2003. If you have any questions please don’t hesitate sending me an email.

Thanks to Letterbox Animation Studios for hosting all the scene files.

Make sure you visit their for 100s of hours of free XSI video tutorials.

Sunday, June 28, 2009

Replace object A with a random new object

You’ve spent countless nights trying to finish the project on time and you’re just about to hit that sweet render button when the brilliant client comes through the door. He has just decided that he doesn’t want the landscape of cubes any more; he wants a random mixture of spheres, orbs and globs. Then he leaves you with the inspiring task of replacing the whole scene. A scenario that sadly isn’t all that uncommon. Though there’s no need to despair, with the solution below you should be home long before bedtime.

Open the scene spheres.scn from this issues CD. Press [Alt] + [4] to open the Script Editor and from the File menu choose Preferences... Change the Scripting Language to JScript and check the Log Commands checkbox. Close the PPG. Now, let’s have a quick look at the ingredients that you’ll be using in the script. Select an object, press [Ctrl] + [D] to create a duplicate, from the MCP > Transform menu choose Match All Transforms and pick any object. Then press [Del] to delete it. The script editor has just logged all the commands you need. The next step is to add which objects to replace, which objects that will be used to replace them and a random function that will choose one of these objects. The final script will look like this.

Since the script picks one of the three objects randomly, you can run the script again if you’re not happy with the distribution after the first run.

The project files used in this tutorial can be found at:

Quick tip
Change the Duplicate command to Clone (or Instantiate if you’re using models) to create clones of the replacing objects instead of duplicates.


Ray Wong said...

May you upload a larger picture of the script? Thanks!

Ola Madsen said...

Hi Ray,

I have no idea why you can’t click on that specific image to get a larger version of it… but I’ll look into it ASAP. In the meantime please send me an email with your address and I’ll send you the image...


coolroy said...

Hey Ola,
You got really nice blog! Thanks!

Unknown said...

Yeah I can't see the larger script either. My email is