Caffeine Abuse - The Blog

How to offset point position in ICE

Start a fresh scene and from the Get > Primitive > Polygon Mesh menu choose icosahedron (any dummy object will do) and set the Geodesic Frequency to 4 to make it a bit smoother. With the icosahedron still selected, press [4] to switch to the Simulate toolbar and from the ICE > Create menu choose Emit Particles from Selection. With the pointcloud selected, press [Alt]+[9] to open an ICE Tree.

Open the Emit from Surface PPG and change the Rate type from Number of Particle per Second to Total Number of Particles and Size to 0.5 or so. By default, the shapes of the points are set to (which may not be totally unexpected) just points. While this is sufficient to determine their position, there’s no way to tell their size or in which direction they’re oriented. So for clarity, change the Shape to Cone. In the Orientation section of the PPG, check the Align to Surface Normal checkbox.

In order to offset you need to extract their current position, which direction they’re oriented and then add the offset along their respective axis. For this to happen, you’ll need to add a few nodes. Get a Get Closest Location on Geometry node, a Multiply by Scalar node, an Add node, a Get Point Position node and finally a set Point Position node.

Start by connecting the Get icosahedron node to the Geometry1 input of the Closest Location on Geometry node. There’s a lot of information that can be extracted from this node, but the one you’re currently interested in is the normal or direction. So connect the Normal output to the Value input of the Multiply by Scalar node and the Multiply by Scalar node to the Value2 input of the Add node. The add node will obviously add a value but you first need to too tell it what it should be added to, which is the original position of each point. So connect the Get Point Position to the Value1 of the Add node. While the ICE Tree is just about finished it will not have any effect on the actual could just yet, as you haven’t told it what to do with the information. Connect the Add node to the Position input of the Set Point Position node and connect the Point Position node to the Port2 Input of the ICE Tree node. The node controlling the actual offset is the Factor value in the Multiply by Scalar node. While you can control it directly in its PPG, it will be far easier to “read” your tree if you use a separate node. Get a Scalar node and connect it to the Factor input of the Multiply by Scalar node. Open the Scalar PPG and set your desired offset.

The project files used in this tutorial can be found at:
http://www.redi-vivus.com/Caffeineabuse/Offset_PointPosition.zip

In order to offset the particles along their individual axis’s you need to determine their current position and in witch direction they’re oriented. If your different sizes particles and want compensate for it, you can use a second Add node and add the particle size to the scalar value before connecting it to the Factor input.

Quick tip
Your ICE Tree currently lives in the Simulation Stack which means your offset will be applied every frame. To avoid this you can move the ICE Tree to any of the other stacks, such as the Animation. Press the right arrow in the ICE Tree menu to display the Explorer and drag and drop the ICETree operator to any of the stacks below the Simulation.