Post-simulation and softimage ICE (part 2 – strands)

 

Ok, so we’ve talked about the post-sim region, and showed an example. Just what did I do in there?

Strand basics:

Strands are one of my favorite features of softimage ICE. They are really cool. While it’s beyond the scope of this tutorial to get into everything there is to making strands, here is some foundation… Strands are essentially a bunch of per-point attributes telling ICE how to draw the resulting strands. These attributes contain information about color, orientation, number of points in the strand and so on. In our example, the most important of these to us is the strandPosition array. It is an array, one per each particle, in which each strand points position is stored. This is what we’re going to manipulate. Make a simple particle simulation in ICE, and then add a post-sim tree. We’re going to work in there…

Create a strand for each particle:

There is a compound in ICE called “create strands,” which we’ll use here. I’m not a big fan of this compound, it gets the job done but if you get into ICE strands much I advise building your own. At a minimum, I suggest opening up the “create strands” compound and looking around, and then make a single, simple change. See the compound in there called “calc strand ratios?”  Plug it into a new port of the big “set data” node in there, and name it “self.strandRatio.” This is an array which assigns each strand point a value ranging from 0 to 1 along the length of the strand. Think of it as a replacement for a “u” value of a curve, it gives you an idea where on the resulting curve a point is. Take your resulting modified “create strands” compound, plug it in, and set the number of strand segments to 20 or more. (Note: depending on the size of your display you may need to click on images to see them without cropping.)

Drawing circles:

There are a lot of ways to describe circles mathematically, but for our purposes we are interested in getting cartesian coordinates (x and y values for each point on the circle). Without getting into the math suffice it to say a parametic form of the equation for a circle you were exposed to in school (x² * y² = r²) is as follows:

xr cost

y = b + r sint

Where (a,b) is a center point, r is the circle radius and t is an angle ranging from 0 to 2Π (or 360 degrees).

Remember that “strand ratio” value? It ranges from 0 to 1 on the length of the strand… meaning if you multiply that by 360, you get the angle (t) for each point on the strand. So, to draw a circle with ICE strands on the x/z axis (like a hula hoop) you get this:

And the result (on a single point) looks like this:

Add this to the particle point position and you get this:

Note that I took the entire “calc strand ratios” compound (from inside “create strands”) and used it here, rather than getting the strand ratio directly where we saved it earlier. You can do it either way, and it’s slightly slower this way where the strand ratios are calculated over and over per frame rather than just being looked up from where we saved it…. but it saved some room in these screen shots. ;)

Next steps:

Now all we have to do is move the actual particle at the center to close the circle. Since we’re in a post-sim tree, moving the particle around doesn’t invalidate our original simulation, it just makes the change for rendering – as far as the “simulation” ice operator is concerned the particle hasn’t moved. So, let’s make the point position the same as the last point on the strand. To get that last point, we can “pop” it from the strandPosition array. Pop just takes the last member of an array, so it’s a handy way to get the value we want in this case. So we get the strandPosition array, pop the last value, and use that as our new point position.

Pretty simple, isn’t it? In the next post, we will adjust the circle to match the particle’s orientation, and then we’ll use this whole setup to create a series of concentric rings around each simulated point. Cheers – AM

 

Plus… seeing stars…