Attributes?! - Geometry Nodes 101

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
attributes what are they how do we use them how do they work and how are they going to change moving forwards 2.92 is about to be released and with it geometry nodes is going to hit the mainstream so if you've not been working with the experimental builds and you haven't used tools like houdini the attribute workflow is probably going to feel a bit weird but honestly it's really simple what is an attribute an attribute is just a string of characters that we use to reference data for example position is an attribute that contains the x y z coordinate of every point within a geometry this plane for example here this has a position attribute containing four points so we are working with indices so starting at zero we've got zero one two and three and we can see that each one of these has the coordinates example minus one minus one zero minus one one zero one minus one zero and this final one here we have one one zero to make this make a little bit more sense i've gone throwing these into a spreadsheet don't be fooled by the colors this is just using libreoffice spreadsheet i've just set it up to look a bit more like blender for this so you can see what i've done is we have our indices down the side and then we have a a position and the v here is just for vector and then we've got our x our y and our z position is what we call a built in attribute meaning that any time that you use it it's going to be talking about the specific part of that geometry so in this case the position of the points equally if you would use rotation or scale blender is going to assume that you are wanting to be talking about the rotation or scale now another thing to consider is that different attributes use different kinds of data as well so let me just show you through the other built-in ones first and hopefully this will become clearer some of them are built in meaning that a geometry has them by default and that's position and then some of them are reserved names which means that they get generated at certain points for example scale and rotation these ones get generated within the geometry nodes tree to handle instancing on points so the scale is going to be the scale of the resulting instance or the rotation of the resulting instance and both of these are vectors we then have radius this is another reserved name one and this one the f is for float so basically like 1.5 or 2.3 or 3000 these are float values the next one we have is the material index this is which slot the material is in whether that's zero being the default slot or one two three and so on and this one's an integer right there's is for integer just meaning whole numbers following this we have temperature being another float generally measured in kelvin uh temperature and density these are usually to do with volumetrics next one along we have got normal normal is a little bit of a tricky one because we don't always have it so normal is currently generated only by the point distribute node the last one we have on here is the id and again this one's an integer when you use a point distribute it generates an id per point and this is different from the index indexes like zero one two three the id that uses a very high number basically just to differentiate between different points for continuity so these are all of the ones that we would call either built in or reserved name meaning that any time you use position scale rotation radius etc as your attribute name you will be writing to these specific columns in your spreadsheet but what about other stuff so on top of the built-in attributes we can also use vertex groups we can use vertex colors and also uv maps okay so cool we can use a few other attributes within blender but what about when you see somebody using just sort of random strings of letters and numbers how does that work well whenever a node outputs to an attribute it will either overwrite an existing column of the same name so for example if you output the position attribute it will just overwrite what is in the position attribute currently and if you are outputting to an attribute name that is not one of these predefined ones then what it does is it just tags a new column on the end so every time you have a new attribute you get a new column and these don't necessarily mean anything until you connect them to for example position or scale it's just a way of storing data for you to use okay i'm going to walk through a little exercise using 2.92 so we can get a handle of what's actually going on so what i've done is i have just appended this little tree it's just made of cones as you can see here with some bevels and a kind of cool shader we're going to basically spread this around on top of this plane so i want this plane to be bigger to begin with i'm going to scale it 10 times there we go and quite important when we're working with instancing stuff on other geometry you need to apply the scale because otherwise your instance geometry is also going to take that local scale now what i'm going to do is i'm going to add a few subdivisions just so that we can try something with vertex weights let's just select some of these and i'm just going to hit ctrl g assign to new group now if i go into my object data properties this green triangle we can see that we have group capital g i'm just going to rename this one to trees currently i have my shader editor open so let's change this to the geometry nodes editor with our plane selected we can click new and this is going to create a new geometry notice tree as you can see we've also added a new geometry nodes modifier the next thing i want to do here is a little bit of point distributing if we don't use a point distribute node then what's going to happen is we're going to distribute our object in this case our tree across the existing vertices so point point instance is here drop this on and select my object here we go so you can see what's happened there we just have this grid formation what we actually want is a point distribute node so shift a point distribute at the moment super dense let's tweak a few things here so this vertex group that we made here trees trees is now an attribute for our geometry so the geometry comes through here on this noodle and any attribute related to it essentially the whole spreadsheet you can think of it that way the whole spreadsheet is coming through this noodle into the point distribute so we can use the density attribute trees lowercase t remember we need our case to match and there we go you can now see that the area that i left out of my vertex group has now been occluded from the selection sweet so i'm also going to make sure i'm using cross and disk because i would like to have a little bit of spacing around my points okay something like that just to make sure they're spaced out nicely now the next thing i'm going to do is i'm going to affect the rotation so we can do this with attribute randomized node so let's go up here attribute randomize what i said before built-in attributes whenever you use them you are writing to that column of the spreadsheet so if i go in here and i type in rotation then you can see that everything gets rotated by this random value and at the moment we have a float in here something important to note if you have a float value coming in like this and you're being read as a vector like this then it's going to plug your float into the x y and z of your of your vector so that's why we get this kind of effect when you plug a float in but it also has a bit of strength right if you use this for scale you'll get even xyz scaling so that can be really useful just something to be aware of so i'm going to change from float to vector because we need a vector rotation and i don't want to rotate x and y so let's change our max there and i'm also going to make sure that we're going a full circle so that's 2 pi or we can write tau t a u now we have random rotation for all of our points i want to have some random scale but i want it to get bigger around and empty so let's add an empty here i'm just going to bring it up so we can see it so we have an empty and we have our trees so this is where we can start writing custom attributes to do what we need to do so let's create two random sets of size right so let's take an attribute randomize drop it in here and to begin with just so that we can see what we're doing let's call this one scale so again we're calling it scale it gets written to the scale everything gets scaled i'm using float this means that everything's going to get scaled evenly x y and z and i'm just going to set my minimum to like point five to one i think that's probably fine just so that we have some little ones and some bigger ones so this is my small scale right so i'm gonna call this one scale one i'm just renaming that to scale one you can see all of our scales have been reset to a value of one and that is because this is no longer overwriting the scale column this is now creating a new column called scale one let's bring up our spreadsheet here and we can just start adding these in so what we've got so far we have rotation and this is coming from our randomized node right and then we've also now got scale which we can see at the moment is being output is just one in each case obviously our list should be much longer than this our list is as long as the number of points that we have we also have now just generated this one called scale one so sorry i should not have capitalized these these should be lowercase so lowercase rotation lowercase scale now we have scale one that we made so this one is also from a random and then i'm going to make another one so duplicate bring it along call this one scale 2 except first of all we want to see what we're doing so let's actually call this one just scale and let's make this one a bit bigger so in this case we're going to go from 1.5 to 5. right just make them really big and then i'm going to rename this from scale to scale 2. so at the moment we're not doing anything with them we're just storing these as data right so scale now we have another one called scale two i'm not suggesting that you write a spreadsheet every time you work i'm just doing this to help visualize what we're doing cool so now i need to mix between these and output an actual scale so we want to add an attribute mix node so shift a attribute attribute mix drop this on here and what we've got is just like a mix rgb node this time we're using attributes and we are outputting an attribute so this is how we can convert our scales mix between our scales and output to the actual scale that changes the size so we're going to take scale 2 just hover over this ctrl c ctrl v into attribute a same for scale 1 ctrl c and then control v into attribute b and now we are outputting scale so this is the one you can see that it's actually gonna now change the size because we're writing to a built-in attribute this tells blender that it needs to do something with this data i want to get it to to move around with the empty so to do this what i'm going to do is i'm going to work inside our note tree still i know some people like to use the vertex weight proximity personally i think this is a little bit fiddly and it doesn't actually deal with the points that you're generating with the point distribute so what i'm going to do shift a input object info and now we can pick the empty as our object now what i'm going to do is i'm going to calculate the distance between each of our points on the mesh so the position of each of our points and then i'm going to output this as a distance so this has to happen before the attribute mix because we want to use the distance attribute as the mix factor so we need this attribute defined beforehand i've made some space here and i'm just going to add an attribute vector math node so let's drop this down here what we're going to do is we're going to change this from add to distance down here we're calculating the distance between the position right the built-in attribute that tells us where all of the points are and type b is going to be our vector we're going to use the location so this is now calculating the distance between the empty and every single one of the tree positions now the output for this i'm just going to name this distance as a new attribute that we've made so i'm just going to throw this on our spreadsheet again lowercase distance there we go and our scale is no longer 1. our scale has been overwritten with that mix this mix node here outputs to this scale and therefore this column is now being overwritten by that mix node because the attribute name matches hopefully this makes some sense it becomes more clear the more you do it so i definitely recommend just trying out i need to calculate the falloff here so we're going to add an attribute math node on here we can change this to divide and what we want to do is we're going to take our distance here ctrl c ctrl v so i'm just pasting that into attribute a and we're going to change attribute b to a float and what we want to do is we're just going to take the scale of our empty float value and this basically means that when we scale our empty this will affect the fall off of our scaling let's come back in here i'm just going to overwrite the distance attribute one more time we know our position distance distance is then having something done to it and is being overwritten to distance so we still just have that one column and now rather than having the mix factor be this float we can set our mix factor to be an attribute and you guessed it it's going to be that distance function so you can see kind of what's going on here the issue is that when it gets smaller because we have a linear interpolation between one and the other so basically we have two points as our two scale values right so scale two is the big one and scale one is the little one and a factor of zero to one is going to be in this space however if you go for a factor greater than 1 or less than 0 then you are just going to extend this line so at some point this is going to go into the negative and that's why stuff goes upside down so we need to clamp it there's no attribute clamp node however there is an attribute color ramp and if we've learned anything from shaders that color ramps clamp so let's just use this here so ctrl c paste and paste and there we go now what we've got is our attributes being clamped correctly that looks really cool nice now if you ever want to just keep a node tree on screen when you're clicking on other objects because this is really annoying you just click this pin this sort of thumb tack up here and that's going to allow you to basically pin the node tree if you want to still see your original geometry then you need to use a join geometry node so this is because when you do the point distribute you're replacing the original geometry wholesale with the generated points now this can be really useful sometimes you want your original geometry back though so what we do is add a geometry join geometry node and we take our original geometry coming in here drop on the point instance and output our geometry and there we go now we have our proper plane back there we go cool so there's that hopefully this was somewhat useful i know it's a little bit long-winded but i think it helps see how things work and especially when you start imagining the spreadsheet that can really help you kind of visualize what's going on for me anyway i like to think that we've added this column and it's a float value always added this one and it's a vector so the future 2.93 is already here and if you want to be using geometry nodes i wholeheartedly recommend that you're using 2.93 not 2.92 stuff like the uh the attribute math node in 2.92 has add subtract multiply and divide let me just jump over into 2.93 and the attribute math node in here has every function that we want furthermore we have all of these additional nodes that we didn't previously have things like combine xyz separate xyz attribute proximity attribute sample texture this allows you to do displacement very easily attribute math like we mentioned has everything now the attribute randomized now has add subtract multiply on top of the default behavior of replace create we also have a few additional nodes like uh simple subdivision being separate to the capital clark smoothing subdivision join geometry now has this nifty multi-input socket which you can see is pretty cool you can plug in as many things as you would like in here something like that so that's cool and also another thing that's really cool from the last few days is we now have a string node so instead of having to think where are all of my attributes now what you can do is you can just type in something like position and everywhere you want to have the position you can just go ahead and plug in your string node so this is an input string node if you want this in 2.93 lots of very cool things happening and it's happening all the time let me show you some websites where you can keep up to date with the news so the dev talk is a really good place there's always stuff going on people posting all the time uh we also have the blender chat this one's very cool a lot of stuff going on here and something really interesting happening that i just found is that we have things being spoken about these are super early days for the kind of the consumption of these functions but things like inspect attributes becoming maybe a more visual thing in the 3d viewport which would be very cool very useful and then also we have things like the rgb statistic node this one's being developed although it hasn't yet been added in the lookup attribute so for example if you don't want to have to remember all of these attributes at some point we're going to have a proper lookup function so that's great and here is some more stuff about that the spreadsheet i was talking about it was confidence because we've seen mock-ups this was august of last year and just today we also got this mockup from delay with the id mask position xyz random values and seam so there's a lot of stuff going on this one's a good one i will link specifically to this because it has a lot of stuff about things like domain and filter that it's just worth knowing about it if you want to be kept right on the bleeding edge then i recommend you jump onto the geometry nodes project i will link this down in the description and just sign in and click the watch project this will email you with commits ongoing updates and things related to geometry nodes every time somebody comments or commits or updates a task you will be alerted to it so there we go lots of really cool things coming to blender over the next few months the attribute workflow is kind of confusing to begin with but there's a lot of power to be had there so i definitely recommend getting into it and it does honestly it makes a lot of sense after you've used it for a little while and especially now that we have things like the string node this is going to be immensely useful and as soon as we get spreadsheets natively going to be golden that's all from me hopefully this has been useful and informative and i'll catch you next time
Info
Channel: Erindale
Views: 31,797
Rating: undefined out of 5
Keywords: blender, procedural, material, nodes, introduction, tutorial, blender pbr textures, Blender 2.8, vfx school online, blender tutorial, blender eevee, blender easy tutorial, blender cycles, intro to blender, blender 3d, b3d, learn, free, concept art, parametric, computational, design, geometry nodes, everything nodes, attribute
Id: R_cQogD0KJ8
Channel Id: undefined
Length: 19min 15sec (1155 seconds)
Published: Mon Feb 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.