|On this page|
In Houdini, points and primitives have an inherent order, and each point/primitive knows its own “point number” or “primitive number” (its index within the list of points/primitives). This node lets you change the order of points/primitives based on certain criteria.
To change the order of vertices within a primitive, use the Reverse SOP instead.
Sorting by an arbitrary expression
Do not use this node to sort “by expression” (setting the Point Sort parameter to By Expression). Instead, do the following:
Use the Sort node to sort “by attribute” using the key attribute.
This has two advantages over sorting “by expression”:
You can view the attribute contents in the geometry spreadsheet to make sure you are generating the right values.
It is usually much faster, since sorting by attribute can be multi-threaded, but expressions with local variables cannot.
The Sort SOP does not properly sort Vector3/Vector4 values or arrays - it only sorts by a single component. However, because the Sort SOP uses a stable sort, you can wire together multiple Sort nodes to sort by multiple components or attributes.
The points to sort. Only these points will be re-arranged by the point sorting choices.
How to sort the elements.
Do not change the order (preserve the current order).
By Vertex Order (points only)
Sort points to match the order of the vertices on the primitives they belong to.
If you have a curve whose point numbers don’t increase along the curve, this will give the points the proper numbers.
Sorts by the element’s X, Y, or Z coordinate.
Reverses the current ordering.
Scrambles the elements into a random order.
NOTE: Does not currently support restriction to a group.
Shifts the current element numbers forward by a certain offset. Point numbers at the end of the point list wrap around to the start.
Proximity to Point
Orders the elements by how close they are to a certain point.
This can be useful for limiting a point cloud to only the N closest points to a target: sort the points by proximity, then delete all but the first N points.
Orders the elements by their position along a certain line in 3D space. This is similar to “By X/Y/Z” but lets you specify an arbitrary line instead of one of the cardinal axes.
This option lets you sort elements using “key values” generated by an expression. However, it is faster and more convenient to use attributes.
Changes the order so elements that are near to each other in 3D space have similar numbers.
Uses the value of an attribute as a “key value” to sort by. For Vector3/Vector4 attributes, the node can only sort by a single component at a time. However, because the Sort SOP uses a stable sort, you can wire together multiple Sort nodes to sort by multiple components, or multiple attributes.
When the sort method is “Random”, the seed to use for the random number generator. Different seeds will generate different random orders.
When the sort method is “Shift”, the number of places to shift the element numbers forward.
When the sort method is “Proximity”, order the elements by how close they are to this point.
When the sort method is “Along Vector”, if you enter a path to an Object node here, the Sort node will use that objects translate as the vector to sort along.
This lets you sort along a vector from the origin to the object’s current 3D position.
When the sort method is “Along Vector”, the vector to use for sorting. This vector is signed, so a value of
0, 1, 0 is the equivalent of sorting By Y, while
0, -1, 0 is the reverse.
When the sort method is “By Expression”, this is the per-element expression to use to generate key values. However, it is faster and more convenient to use attributes.
When the sort method is “By Attribute”, the name of the attribute to use a the sorting key.
When the sort method is “By Attribute”, which component of a compound (vector/matrix) value to use as the sorting key. The Sort node can only sort by a single component at a time. However, because the Sort SOP uses a stable sort, you can wire together multiple Sort nodes to sort by multiple components, or multiple attributes.
Reverse Point Sort
Reverses the sorted ordering computed by the controls above. For example, if you set the sort method to “By X” and turn this on, points are sorted by decreasing X positions.
The primitives to restrict the sort to. Only these primitives will be re-arranged by the primitive sorting operation.
See the help for Point sort above.
Reverse Primitive Sort
Reverses the sorted ordering computed by the controls above. For example, if you set the sort method to “By X” and turn this on, primitives are sorted by decreasing X positions.