5
$\begingroup$

I'm trying to place objects in a grid pattern but I don't want a regular grid where I set column and row count. Instead of column and row I want to set the column and object count and if the count of objects is greater than the columns then it should automatically create a new row. Like in the picture there is a column count of 4 and object count of 9 when objects are greater than 4 it should place objects on a new row and when greater than 8 place on a new row and this should go on indefinitely. I believe it's possible to make something like this with the Grid geometry node but I don't know how. Maybe if I create a grid and make it 4 columns x 1000 rows and then only fill some of the grid cells based on the object count.

.

$\endgroup$
1
  • $\begingroup$ If your question has been solved, please be so kind and mark the answer that contributed to the solution as "Accepted answer" so that this question will not continue to be displayed as unsolved. Thank you! Here you can find more information: What should I do if someone answers my question?. If you still haven't gotten a solution to your question, please be kind enough to address it. $\endgroup$
    – quellenform
    Commented Oct 24, 2022 at 9:33

2 Answers 2

5
$\begingroup$

Here's a Geometry Nodes setup you can use where you have the Number of Objects and the Number of Columns you can adjust.

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ A discussion related to this setup can be found here $\endgroup$ Commented Dec 8, 2023 at 11:08
4
$\begingroup$

Divide the number of your objects by the number of columns.

Round this value up, then you get the number of rows.

The size of the grid results from the number of columns, rows and the given width of an object.

After you have created your grid, use the node Instance on Points.

However, pass a selection that contains the number of objects as the highest index.

enter image description here

Sorry, it didn't occur to me until after I made this post that it's actually largely identical to @HarryMcKenzie's.


Update

Here's another technique I came up with to go along with it:

enter image description here

Instead of using a grid as a base here, I just duplicate the given object and move its position with a little logic.


(Blender 3.2)

$\endgroup$
5
  • $\begingroup$ Hey no problem! your solution is definitely better because it uses lesser nodes! You're the geo nodes expert :D $\endgroup$
    – Harry McKenzie
    Commented Aug 17, 2022 at 9:01
  • 1
    $\begingroup$ @HarryMcKenzie Thank you for your praise, I really appreciate it coming from you ;-) $\endgroup$
    – quellenform
    Commented Aug 17, 2022 at 9:05
  • $\begingroup$ <3 btw I was surprised that you're able to directly use index. in my case the index was not as ordered as in your case that's why I needed to position the instances with some additional math. what is going on XD $\endgroup$
    – Harry McKenzie
    Commented Aug 17, 2022 at 9:11
  • 1
    $\begingroup$ @HarryMcKenzie This is because you created your grid in the other direction. The indices of a grid always run along the Y-axis first (That's why I rotate the whole grid again by $90°$ at the end). $\endgroup$
    – quellenform
    Commented Aug 17, 2022 at 9:22
  • $\begingroup$ aaahhhh cool thank you! $\endgroup$
    – Harry McKenzie
    Commented Aug 17, 2022 at 9:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .