the time has finally come to decorate our delicious looking donut with some sprinkles so the feature we need for that is called geometry nodes and you can access it by going to the top of your screen if you don't see it just middle Mouse drag across and you'll see the tab geometry nodes ohoo so it's adjusted your screen layout don't get disorientated your Don note is still there this screen on the left here it's called the spreadsheet never needed it touch on would never will um so we can just close that right click join areas and then just collapse it into it okay so with your icing selected click the new button so welcome to the world of geometry nodes so geometry nodes is actually a modifier so when we hit new there we've added in a modifier called geometry nodes and what the modifier is doing is whatever we want it to okay so what this this section down here is this is a node based system and it looks familiar right you got boxes with little Lin lines and it's the exact same type of system that was used in our materials right but it's a completely different system okay so the same nodes will not be referenced um between the completely different systems so the way this works is our mesh that we've got here of our icing is what is being represented on the left hand side with your input it's then taking that mesh and it's feeding it all the way to the right and it's going to spit out whatever is in your group output So currently nothing has changed because there's nothing between those points but if I was for example don't follow me but just as an example if I was to add a set position node drop this in here and then change the position of the icing along the Zed axis you can see it's raised it okay now the mesh if I go into edit mode is still there the mesh has not changed so we're not actually moving the object this is just happening after the fact via a modifier okay now obviously this would be a rather pointless use for geometry nodes to move move it cuz you could just move it um but as an example let's say I don't know you had a scene where lots of objects some of them are raised some of them are not and you wanted to quickly change them what you could do with geometry nodes in this case you could actually expose this offset value by dragging it to the left over here and when you do that you can see it's now appeared over here in our modifier stack what that means is whenever I'm in another part of B of blender say I'm like building stuff and I'm like oh yeah I need to quickly you know change the the height of that icing I've got it there whenever I need to so essentially this system enables you to build your own tool that does something that you want it to do in a really flexible way so it's really powerful um and before geometry nodes I mean blender was kind of limited in what you can do but I'll throw some examples here but in the last 2 years since it's uh been in blender people have done some wild stuff with it um and most of this stuff really was just not part possible in blender before without doing custom scripting so it's really opened up the doors so it is a very different system like it's a different way of working um than you know just Hands-On in 3D but it's a really flexible really valuable um system so any time spent learning geometry nodes I think is time well spent so we want to do sprinkles and to do that we need to first of all scatter some points onto our mesh so to do that hit shift a a for ADD and then we're looking for Point distribute points on faces okay and then it's just put uh sorry it's going to put you in a placement State and if you just Mouse over that line there till it lights up if you click it's going to automatically connect it for you and now you can see we've got points on our icing and our density value great but you might notice the icing has actually disappeared ooh now the reason for that is we've told it okay give us take that icing object and convert it into points and then just give us the points back okay so what we need to do is say yes we want the points but we also want the original mesh so we can do that by adding in a node that you use all the time which is shift a geometry join geometry so you'll find this node in probably any geometry noes tutorial very versatile so drop it in here after the points and you'll notice this input here is a different shape so normally inputs are circles or you know triangles or whatnot this one is a long an elongated shape to signify that it can accept multiple inputs so one likee these where you can only accept one this can accept many so what we need to do is take the output of our original mesh and then feed it over to here and now we have both the original mesh and we have our points and they're being combined together and then put into our output okay very cool awesome all right so if we were to give this a render right now you would actually see nothing because these points don't physically exist they just exist in the 3D space if we want them to show up in the render we have to tell it what do you want to render them as so for that we need to add an object to be our sprinkle so your sprinkle could be whatever you want uh we're actually going to make two different types of sprinkles in this uh donut Series so we're going to start though with a very simple one just a round ball so uh just like you would add another object normally shift a and then go mesh and then go UV sphere now this sphere is going to be referenced for every single sprinkle okay so we want to go uh as low res as we can get away with uh so I'm going to go with a 12 segments and then eight Rings if you're on a really slow computer and you think this is really going to suffer later on um you could go even lower but I don't want to go too low because otherwise we're going to see that Jagged Edge cuz it's a rounded form so I don't want to go too much lower than that uh but I do want to adjust the scale because obviously this needs to be a tiny little sprinkle so let's go 0.1 okay awesome all right now with our icing selected again you'll notice by the way that if you click another object you don't see your nose because it's only going to show you the active objects geometry nodes so if you want the nodes to just be there no matter what if you click the pin button there that means no matter what is selected it's only going to be showing you this objects uh the one that we pinned uh geometry noes okay all right so to reference we need to reference that little sphere that we've just created in our geometry node system and you can do it very easily just by dragging down from your outliner up here just dragging it down into your geometry nodes and dropping it okay so now let's just create some room here make a little bit of space okay and what I need to do is add another node to reference this object and the node is shift a instances instances on points the top one okay and then I want to drop it in here between distribute points on faces and my join geometry so drop it in right there till it lights up now the points have disappeared because we're now saying replace those points with whatever is in that instance input so I'm going to take my geometry from my object info and drag it into the instance and look at that we have got our spheres appearing all over it and if I increase the density we've got sprinkles and if I do a render it will actually display doesn't look very good hey but it does work which is the uh the main thing right now okay so uh first things first you'll notice that as we increase the density first problem is that uh they're crowding each other they are straight up overlapping each other with no respect for its fellow sprinkle right because it's just a random distribution so we can change that by going here in our distribute points on faces change it from random distri dist distribution to Pon disc distribution Pon what a name um so it's changed uh but that's just because it's changed your density Max so just increase it again um with this pron dis uh distribution you get this extra value here distance Min so now if we can uh set a low value we can start to delete it's it's almost like each one of those points is going to have a little radius around it and if it detects a point within that radius it's going to delete it so um we just need to increase it slowly very very slowly until we can't see them intersecting anymore um to about there honestly if you go too high like if you really wanted to make sure they weren't touching you go really high but it starts to look like too evenly spaced you know like yeah it's it's not actually registering the other object it's like it's just doing this little radius thing which just happens to be perfect for a ball-shaped object but it's not like an advanced like it's going to try to fill in all the gaps for you um so yeah just kind of I usually set it to like a little bit of clipping is okay but I don't want there to be uh too much um but let's go yeah something I don't know something like that we'll actually adjust this later on I'm just doing it just for this this point all right a much bigger problem if I hit control tab to go full screen here if I look at uh at my mesh I've got sprinkles everywhere and in fact I've actually got sprinkles underneath the icing and that's not good because it's actually going to put that in the render even though you won't see it your computer is going to use resources to render little individual balls underneath the icing which is not what we want obviously so going back here what we need to do to fix this is we need to do weight painting okay it's not texture painting it's a special thing called weight painting So with your icing selected if you go from your object mode you'll see one there called weight paint now your mesh will become blue and weight paint is actually referenced in multiple parts of blender like if you're doing rigging and animation you would use weight painting a lot during the rigging step to assign values to certain bones essentially what it's doing is it's allowing you to paint a value between zero and one onto any part of the mesh and then reference that however you want so we can then reference that weight paint mask in our geometry nodes and use this almost as well exactly as a mask for our uh sprinkles so if we just do uh just do some paint right here on it you'll see that we have some colors right now these colors aren't going to appear in the red it's just for you to visualize those values uh the blue value means a zero a value of zero and the red value is a zero of one I believe actually in maybe not the next version of blender but maybe the version I don't know but they're planning to change the colors of this so depending on the value on how late watching this you are your colors might be different here but it should be the same essentially you should have a brush of one um and you should be able to paint from zero which would give a blue value in this case to a value of one so whatever is one whatever is red is where our sprinkles will go but you'll notice that this is not having any effect okay so we need to reference it now that weight paint that we just did is actually if we go to our data tab here it's actually a Vertex group okay so that's where that paint went so you could actually create multiple weight paint types just by like creating them here um but we've just created one and it's added one here for us so we can give it a name by double clicking it and let's call it sprinkle mosque okay in fact it's a is it a Mosk it's more of a density sprinkle density I guess cuz it's not a masking out anyway all right sprinkle density um okay and where I want to reference this in my geometry node stack is in the distribute points on faces there is one value here called density factor which we got when we use the presson dis thing and this is just a value of 0 to one very convenient so if I drag out from here and then release I can add in a new node and it'll just automatically connect it and the node that you're looking for is called the named attribute don't feel bad if you're like well how would I know that it's called the named attribute cuz it's called vertex groups over here you think like okay I'm going to type in vertex group but it's an attribute but it's one of many attributes and geometry nodes can do many things so it's just called the named attribute so anyways all right so underneath name we're just going to click that box you'll get a pop up or pop down and you looking for sprinkle density and there it is haha so now going back into weight paint mode we can act like an artist and put the sprinkles wherever we want sprinkles on our donut which is really cool um so so sprinkles are typically they're like on a plate and then the wet donut with icing on it is just like dabbed onto it so you get like a heavy amount of sprinkles right on the top like that and then less around the sides um and then I usually do like a few like dabs like this just for some variance and then also if you hold down control that will do a so the the weight that's being painted is one but if I hold down control it's going to do a negative value and I can adjust my strength there as well and I can just do some negative uh paints across it maybe a couple here as well and I'm trying to deliberately make it look choppy because I find that if you make it look too like uniform then it just looks very boring and artificial um because the real world would have more sprinkles collecting in certain areas than others right maybe it's just like wetter on that part right so more would stick to it um or more force was put on that part of the plate as the doughnut was dabbed into it right you just kind of have to think of this stuff because uh in the digital world it's far too easy to make something that looks um predictable and boring and we don't want that but there we go something like that um and you could obviously finesse it and make it better than what it is but that's uh that's what we got uh you'll notice each of these spheres have a very Jagged looking shape and that's because the sphere itself down here oh I don't think I mentioned this if you want to quickly Zoom to an object without having to find it and pan around number pad period key probably should have mentioned that before um but we've only haven't really needed it because we have not work with that many objects but that'll Focus to that object if you're on a laptop by the way if you hold down the Tia key that'll bring up this section here and then you've got view selected right there so tiller is that key underneath your uh Escape key but anyways so this is what our sphere looks like so right click shade smooth and now all those sprinkles have a shade smooth haha very nice all right now let me just show you a quick uh little issue that you might run into if you were to uh duplicate your donut and uh create two and then on the second donut you're like hey I want to have uh some spice in my scene I don't want to have the exact same count of sprinkles across both Donuts let's give a a different value to this one over here well you can see that they are now sharing the same value because this node group here is being linked across both objects um but if you wanted I mean you could like you know make it its own single object so they're not linked but if you wanted everything else to to remain the same so that let's say you you know change the sprinkle at some point that's preserved across it but that one value you want to be different across multiple objects you can expose it so just like what I did at the start if I drag out from the value I want to expose and then I put it up to here in my group input the empty slot if I just release it it's now disappeared the value's disappeared from here and it's now appeared in my modifier stack over here and now I can put in a different value so this has now got a value of 2,000 and this one is 500 so essentially by dragging it out and exposing it it's essentially removing the value from this uh node setup and saying this is its own separate thing which is independent per object um and it has a two birds uh one stone kind of effect that it makes it more accessible so in a completely different part of blender I'm working on my scene and I'm just very quickly giving different sprinkle amounts to different Donuts right like a mad man right no one can stop me um but yeah very cool and uh that's now exposed oh the other thing we probably want to do though with that uh this group input here is I want to give it a different name because density Max you know not really that useful I can call it sprinkle density right so now it's like a fully customized little node group that I could drop on any object I could be building a car in the future and I'm like it it needs sprinkles and I can just drop this on and I've got a Sprinkle density value for my car right so you can see how geometry nodes you can build something really customized for what you want and then it's just readily accessible um every time you need to use it awesome now one issue that I will show you with this and actually it's not specific to Geometry noes but this entire time for all these videos we've been building a dut which is too big so if you hit n in your properties oh that's the polygon thing uh you can see the size the dimensions of your dut is 1.2x 1.2 M which uh for Americans oh actually yeah you can change it you could change your units to the wacky Imperial one yeah four feet right okay um which is way too big okay now why does it matter right because like okay if you're looking at this this how are you to actually know that this is 1.2 M rather than the regular size zut it doesn't actually matter yet but when we get to like rendering with depth of field or maybe you want to import other objects from other scenes having a value that is actually true to the object will save you so much time and it'll also make it so that your camera settings Etc are actually correct so that bit is uh is very important so essentially we should resize this and really a real donor is about 12 CM which is exactly 1/10th of what we've got right here so if we select everything in the entire scene which you can do by just hitting a a for everything I don't know a for all yeah that makes more sense okay uh then if we hit s to scale okay we're now in a scale oh actually okay well now it's going to scale it and the plane is going to be off the ground hm okay all right well let's not let's not scale the lamp and the the camera so everything else selecting the donut the lamp sorry the donut the plane and the sphere then s and then I want to scale it by exactly 10% now how could I do that if you look in the top leftand Corner you've got uh the values there and if I if I went to 0.1 then it would be exactly a tenth of what it was but how can I get it exactly at 0.1 well uh two things one if you hold down control when you're moving any value in blender it'll move it in increments which in this case is 0.1 but you can also actually just type in the exact value you want point one and hit enter and now if we look at the size of our donut Click N Hit N uh you can see it's .12 M or centim you know anyway um and that's great but there is a problem uh what you might notice I mean there's not a problem now but when you change the scale or the rotation of object actually it's uh it's not it's only changed its uh what do you call it its local scale it hasn't actually applied it on a global level yet so the sprinkle here and the dut have actually got a like pretend value this scale is set at 0 2 and it's almost like it's saying to the scene that's not its real scale it's just been faked to be that size yet it needs to be applied if you want to like confirm really that this is the true scale of rotation of the thing and you do that by selecting the things and then hitting contr a and then applying scale okay so now we've done that we can see something's changed so our donut here with the sprinkles has now massively changed its uh density count and the reason for this is that if we go geometry nodes again let's zoom in here let's look at it with this this density this sprinkle density is actually not the count of sprinkles at all it's the density in relation to the whole scene and the way I think of it is like um uh okay it's a weird visualization but if you've got a car and it's driving along a highway right a certain amount of bugs are going to hit the windshield okay but and the bugs could be defined by here but the smaller the object is right you could have the same amount of bugs going across the highway but if it was like a tiny Matchbox car there's going to be very few bugs that's going to hit it okay so the density is kind of like the density of the world and now that we've made the object smaller there's only three sprinkles left there's only three bugs that's hit the windshield of our of our donut here so this value now needs to be much bigger in fact it needs to be exactly like if it was 6,000 before it needs to be yeah 60,000 now um but the problem is is that it's not just a value here the distance Min value has also changed because this is also based on a real world value so this now needs to be really small so let's try 01 and that's actually pretty good I think there's a little bit of over lot but that's roughly kind of what we want and let's see if I can increase this yeah so if I want this density to be really dense yeah I would have to increase it to a crazy number now something I like to do personally this isn't you have to do this but you notice how like this number is really large and if I want to increase or lower my sprinkle value and I'm in a different part of blender if I'm just dragging this value it's having no effect because the the range like the scale of it is just so large so what I actually do is I set it to a value that I think makes sense which in this case is 200 and then whatever the value was before it was uh 200,000 right I do a math value inside of my geometry node setup between here and here I do a math calculation to multiply that by the value that it needs to be almost as like a scale adjustment so you can do it with just one node shift a utilities math math and just drop it in here now the math I I said I want to multiply it so I need to change it from add to a multiply and math is the most versatile of any uh node you can do all sorts of stuff but multiply so multiply and it was 200,000 before so if I want this value 200 then I just add uh 1,000 yes that's correct okay so now I can very quickly change the scale of the sprinkles across the donut without having to like manually type in the value I can just move it back and forth um and there you go so that's it so we've uh we've changed the scale of it to what it should be um we've got a correct uh density sorry we've got a correct sprinkle setup looking good um in the next part we are going to be adding long sprinkles to donut because this round one is okay and I originally was just going to go round to try and keep it simple but there's also I don't know the long sprinkles just look way nicer um but you do have to do uh some different rotation math and stuff so we're going to do that in a whole second video so click here on the screen to learn all about that and random colors so I will see you in that part