Caffeine Abuse - The Blog

Creating strands between two different objects

Once completed the following steps you’ve effectively generated strands between the objects, though they won’t show up in a rendered image as you haven’t  defined any size or shape yet. To do this simply get a Set Data node, right click on the Value Port of the node and choose Add Port After two times so you have three values. Open the PPG, enter self.Size as Reference and set the size to 0.1 or so. Enter self.Shape as Reference1 and choose Cylinder. To loft the shape along the strand rather than using individual shapes you’ll need to add one last attribute. Enter self.StrandDeform as Reference2, press enter and check the self.StrandDeform checkbox. Finally connect the Execute output of the Set Data node to the Port2 of the ICETree node.

The project files used in this tutorial can be found at: http://dl.dropbox.com/u/3834689/CaffeineAbuse/Strands_between_points.zip

Strand_between_objects_img01

Set the starting points
Open the scene Strands_between_points_Start.scn. From the Get > Primitive > Point Cloud menu choose Empty and press [Alt] + [9] to open an ICE Tree View. From the Create menu choose ICE Tree. Press [8] to open an Explorer and drag and drop the StartPosition grid into the ICE Tree. Get a get data node, open its PPG and enter .PointPosition as the Refrence. Get another Get Data node and .kine.global as the Reference. Connect the Out Name output of the Get StartPosition node to In Name input of the two Get Data nodes. The point positions are stored in local space, meaning that you have to add the object’s transformation in order to retrieve the actual position of each point.  Get a Multiply Vector by Matrix node and connect the Value output of Get .PointPosition to the Vector input and the Value output .kine.global node to the Matrix input.
Strand_between_objects_img02
The end point
Get an Add Point node and connect the Result output of the Multiply Vector by Matrix node to the Positions1 input. Then connect the Add output of the Add Point node to the Port1 of the ICETree node. This will create a point at each of the grids vertices and will be used to create the strands. Get a Build Linearly Interpolated Array node and a Get Data node. Enter Self.PointPosition as the Reference and connect the Value output to the Start input of the Build Array node. Open an Explorer and drag and drop the EndPosition grid into the ICE Tree.  Repeat the previous step and connect the PointPosition, kine.global and Multiply Vector by Matrix nodes.
Strand_between_objects_img03

Create the strands
While you’ve just defined the end position for the strands you can’t feed this information directly into Build Array node because the point positions derive from different component types (points vs. vertices).  To fix this, get a Switch Context node and connect Multiply Vector by Matrix node to its Value input. Then connect the Result of the Switch Context to the End Value of the Build Array node. Get a Set Data node, enter self.StrandPosition as the Reference and connect the Result of the Build Array node to the input. Connect the Execute output of the Set Data node to the On Creation1 input of the Add Point node.

5 Comments

  1. January 21, 2013

    Hey, Thanks so much for this.
    One question,
    It’s possible to do it with more than 2 grids? I’m triying but doesn’t work.

  2. January 21, 2013

    I mean, to do a continuous strand grid after grid

  3. January 23, 2013

    Yes and no. The setup demonstrated in the article uses the first grid to define the start/first point of the strands and the second grid is used to define the endpoint of the strand. So you don’t have any control of the points in between these position, other than how many points you want to add (this is done with the Size attribute in the Build Linear Interpolated Array node). While you could add a third grid and repeat the same procedure to create strands between the 2nd and 3rd grid, I wouldn’t necessarily recommend it as it’s not really the solution to your problem.

    I’m afraid I don’t have time at the moment to setup anything more advanced, but you might get some pointers from “Build your own Bézier Curve Interpolation in Softimage ICE by Bradley Gabe, http://vimeo.com/11016782

    Cheers
    O

  4. February 13, 2013

    Hey, thanks a lot for this.
    I would like to know if It is possible to just use 1 point to another point of the mesh, not all the points in the mesh.

    Basically i just want to draw 1 strand from 1 point to another point.

    Trying to figure out how to tell ICE to pick the point i want but I am failing..

    Thanks again for your blog and tutorials, they are amazing!

  5. February 15, 2013

    Well, if you just want to create a single strand with a beginning and end, there are more efficient ways to do so than using this approach. A quick and easy way (though not the most efficient) to keep the ICE Tree intact is to get a Filter by Particle IDs node and connect it to New (On Creation1) input of the Add Point node. Open the Filter by Particle IDs PPG and change the Particle ID1 value to whatever point you want to keep/connect…