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:
grid_every_n
Contrast the above with this nicer tree

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

See also this for some compounds.

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.

rotate_vector_around_X_axis

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.

Integer division in ICE


Dividing an integer N by itself doesn’t always give you 1.
IntegerDivision1
I think it’s a problem in the Divide by Scalar node (the division is probably returning a scalar like 0.99999999, and then that is truncated to zero when it is converted to an integer).

A workaround is to do all your division with scalars, and then use modulo to determine whether you Round or Floor the result. Here’s an example compound by Guillaume Laforge:
IntegerDivisionCompound

IntegerDivision3