The problem with Point Index to Location and deleted points

This is a gotcha that has cost people some time

To demonstrate this, I’ve set up a simple point cloud where I Add Points using a grid primitive. I’ve added AttributeDisplay properties to the point cloud, to show the point IDs and PointPositions.

So far, so good. But if I now delete some points, notice how the point IDs don’t change (there’s none of that “reshuffling” of point IDs that the docs say will happen) because point IDs are unique. So after I delete every second point, my point IDs are 1, 3, 5, and 7, not 0, 1, 2, and 3.

Consequently, if I use Build Array from Point Data to build an array of point positions, I get the positions for points 0, 1, 2, 3, which is incorrect. For point IDs 0 and 2, all I get is (0,0,0).

The problem is that Point Index to Location returns a valid location even when I give it the ID of a deleted point but that location doesn’t resolve to the correct point position (Build Array from Point Data uses Point Index to Location to build the array).

One workaround would be to do something like this in Point Index to Location:

hat tip: Grahame Fuller

4 thoughts on “The problem with Point Index to Location and deleted points

  1. “(there’s none of that “reshuffling” of point IDs that the docs say will happen)” : Are you sure the doc say that ? If yes the doc is wrong. Point IDs are unique by definition. This way you always found a specific particle even if you delete other ones with lower ID. To get the Index of the particle, there is the Get Element Index node. Index is not the same that ID. That’s also why in Softimage 2012, the new attributes VertexIndex, PolygonIndex etc… are not called VertexID or PolygonID (thanks to Grahame for this too ;). Because polymesh doesn’t support unique ID and so always reshufle the indices of vertex, poly and edges.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s