LineStrip vertex order question

Hello,

I’m playing around with line-strips and encountered the following:

Sorting a line by an attribute (for example its X position) does not reorder its vertex indices. Would it be possible to have an option to resample a line strip so that its vertex indices are reordered according to a given attribute?

I’m attaching a practical example where that would be handy. Please let me know also if there’s a simpler way to do what I’m doing there, since the method I arrived to seems rather convoluted. Probably the easiest is to do it in GLSL, but I’m trying to find a simple enough node-solution if possible.

Best,

linestripQuestion.tox (12.3 KB)

Darien

Hello @Darien.Brito

It looks like using a GLSL Advanced POP to re-write the line strip indices might be a only path for now. I’m noting this down so we can re-evaluate

Thanks.

In fact, if there’s only one line strip or if you know the line strips lengths in terms of number of points, you can use the Primitive POP to re-create the line strips based on the reordered points.

1 Like

I added an offset in Y since it shows a bit better what’s happening: currently the Sort POP doesn’t change the input topology, so when reordering the points, the vertices are updated with the new point numbers so the topology is identical.

I think if that wasn’t done in most cases you’d get garbled geometry. Could just be a toggle though so easy to add, I’ll play with it a bit.

Curious in your case what do you think should happen with 2 line strips?

See attached for what happens with the workaround setup (which is what would happen if sort POP didn’t update verts) and line break POP usage which has some interesting features to rebuild line strips, and in that case preserving how points were split between the two line strips

ReorderVertsLineBreak.toe (10.1 KB)

Thanks for the breakdown Vincent and Guillaume!

Yes, it makes a lot of sense to preserve Topology because that would be the desired outcome I think in 99% of the cases.

In the case of 2 line strips, the result of line break is quite handy indeed and makes perfect sense since there’s two line strips involved and the break is performed sequentially by primitive index.
The workaround outcome is indeed what I would expect considering that we are sorting things along the x axis. The break in there is expected too because we have two line strips at play, so I would not expect the line to be connected, unless we would explicitely say “merge points“, or something like that via some method.

That being said, the use of a primitive POP, which you demonstrated there and @Guillaume.L suggested is something I did not consider for this, and does precisely what I needed, so I don’t think there’s a need for more than that, since I’m not sure this kind of thing will come up very often anyways.

I have a couple other observations that arose from playing with this, but I’ll make new topics for them for visibility.

1 Like