## Thursday, 8 October 2009

### Softimage ICE - Tree building step by step

After posting a number of clips on Vimeo, I had many requests to explain how I managed to get ICE to construct a tree. Here are the basics of what I did, to get you started:-

So start by getting an empty point cloud and create an ICE tree. Plug in an Emit from Position node, emitting just 1 particle. It needs to have zero speed and no randomise direction, so just set all these values to 0.
Make the size 1, shape Cylinder and Orientation 0,1,0,0.

Set the particle scale to 0.1, 1, 0.1 by plugging a Set Particle Scale node in the Execute on Emit port. This gives us our basic branch.

Connect a Clone Point node and set the Target to Self. The number to clone is the number of branches.

The next step requires building a small but very useful compound. This is one I use all the time, so I've found it very useful to export it to the menu. It basically allows you to move a particle along its local axis, which is crucial for this tree building to work. The only exposed value is the Rotate Vector - Vector input, which is used for doing the translation of the particles. Basically the input will be an x,y,z amount to translate.

Plug this compound into the On Creation port of the Clone Point node. Set it's value to 0, 1, 0 to translate the particle 1 unit in its local Y. This leaves it only half way up, but from here we want to spin it around by some random amount.

In this example I've used a Randomise Rotation by Cone node, which pretty much does what I want. I've increased the Clone Number to 3, so we have a total of 4 particles.

Now, reusing the Local translation compound, just plug it into the next On Creation port on the Clone Point node, to move it along its local Y, into its correct position.

This is the basic setup for duplicating each level of branches, but to make it more flexible we're going to create a simple loop and use the particles State ID to add as many levels of branching as we want. To start with, get the particles State ID and run it through an If Equals setup.

The basics of the loop are formed with a Repeat with Counter node, which is one of Phills ICE 100 compounds. Out of habit I changed the counter name to self.mycounter, but of course you can leave the default name in here. We'll use the counter value to test the Particle IDs, so that ID 0 will Clone ID 1's, ID 1's will Clone ID 2's etc. So use a Get Data node to get the counter value and run it into the Equals condition.
Increment it with an Add node and set the new cloned particles State ID's. (Use a Set Data node and explore the pointcloud for set State_ID)

Increase the Number of Iterations in the Repeat with Counter node, and with a bit of luck you should now have a few more branches.

This is the basic setup which shows one way of dealing with this type of problem. It can be adapted in many ways to build a complex compound with all sorts of user functionality, as I've demonstrated in my Vimeo clips.

For example, here's a way of reducing the size of the branches, per iteration. Using the particles scale, extract the Y value and use that as the Local Translation value. Multiply the scale value by something like 0.8, to reduce it slightly, then use that new value as the Local translation again, and finally set the Particle Scale.

Here's a screengrab of my more-or-less completed Tree Compound:-

Chris

chris.marshall@eclipsecreative.co.uk

1. awesome information!
thanks a lot!

robert

2. Thanks Robert. Any comments are welcome!

3. Thank you for this tutorial!
Nassos

4. that's cool!! but how did you add the foliage???

5. Well all particles in ICE can have their own shapes. Once you've finished building the branches, take the last set of branch positions and randomly emit loads of particles, and make those disk shaped.

6. Hi colleague.

A tried to do your compound but I cannot get the trees to render properly. I'm just a begginner with ICE, so I really don't know what I'm doing sometimes.

There's the problem and the ICE TREE:

http://yfrog.com/04icetreehj

I really appreciate your teachings. Thank you :).

7. Hi Sallem,
Well if you're a beginner, you're doing pretty well so far. If the problem is that your tree doesn't render the same colour as it looks, is probably because you need to apply a material to your Point Cloud, and in there get an Attribute>Colour node and change it from Use Default Value to Colour. Pipe this into your Material. It's the way you get colour from your ICE tree into the Render Tree. Any problems, let me know.
Chris

8. Thanks, I'll try!

Greetings.

9. Thank you for this tutorial! With love!

10. Hello,
First I have to say this compound is very cool and it's a very good tutorial on how to set it up.

However, I was wondering if you could give me a little tip on something I am a bit confused about.

I was thinking of using the compound to spawn trees when some other particles hit a surface (imagine seeds flying in the air and hitting the ground giving rise to trees growing up at the hit location).

I don't really know how to get started with this though. I have set up a tree compound as in your tutorial and it works brilliantly, but how to move on? :)

If would be awesome if you have time to give a little tip. Thank you.

11. Hi Tobias,
I'm glad you like the tutorial and have managed to get it to do what you want. With regards to your seeds setting off the tree growth, this should be possible. I haven't done any work with one pointcloud setting off another so I'd try and do it all in the one. Basically you could use the StateId's to control what's happening. So for instance, create a particle with a stateId different to those used in the tree, when it hits a surface, use that location to set off a tree. You really need to package up the tree building nodes into a self contained compound that would allow you to control all parameters from the top level. When the 'seed' hits, set a timer going that controls the life of the tree. Something like that. Let me know how you get on.
Chris

12. Hi,

firstly want to thank you for this awesome tut.
I just got a question/ problem to ask you, Chris.

I follow your instructions above, but what happened is that my tree grow so many branches even I left the clone with "1"...it just keep growing so many until my computer crashed...

could you give me some hint on this? Im also very new to ICE...

Thank you once again,

Zack

13. Zack,
I'm glad you like the tutorial. The repeat loop is the main one that controls how many times to duplicate the branches. The clone is the number of branches per loop. If your loop isn't setup correctly, even if you have just 1 cloned branch, it could still go out of control. Feel free to e-mail me directly if you have a problem or even if you resolve this one.
Chris

14. Hello,

I was sure that I posted a comment to thank you for your help, but I realize now that for some reason it didn't got posted. So I try again: Thank you for your help :-)

I have recently changed my mind a bit, so the trees will not pop up immediately when the seeds hit, which makes it a bit easier for me to create the transformation of the landscape. I would like to experiment more with the look of the trees, but my project got to be finished within 2 weeks. I will show you what I end up with when it's done, if you are interested :-)

15. Hi Tobias,
I'm glad things have worked out and that the tutorial helped.
It would be good to see your finished project!!
Cheers
Chris

16. Chris thank you so much for posting this. It was excellent. I'm still learning Softimage and ICE but I found this pretty easy to follow, with a little confusion on the loop counters, but I got it working.

For creating leaves you suggested "Once you've finished building the branches, take the last set of branch positions and randomly emit loads of particles, and make those disk shaped.". Can you share any tips or suggestions on how to determine those last branches?

17. Thanks John,
The last level of branches will be determined by their State ID's, which depends on the number of times you've looped to create the branches. So if the trunk is State zero, and you've looped three times, your last level of branches will be State 3, possibly. So you can simply use an If Equals condition on the state id's to Clone leaves. Use the On Creation ports of the Clone Point node to randomise the positions and rotation of the leaves, and change the shape of course.

18. Hello Chris,

Here is a link to my project where I used your tutorial. It got a bit delayed because I travelled on vacation shortly after completion of the project, but here it goes :) I hope you like it - it is my first project using 3D software like Softimage.

19. Great Stuff!! I *do* like the trees!!

20. Hey Chris,

I'm working in 2012, it seems the 'Repeat with Counter' compound has been added to the ICE database (yay) but it doesn't work the same as i see posted in your shots.

Also, the 'Set State' node is no longer in the list.

Any pointers on how to adjust the ICETree to make my trees grow?

Thanks!

21. Hi Jonathan, only just saw your post, sorry I don't check this much. Did you figure out what you were looking for?

22. Jonathen Recheck your tree I was making the same mistake BUT Chris does Major changes to the tree ( note "Repeat with Counter" plugs into the ICE base )

all still working in 2012 here =)