Skip to main content
Bounty Ended with 100 reputation awarded by Markus von Broady
fine tuning
Source Link
André Zmuda
  • 2.4k
  • 6
  • 15

This one works even when the indices are scrambled between the mesh islands.

Node Setup

In the following table, the column Viewer is the mesh island index and the ID is the calculated max point index within the concerning island:

solution

It uses, what I call the Array Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating a copy of all the original points. These are ourone data pointspoint for every original point. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

This one works even when the indices are scrambled between the mesh islands.

Node Setup

In the following table, the column Viewer is the mesh island index and the ID is the calculated max point index within the concerning island:

solution

It uses, what I call the Array Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating a copy of all the original points. These are our data points. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

This one works even when the indices are scrambled between the mesh islands.

Node Setup

In the following table, the column Viewer is the mesh island index and the ID is the calculated max point index within the concerning island:

solution

It uses, what I call the Array Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating one data point for every original point. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

Added description to the screenshot of the table
Source Link
André Zmuda
  • 2.4k
  • 6
  • 15

This one works even when the indices are scrambled between the mesh islands.

Node Setup

In the following table, the column Viewer is the mesh island index and the ID is the calculated max point index within the concerning island:

solution

It uses, what I call the Array Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating a copy of all the original points. These are our data points. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

This one works even when the indices are scrambled between the mesh islands.

Node Setup

It uses, what I call the Array Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating a copy of all the original points. These are our data points. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

This one works even when the indices are scrambled between the mesh islands.

Node Setup

In the following table, the column Viewer is the mesh island index and the ID is the calculated max point index within the concerning island:

solution

It uses, what I call the Array Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating a copy of all the original points. These are our data points. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

fine tuning
Source Link
André Zmuda
  • 2.4k
  • 6
  • 15

This one works even with scrambledwhen the indices are scrambled between the mesh islands.

Node Setup

It uses, what I call the Array PatternArray Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating a copy of all the original points. These are our data points. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

This one works even with scrambled indices.

Node Setup

It uses, what I call the Array Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating a copy of all the original points. These are our data points. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

This one works even when the indices are scrambled between the mesh islands.

Node Setup

It uses, what I call the Array Pattern. I already used this technique in the thread Select a subset of points in geometry nodes?.

The Array Pattern

Geometry nodes don’t provide a way, to store data in arrays. But there is a way to simulate arrays.

Imagine you stored the value of every index of an array on a line with x = index and y = 0. To store a value, you place a point that holds the data on this line. Every time, you want to overwrite the value of this index, you simply place a new point on this line. The only thing, you have to make sure is, that the new point is closer to z=0 than all points at this index before.

To read a value of a certain index, you can simply use the Transfer Attribute node, to read the data from the point, that is closest to (index, 0, 0). In certain cases you have to make sure, that the spacing of the indices is large enough, so that you don’t read the next index point instead of a data point.

Concrete Solution

We start by creating a copy of all the original points. These are our data points. Every data point represents the index of an original point:

data points

Next, we place the data points into our array. We use the Mesh Island index of the related original point as the array index. And we calculate z to z = 1 / (index + 1). And then we simply iterate over all data points and place them into the array. This way, the point with the highest index of a mesh island will be closest to z in the corresponding index bucket. We have to add 1 to the index, because index 0 would otherwise lead to 1/0 which in blender is 0.

filling the array

Finally, we iterate over our original points and transfer the value of the corresponding array index into the ID of the original point.

reading from the array

Explained the solution
Source Link
André Zmuda
  • 2.4k
  • 6
  • 15
Loading
Source Link
André Zmuda
  • 2.4k
  • 6
  • 15
Loading