Capturing Attributes - Geometry Nodes 101

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to geometry nodes 101 in this session we're going to be looking at the attribute capture node this one is a really useful one because it allows us to actually break context what is important about that well fields are computed in the specific context that you plug them in if you watch the previous video then we actually talked about how the node trees calculate but essentially what i'm meaning if we have a look at this setup here i have a little displacement setup going on the set position node is the context right and in this position here here we find the position and the normal i'm going to call them attributes and essentially these are the the spreadsheet columns right so the contact is very important because we're using it in this position that is what this means the attribute capture node allows us to essentially find what the position in normals would be on the mesh right here and use that information later in a mesh after it has been processed let me try and give you an example of when this would be useful let's say you have a mesh which has a very specific shape and you want to distribute points specifically on let's say faces with a normal which points straight up in the z-axis you also want to distort this mesh maybe for an animation or something like that so you don't want your distribution to be changing you know you want your mask for that z-facing face to be continuous even though you have displacement so you can capture the normal and then displace the mesh and use that captured normal in your calculation to make the selection for the distribute node we're going to be digging into it a little bit more now i'm going to give you a little bit of a different example i have a node in my toolkit called wire flood and what it does i'll just show you here so i have my uh i have my object and if i just join in the wires here then you can see true to its name it floods wise i can crank the density and you can see that we have loads of different wires once you've sorted out the end points i can make this real mess of cables the technique is going to be using attribute capture i'm just going to delete all of these nodes and i'm going to add a mesh primitive line so i have this line here i'm going to actually make it go in the x axis and i'm going to make sure that we only have two vertices all right so we only have vertex 0 and vertex 1. and if i look at the spreadsheet as well in the top left here we can see that there we have vertex 0 and vertex 1 and we can see those positions now i want to do a little bit of work to this i want to add a subdivide so mesh subdivide mesh and this is giving me a third vertex so i could set you know an arbitrary number of subdivisions here and then i'm going to use a set position under my geometry nodes there and i'm just going to plug in a noise directly so grab a noise texture and i'm just going to plug the color into that offset you can see this has gone way over there this is fine but i want to maintain my end point positions being here and here right so it comes up and it does some squiggles in the middle and it comes back down and then we can subdivide it to smooth it out but right now i don't really have a lot of control for that now granted i know that we do have under the curve we have an endpoint selection node for the sake of this example i'm not going to use that we're going to go with the attribute capture method but i do i do know it's there so what i want to do is i want to capture the index that zero one before i subdivide and then i'm going to use that as a selection on my set position so that i can not move the end points so let's go ahead and add an attribute capture node up here attribute capture attribute sorry and i'll drop that on there the context is really important here i'm actually going to leave this with float and i will explain why in just a moment as well let's go ahead and use an input index so this is passing out an integer but there's something happening in this subdivide that i want this to be computed as a float value i want to use this now this 0 1 as my mask so basically i can say pick anything which is not 0 or 1 and use this as the selection in my set position easiest way for us to do this is to grab a utility compare float grab my attribute in here and i'm going to look for where this is equal to 0.5 i know that sounds like a little bit of a strange thing to do i want everything which is not zero or one so if i say equal to 0.5 within epsilon which is your bracket of 0.49 then that's essentially going to select everything between 0.01 and 0.99 right so your epsilon is like how big is the bracket on each side of your threshold so i'm going to say that 0.49 for the epsilon and i'll plug this into my selection so now you can see what's happened is if i change my scale on here we're moving around this displaced bit and it would be more accurate really for me to use a vector math subtract 0.5 right to put this back into the middle so that we're not getting any kind of net move let's talk about what's actually happening to the data here because this is a little bit confusing i think and we can smooth this out right with a mesh subdivision surface mesh and then i can give it a few levels so why does this work we have our index but it's also going through a subdivide mesh if you've been following the development for geometry nodes then you may have at certain times heard the term anonymous attribute an anonymous attribute basically is just an attribute which does not have a name right so in the spreadsheet we can see attributes like position this is a named built-in attribute an anonymous attribute is an attribute which exists within the node tree but it does not have a name it doesn't come up on our spreadsheet and in fact if i hover over here we can see that we have a field based on the attribute from the attribute capture node so it is kind of generating an attribute and that means that it is holding it on the mesh when you subdivide a mesh it will interpolate between the points right and this is why we left it as float because i want values between 0 and 1 let's say you add one point it's going to be 0 0.5 and then one or if you add i think in this case three when we did two levels it's then going to go like zero point two five point five point seven five and then one so i can select everything which isn't those exact points and because it's a float and it got stored as a float in our spreadsheet as we subdivided it we end up with this kind of these values in the middle so doing this capturing attributes at various points allows us to break context it allows us to use data that exists in the state that it did you know a few steps ago and it will be passed through the same mesh operation so you do need to kind of be aware of that it's not just going to be like a zero everywhere where you have a new value it's going to interpolate in between when you do a subdivide so if we think about the actual flow of data here and you know you don't necessarily need to do this while you're working but it can be useful just while we learn just to make sure that we know what's going on we have our mesh line coming in here and then it's going to come forwards to our capture attribute nothing is happening at this point it's just writing the index to the spreadsheet and then it's coming forwards it's doing the subdivide mesh and then it's coming forward to do the set position and this is doing two things right it's finding what the selection is so at this point it's going to come back and it's going to calculate all of this field stuff and then it's going to find out what that selection is so it will only compute for the data which is within its selection this means if you have a mesh with 20 million vertices for example but your selection only picks five of them then it's only going to be computing the field uh to change those five vertices it's not going to do all of them and then like mask it it's just going to specifically pick your selection so once it's worked out it's selection it's then going to come back to this step position and then it's going to find out the offset and this is going to come back down here and it's going to look at the noise texture which if you don't plug anything in it's just going to be driven by the position so if you don't have a custom position to use then don't worry you can just leave this open so it's going to read this and it's going to come back up here and it's going to put that into the context of the geometry at this set position node so i know there is in terms of like the computation it's a little bit back and forth but it's actually once you get your head around the logic it's a lot lot simpler we just think of things more linearly you know i want to take my index and i want to take it from this point and use it later that's all i have to think attribute capture allows you to break out of the context that the geometry nodes are using and that is going to allow you to be so much more creative in doing really interesting stuff like my wire flood node which just lets you put wire everywhere so do you recommend that you get used to it and also join me in the next session where we're going to be having a look at the attribute transfer node interesting see you there [Music]
Info
Channel: Erindale
Views: 18,032
Rating: undefined out of 5
Keywords: attribute, capture, b3d, blender3d, geometrynodes, geometry nodes, procedural, parametric, design, workflow, node, nodevember, tutorial, lecture, easy, beginner
Id: tgIdMtXjGCw
Channel Id: undefined
Length: 9min 18sec (558 seconds)
Published: Fri Oct 29 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.