# ICE: Calculating edge midpoints

It’s a relatively simple thing to do, but to get to edge midpoints, there’s a few context hoops to jump through:

I guess I could most of the context conflicts by putting the ICE tree on the mesh and storing the midpoints there.

And now, let’s get the midpoint of the first edge only. All the Show Values are there to prove that it works.

# ICE: Volume of a grid

Take a default 8×8 grid. Extrude one polygon four units. Extrude four adjacent polys two units. Add an Attribute display property for the Volume.

# ICE: Selecting every N points in a grid

Here’s a question from the Softimage mailing list, and what I would have answered (I didn’t answer, and I didn’t peek at the other answers either).

Given a 100×100 Grid point cloud, how would you do something to the following subsets of points?
[0,5,10, … 595] and [1000,5,10, … 1595]

For something like that, modulo is an obvious way to do it:

Contrast the above with this nicer tree

Here’s [a cruder?] approach using linearly interpolated arrays:

# ICE: Summing up array elements by group

Given an array like

`[0, 3, 7, 22, 6, 71, 1, 0, 9]`

how do you sum up the first group of three elements (0+3+7), the second group of three elements (22+6+71), the third group (1+0+9), and so on and so on, without using a Repeat node?

Well, you could write your own custom ICE node. Or you could use Generate Sample Set like this:

# Rotating vectors around the global X axis

Another Rotate Vector example. This time, I rotate the points of a mesh around the global X axis. In short, the point positions are treated as vectors, and then rotated about the specified axis. Of course, this requires some conversion between coord systems, which is always fun ðŸ™‚

The bottom part of the tree is just for visualization.

# Instancing a different object at each point

If you have a group of N different objects, and N points in a point cloud, then here’s a simple way to instance a different shape at each point.

The line of shapes in the background is the group.

Note the use of Get Point ID, which works even if the points don’t have their ID attribute set.

# Get Closest Location and position coordinate systems

When you’re using Get Closest Locations, positions are local. That is, they are relative to the local coordinate system of the object that “owns” the ICE tree. The input Position is in local coordinates, so in most cases, (0, 0, 0) will do fine. And if you use the output locations to get positions, those positions will be in the local coordinate system of the ICE tree owner.

Hat tip: Gray, who has posted this several (many?) times over the years.

# Using ICE attributes to control point light instances

With Arnold, it’s all in the ICE tree. SItoA looks for attribute names like ArnoldLight_intensity and automatically uses those attributes to set the corresponding parameter values on the point_light nodes it exports to Arnold.

With mental ray, you use the Attribute shaders: