Friday, May 20, 2022

Blender Geometry nodes and Grasshopper Rhino twisting tower comparison

So we're gonna compare how we array essentially one floor level in both blender and in rhino and grasshopper to make things exactly the same i've modeled the single level put it in the collection in blender and then imported that same level in rhino so here's the level that we see here and here the results that we get by .

Weighing that and rotating that level within grasshopper now as you might know in grasshopper you can do many more fancy things but in blender again it's still a little bit limited and that's why i want to compare apples to apples and not apples to oranges so let's get back into blender now and .

Show you how this is done so this level is done in a collection right so we have something it's really straightforward it's just a simple level i've put this in a collection called lore and then here you can see the different ways that we array it with geometry notes and they're using all the exact same .

Geometry nodes as you can see with just some differences so how can we tell the differences we can see them over here where it says geometry notes so we have a count so we can change the count so let's go to 25 and now we have 25 floors and if we change the property code rotation factor and we can see it .

Really starts to rotate it's pretty cool we can duplicate this multiples of times and the great thing about the way that this is working in blender as instances is that it's really really performative it's super performative it's there's no lag at all .

About moving with these now if we do the same thing in rhino i have tried it it does start to lag a little bit more in fact even with these if i go and edit one and what i've done here is something slightly different where we have three examples so if we go to this one number slider it even takes a little bit of lag to start generating .

That right it's not as instantaneous i'm just going to put this back to 32 here so that's kind of how they work that's the setup node so we don't even need to look at all of this once we've generated an example once let's walk it through one of these so here i have one picked let's see what's going on so we have a .

Group input in the input we have the count and the rotation factor then what we're doing with that is essentially creating a line if you would like to support the work that i do and get access to the files they are available on patreon in the link above i will show you exactly how it works .

So there are a number of lines and they repeat and the height of them is 3.2 meters which is i know the height that i modeled for this level here so the value of the height is going in here in the z direction and then in the offset direction so then we're getting in this case 21 lines that are 3.2 meters tall so what's the driver of our .

Rotation because in geometry nodes there is no way to set indices yet or get information about different indices i found a really quick way and really nice shortcut to do that and that's with an empty the distance between let's say a position on the line that we just created and the empty varies so that gives us this kind of more dynamic .

Relationship with a field it's almost like an attractor field that we get so that's a trick that i use quite a lot with geometry notes is having something like an empty and then what we're doing is calculating the position of our lines to the location of our empty and we're creating a new attribute that we are calling dist for distance then that .

Attribute we're rotating by rotation factor the rotation factor is just a multiplier of the distance between the empty in fact if we go back and plug in everything as is and move the empty around you see how the building start to rotate now it doesn't matter in this case where the empty is but i have put it in the .

Center with the idea being that the taller that the lines go the more they rotate that's the important element here it's having a difference between all the index values in a list then that distance all we're doing is converting it as an attribute it's an attribute and we're converting that to a rotation and we're .

Doing that with a node code attribute combined where we only care about the z and the z relationship and we're calling that rotation so once we call that rotation it overwrites the existing rotation parameter and then we can instance the collection we're using this floor collection here .

Based on these points so that's the first output here so again it's a when you think about it it's really straightforward we've got our base geometry and we're creating lines and the height of where the lines are matches exactly our typical floor level height .

And then all we're doing is measuring the distance between each line's point and the ground which is an empty the higher we go the bigger the distance so that's determining the rotation factor and then we can multiply that rotation factor with any value that we want here which i've created over in this area next we .

Have a core and the core is super simple so let's check out what the core is so that's the core very straightforward and let's turn all these things back on so we're placing the core in there and lastly we're placing the roof now with the roof there's a few nodes and the reason for all these nodes is to make sure that we place the roof at the top .

Because we don't have index so we cannot get the last index in geometry nodes yet of a value we have to go and do a couple of tricks here the first thing we're doing is getting the count and we're subtracting it by 1 because computationally all the counts start from 0 instead of 1. and then .

We're multiplying that count so it's the number of floors so that's the height by the individual floor so 3.2 times 20. so that's the height the z location of where we need to put the roof so once we have that height we combine it into a vector and then what we want to do is make sure that the roof has the same rotation as the rest of the faces is the .

Top face to do that we have to do the same thing that we did up here which is get the rotation value right so we're first figuring out the distance between the empty and our top value then we're multiplying that by the same rotation factor that we have already set up and then creating a z-axis and we're .

Transforming that with the rotation vector and then the translation gets plugged in here and we have the geometry so all we're doing here is transforming our geometry removing it and we're rotating it where we want to and that's the final result so that's pretty much it so with this we can create multiple variations if we want to .

We can always go back to the floor and add more detail if we need to to get this kind of result so it does become quite flexible i really like this approach again i wish geometry notes had a few more notes like i'm very used to working with lists the way we work in grasshopper which doesn't exist here yet so we have to trick it a .

Little bit and that's what we're doing with the empty so why would you want to do this even if it's straight performance reasons so if we get the same floor and we array it it would not perform as well as this here does in fact let's go with something crazy 130 floors we'll do the same here .

230 floors and here let's go to 350 floors too tall right really tall but you see it's a lot of geometry information there and there's zero lag whatsoever in here because all these are instances so computationally it's really nice to see that this can perform so well so that's where i see a lot of opportunity about .

This it's doing things like this where we just have to erase something that's fairly simple and maybe give it a twist or a slight deformation and yeah super happy with the result now let's check out how this is built in grasshopper so here's our floor exact same components we'll start with the simplest one so how do we make this so .

Once again we have a factor of 3.2 which we're converting to a vector so we get a 0 0 3.2 pretty much the same thing we're doing in geometry notes and then we're creating a linear array so we're getting the mesh i'm putting it in a group otherwise the linear array will get messed up so this is a grasshopper group not a rhino group .

And we're saying the direction in which it moves so really straightforward in fact this is where the information is then i move it a little bit later and then to get the floor up we have the number once again and i didn't use list index in this case like you would typically do in grasshopper just to show .

Parity between the way we would do it in grasshopper and in geometry notes we're subtracting one number we're multiplying the factor to that so 3.2 times 22 stories to get the top height and then we're just moving that roof element component on top over here and then combining that so .

This is fairly straightforward because we don't have rotation now with the rotation it gets a little bit more complicated but not terribly so so we start with the height so 3.2 meters floor by floor and then the number of floors so 12. we're multiplying that and we're this time we're constructing a domain it goes from .

One end to the other so we have a number of steps so that's good so instead of using a distance to an empty which is essentially a domain when you think about it we have this built into grasshopper then we're converting these into z z vectors so these are going to give us the height .

So then we first position our floors in that location but now we have to find a way to rotate them so we're using that range again we're creating the vectors which are going to be the positions from which we rotate each level and then we're doing a simple multiplication here so this is our factor so this here is what helps us start to rotate it so we .

Get the height and we multiply it by a small factor and then we plug this into transform and then euclidean rotation so what do we rotate we rotate rotate our geometry so the angle is this multiplication and the plane we're creating is the points that we're instancing .

Those elements in that's how we get the twist so if we change this factor here and we're changing the amount of twist that we have for each level and this is the part that i really like about grasshopper now our list right so list item so we're getting the last item in our list and we're doing that for a number of .

Things first we're doing it for the list with the z points so we can find the last point so we don't need to subtract anything and we're doing that with the rotation so we're getting the last item in the rotation and the plane list to first to move our geometry in the right place and then in there rotate it .

And you can see the difference of the rotation and then that's all grouped together so that's how this example here has been done so if we move and rotate you see how we move and we rotate this around so what's the difference the difference is is having access to list items at the moment otherwise .

Everything else works in a pretty similar way surprisingly so now let's talk about the third example here which is the exact same thing here so we multiply the floor in fact what i did is just duplicated this and created it down here this last part is just for me moving it so we've duplicated we .

Constructed the domain with the points we broke that domain down on the number of floors and that domain gives us the z coordinates of the instancing of each point we move our floor onto those locations then we rotate based on a factor and we can set that factor to as small or as big as we want to .

And we rotate the geometry that's already in those places with the planes that we've set up which are just the set points but they have to be vectors and with the multiplication factor and then we get the roof again we're just listing the last items of all these groups here .

And first moving the roof to that location the topmost location in our list then rotating it with that same point with the angle that's specified as the last index that's it as you can see here we could have a little bit more flexibility but geometry notes is flexible in a different way if you noticed .

In grasshopper we've needed to build three separate note trees for each of those different buildings there's no way to recycle that data there is we can make a group definitely and input these and output those so that's one way to do it and we can duplicate that group three times but the way that it works in .

Blender as an experienced grasshopper user i find it really refreshing that we're building just one definition there's no need to group even though in blender we can also create groups that are replicated and we can move them around and then if we duplicate this element it has the exact geometry node set up .

Already so we only do it once let's change these numbers to something a little bit more normal maybe a little bit higher there you go and this one like that so yeah we've got these floors here and we got this definition that if we duplicate one of these buildings we can .

Change these numbers independently super cool really flexible i really like that system because as we already demonstrated we can create a city of twisting towers or less twisting towers if we prefer in a very quick amount of time let's check it .

Out so you won't be able to do this as quickly in grasshopper you can do it if you know what you're doing but still you would need to think a little bit more about the setup than you do here here we're very quick with it and now we're getting away from the center line so as you can see we're .

Getting these actually interesting effects you know the distances and how it's not linear anymore the distance between the top and the bottom item because we have an angle with an angle from the empty which is located i believe over here somewhere where are you empty there it is it's a little bit hidden .

Let's make it a little bit larger so we can see where it is i think i don't have the empties of a round is that it yeah so you can see if we if we move the empty up and down we get this really cool effect of everything dancing right really nice all of this is going to change this tree is going to look .

Completely different in blender 3.0 which is coming out i don't know when in month or two months or three months that's all right we'll redo it but some of the flexibility is going to be exact same thing the geometry notes will be a modifier here where we can add properties but we just won't be able to use .

Attributes like we do here which for these simple examples works really nicely but for more complicated things it becomes rather limited in my own experience so i'm quite happy about the upcoming changes thank you guys for watching and again the files are available on patreon in case you would like to support me and see you next time .


Most Popular