Monday, December 13, 2010

Incrementing (Adding) values over time

One of the challenges that I faced with developing a vehicle rig in Softimage ICE was how to add an acceleration variable and continuously translate my vehicle forward.  So if I started with a value of 0, and then continuously add 1 to that each frame, I would get values of 0, 1, 2, 3.  If I then changed the "acceleration" to 0, I would get 3, 3, 3, 3.  Changing Acceleration to -1 would generate 2, 1, 0

We start by initializing our custom attribute in the presim stack:

Now that our custom attribute is defined, we can go about modifying it over time.  To do this, we get the value of our custom attribute, add the amount we want to change it (each frame), and then set the custom attribute with the new amount:

Saturday, December 4, 2010

Setting And Getting Custom Attributes In Softimage ICE

Custom Attributes are very similar to variables in programming.  In Javascript, you might have something like:
height = 72;

In ICE, you connect a SetData node into your ICE Tree.  Open up the node and in the text box, type self.height.  Now the SetData node knows what you want to call your custom attribute, but it doesn't know what type of data it is.  Connecting a Scalar node of 72 into the SetData node will then change self.height into a scalar value of 72.



In the following example, I am creating a particle at position 0,0,0.  I then use a SetData node to define a couple of properties of my particle, making it easier to see what's going on (self.size (1.5) and self.shape (box)).  Next I create a custom attribute called self.my_custom_color and add a color value as it's input.  Lastly, I access the custom attribute via a GetData node with self.my_custom_color and use that to define the particle color.  To access the custom attributes, after you type self. you can hit the Explorer button, open up Point Cloud, and then see a list of all the attributes defined for the object.


Hopefully these two simple examples will help illustrate how to utilize Custom Attributes in your ICE Tree.  Going even further, you can create a custom attribute in one ICE Tree, and then access that data in an entirely different ICE Tree.