4
$\begingroup$

enter image description hereI'm trying to understand Geometry Nodes in 3.0 by doing my own modular generator where instances are being generated from a simple base mesh object (see image above) that is then put through a Remesh Modifier using Blocks (see remeshed object below that creates several instances that have constant xy values to create blocks). I've got a setup to create Random Instances of variations of corners and walls and then sets of those based on the level: bases, mains, and tops.
enter image description here However, I can't figure out how to assess the instances to assign particular collections based on the xyz values. Basic if->then filtering based on the xyz values, also determining rotation based on facing. I've gotten the base layer to designate the right collections and rotate the corners and walls properly, but it appears that the min and max z value is for the entire mesh not the z values when x and y are constant. I'm sure what I'm doing isn't the best solution but I think I'm making this way more difficult than it has to be.
enter image description here Choosing Geometry with minimum Z value (does it for the whole mesh not individual z axis) enter image description here Separating out X and Y values to set corners and walls along with rotation. enter image description here Iterations to find Max XY, Min XY, Max X-Min Y, and Min X-Max Y enter image description here Result of Base Filter only displays correct base on z axis where base all has same Z value.

Specifically, the lowest z valued instance for all of the instances with the same x and y should determine a base collection object, and then assess if it is a corner or wall, by determining base corners collection by the highest and lowest instance of x along the y axis, and the highest and lowest instance of y along the x axis. All other instances in the base filter would come from base walls collection (rotating these instances based on the x/y values would also need to be done). This process would be very similar for the top filter based on the highest z valued instances along the z axis. The main filter would be for all in between instances on the z axis.

I'm guessing it is something to do with the selection node but I'm not even sure where to start other with an embarassing node tree that shows that I lack a fundamental understanding of geometry nodes indices and beyond. I'm trying but the documentation in blender is not that helpful and I'm just looking for the right direction to start. I'm able to get some things going, in filtering, but I'm just not sure how to generate a value to create instances where the instance is the highest/lowest value on a particular axis.

This is the blend file https://drive.google.com/file/d/1PolRXHG8LS8UH_CkPDEZR2W-_5f6b_a3/view?usp=sharing where you can see my mess.

$\endgroup$
6
  • 1
    $\begingroup$ File is not accessible. Drive is asking to ask for access. If it fits, better to put it on blend-exchange. (How to add a blend file) $\endgroup$ Commented Jan 18, 2022 at 0:34
  • $\begingroup$ Thanks for letting me know. I updated link and will use that technique once I get back to my computer $\endgroup$ Commented Jan 18, 2022 at 1:34
  • 2
    $\begingroup$ also a detailed text is great - one good sketch is more worth than 1000 words. So i would recommend to add a sketch to make it easier to understand what you want and to attract more people to help you. $\endgroup$
    – Chris
    Commented Jan 18, 2022 at 7:00
  • $\begingroup$ Thanks Chris. I've added some images to further illustrate the concept. What I'm doing is trying to have the very simple base mesh run through the remesh modifier (blocks) and then automatically designate the various module collections based on the remesh shape instead of a base grid. I'm going to go through your process and tinker around because I'm sure I will learn a ton more about how to use these different node combinations for other purposes. Thanks so much! $\endgroup$ Commented Jan 18, 2022 at 12:24
  • $\begingroup$ Still struggling to figure out how to make a selection to go into "Instance to points" node from a base mesh geometry where the math functions determine the point with the highest z value when x and y have the same value (e.g., 3 points, all have x = -10.991 and y=-8.992, but z values are -0.981, 1.018, and 3.016). This would analyze all points, and filter out anything but the maximum z value where the points have the multiple z values where x and y are the same and iterates through the x and y values of all points to make the highest z value selection for each x-y set. $\endgroup$ Commented Jan 20, 2022 at 12:34

2 Answers 2

5
$\begingroup$

ok, if i understood your right, you wanna build a building with multiple floors in geometry nodes which will be built with different parts.

I would start with the basis like this:

enter image description here

The "ground" is a grid, which will be instanced by some parts which are in a collection.

enter image description here

Because the building should be customizable (of course!) we connect the group input to important values.

to be flexible in height, use a mesh line as height builder like this:

enter image description here

enter image description here

Next step is taking the "right" parts for the corners:

Let's start with just one corner to understand the mechanism:

enter image description here

The important part is "index" "equal" "separate geometry".

So the index of the grid will be compared to 0 (in this example) and by this i can separate the whole corner (over the complete height) and then instance on that corner another part.

result:

enter image description here

Note: In my case i had to correct my rotation of my part.

enter image description here

now...how to get the other corners?

of course, you can (and we will) use math, but practice is always safer than theory...so let's find out. Mute the instance on points and just...increase the index and let Blender do the work for you:

enter image description here

Now we learnt:

Blender increases the index by 1 on the y axis. And after that it "jumps" to the next value on the x axis. That's ridiculous easy ;) Thank you Blender!

Now i added some color (set material node) so that you can see better the result of our "corner working".

New node setup (now with two corners):

enter image description here

result:

enter image description here

new nodes:

enter image description here

Now we still compare the index to 0, but additionally we compare the index to a value (which is length) subtract by 1 (because the index counting starts at 0) and get the maximum of that to select our points.

Why does this work?

let's count:

if our length is 5 and we subtract by 1 results in 4. So if our index is 4, the result of the new Equal node is 1. And the maximum of 1 and 0 (because now of course our index is not 0) is 1. That's why we got two piles of orange cubes here.

now the last two corners are pretty easy:

enter image description here

Just compare width * length - 1 (-1 because index start at 0) to index. And width * length - length to get the other corner.

All that of course combined with the maximum of all to the resulting mask.

result:

enter image description here

total node tree so far:

enter image description here

Now let's put something on the roof:

enter image description here

this time we separate our geometry from the mesh line (which are our levels) and separate our highest level (the roof) and instance on that some other geometry.

result:

enter image description here

yes, that's pretty boring.

Let's get some randomization in there.

So plug in a distribute points on faces in there with poisson disc...and now...tadaaa:

enter image description here

That's pretty cool.

node setup:

enter image description here

Now we separated our mesh line via its index, instanced the grid on it and on that top grid we distributed (freely) our points so we got the randomization. If you don't think now that geometry nodes is just awesome, i cannot help you.

Note: Yes, i am a poor modeler, that's why my windows look like shit. Yes, you could also improve this by a lot of things. e.g. I didn't correct the rotation of the corner parts, but i think it should be now clearer, how to use index in geometry nodes and that you can build really cool stuff with it.
$\endgroup$
4
  • $\begingroup$ Chris this is an awesome explanation of how to generate the building from a grid which I will certainly utilize for other structures using the modules I have. Geometry Nodes are very awesome, but whatever grasp I thought I had on it was obliterated in 3.0 with all of the new nodes. I didn't have a very good grip anyhow, and I'm guessing this is more in line with how it will operate in future iterations. $\endgroup$ Commented Jan 18, 2022 at 12:16
  • 1
    $\begingroup$ Thank you!🤗🤗🤗🤗🤗 $\endgroup$
    – Chris
    Commented Jan 18, 2022 at 13:00
  • $\begingroup$ Chris, How did you get that “equal” “integer” A B node. I’ve gone through all of the math and utility nodes and the closest I could find is compare floats $\endgroup$ Commented Jan 19, 2022 at 12:09
  • 1
    $\begingroup$ @JayC.Besch: check this out: [1]: i.sstatic.net/tP0IC.gif $\endgroup$
    – Chris
    Commented Jan 19, 2022 at 12:42
0
$\begingroup$

So the solution to a dynamic base mesh is to use "Normals", "Capture Attribute", and "Delete Geometry" (set to points) Nodes to select different points on the Remesh Modifier, then run that output to the Collection or Object Nodes for the modules. You need to set this up with filtering using Dot Product (Vector Math-set to points), Compare Floats Node, and Booleans (Math Node) then run those to the Delete Geometry. I'm guessing there are other ways and maybe better ways to do this, but it works. enter image description here Here is the top filter and the other parts are similarly constructed comparing x,y, and z positions. enter image description here

$\endgroup$

You must log in to answer this question.

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