Reorder Vertices?

Is there a way to reorder verticies in TD? For instance by x, y, z like the SortSOP does for points? I can see the PrimitiveSOP has some options but not the ones I’m after.

I’m essentially wanting to order vertex indexes by height so I can make ‘grow’ animation in glsl.

Any ideas?


One work around you can use is to do your sorting with the sort sop, then use a point sop or vertex sop to pass the point index in as a custom attribute.

Vertices will naturally aquire the attributes of the point they are attached to by the time they reach the vertex shader, so you can access that point index as a then vertex attribute.

One thing to note, you will likely run into situation where multiple vertices share a common point ( unless you turn on unique points in a facet sop) which means multiple vertices may have the same index value.

This may or may not be desirable depending on how you’re building the animation.

If you need absolutely unique index per vertex that is spatially sorted, facet sop may work or script sop is your end of the line roll your own for prepping geometry.

Cheers for this Lucas, it’s a big help, I’ll let ya know how I get on :slight_smile:

1 Like

Just an update on this incase anyone comes looking. I ended up just using the UV map to manipulate my verticies in the order that I wanted.

It’s still a bit rough but the result so far is this. I used a ramp as height map. All the verts are initally contracted inwards alongs their normals (adjustable by uContractionAmount on the MAT).

I use an alpha clip mask that is the inverse of the height map. I pass it through to the pixel shader so the verts that are contracted are not drawn. Then as I roll the ramp up from black to white it pushed all the verts outward and this is the result (ignore the awful mesh). The main trick right now is getting the balance between the alpha clip (uMaskClipValue) and the contraction right, otherwise, as you can see below, the primitives kind of just appear, instead of unfolding from their normals.


This is probably obvious to anyone with a background in computer graphics, but it’s been a good learning experience for me :smiley:

Project here, would love to hear any suggestions for improvement.

Grow.toe (398.8 KB)


1 Like