ROPE GENERATOR - Blender 3.0 Geometry Nodes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there everybody and welcome back to the second blender tutorial in a row that i'm recording today uh reason being there was a couple days where i didn't have access to a microphone such as this so i was just gathering ideas and i'm like once i have the sweet phallic microphone in front of me i'll be able to make a bunch of tutorials in a row and this is the second one of those as you already saw from a render that i hopefully demonstrated we're gonna be making procedural rope but more than that we're gonna have complete control over this as you would expect because it's geometry node so for example i could draw something like this and it automatically turns into a rope and a pretty realistic one so let me draw a couple more just so you can see how kind of you know usable this is um so i've made a bunch of ropes by the way you can edit this and it's gonna you know it's gonna work uh here's what they look like they they look pretty rope-like i mean you could do a bit better by just diving into the material and doing a bit more work than i did it does look a bit like a churro but yeah that looks pretty good especially once you get close you can see it kind of breaks but you see it has little rope hairs it has all the twistiness going on and uh yeah this is completely math based and it's not that hard to make and once you're done you can draw ropes on top of objects and all that so let's talk about how to do it since it's pretty easy so uh of course i'm using blender 3.1 alpha although everything i do is going to be compatible with blender 3.0 so don't worry if you're up to date but not using the alphas and all that it's fine so rope is the goal for today how do we do it so it's again completely geometry notes i'm going to go into geo nodes select the cube make a geo nodes group actually so you could do it like this and then import in a curve and then convert that curve into a rope although maybe what's better is instead of the cube so forget everything i've said so far we're going to start off with a curve whether it be a bezier line or circle turn this into the geonodes group and i'm just going to call this rope so the name of the game is turning this curve or any curve that i input into rope and that's why i changed it from a cube so for this curve i'm just going to bring up the resolution just so it's a bit smoother and now we are good to go so this group input this geometry is giving us the curve first order of business is giving it thickness so it's not just a curve but it you can actually see it it's a mesh and i guess what a rope really is is it's a couple strands that are twisted together so let's talk about how to do that so uh starting off with giving this thickness we want to take the curve and convert it into say it with me a atheist no a mesh curve to mesh this is what's going to give a thickness so we we take the curve we convert it into a mesh and we have to say hey geo nodes use this profile curve as the thing that gives a thickness so what i mean by this is we can use a curve primitive like a curved circle or you could use a curve star whatever connect this and now you can see this thing looks awful but it has thickness so i'm just going to bring down the radius so you can see at this point whatever we do to edit this it's going to work and it's going to give us this noodle so really the idea is we don't want a circle kind of passing through this we want two circles that are twisted or even three that are twisted together so let's do that instead of one curve we want two so let me visualize this so here we have our curved circle what i'm going to do is i'm going to make a copy of this by using a transform node so we have the curved circle and we have a transformed version i'm going to join these together and nope we're not i mean in some sense we are joining strings but in this case a string means something else we're going to join these together and for one of them i'm going to offset it so you can see this makes a copy of our circle um but it moves it a bit to the side so now we have two circles that are going to be copied so i'm going to move this over by well i guess we could give this full radius to begin with radius of one and then we could just shift it over by like one unit and then we take this and bring it back with another transform by negative one units so negative point five units did that a bit incorrect so it's a venn diagram so what i've done here is i've taken a circle made a copy of it that's shifted over and then took both of them and shifted it so the venn diagram is in the center if we take this now and use this as the profile curve again it's going to be a bit dummy thick but you can see now there are two curves sweeping through here so now to set the radius instead of like doing it here yeah i mean you could do it here but then there's a bit of separation maybe the strategy is to set it independently so set curve radius here so that everything kind of stays centered nice okay so you can see now we have a kind of the same situation i'm just kind of building on this idea but now we have two noodles so this is more like a wire or cable for a telephone pole so now the question is how do we take these and twist them tangle them betwixt each other as we pass through this curve well um actually the answer is in that sentence as we go along the curve we want to twist or tilt the curve so that they twist together in other words we want to take the tilt and change it you're going to notice in this curved stuff if we view it we actually have we have radius stuff but we also have tilt information so that is what we're going to be changing so let's do instead of set radius we are going to set the curve tilt and i want to have it tilt more and more and more so you can see when we increase the tilt that's actually going to rotate this exactly like that we want that to increase as we go along it and in other words we're going to take the index in other words the points that compose this thing so we take the index we tilt it so you can see this one's flat and then this one's here only issue with this is you can see we actually only have two points here so last thing to do here i know in the weeds very confusing re-sample the curve so it has more points in fact i'm going to do this by length so it's not going to pick a set amount but it's actually going to update it based off the length and just going to bring this number down until it's kind of like the correct amount of twisting that i want if it's too twisted you can see it starts looking a bit awkward like that only thing i still don't like about this is it still looks very jagged and it's kind of like how do we solve this because if we want to bring this even lower to get it even more twisted this problem only gets worse and worse and worse a quick solution we're going to take this length and bring it down even more which kind of seems like not the solution but believe me we take the length we bring it down more and more and more which is going to add more points which means the tilt is going to keep changing because the index goes from 0 to a larger number do it like this we're then going to take the index and then just divide it by number so this is just a little hack so i'm going to take it and divide it by something that gives us roughly the amount of twisting we want something like this kind of depends on how tangled you want your rope to be and you can see it looks a bit smoother of course you wouldn't want to zoom in all the way here but from something like that that looks pretty good so again what have we done so far we took two circles and kind of this venn diagram we sweeped it along the curve and we twisted it or tilted it based off the index in other words how many points there are here and that's going to be determined by the curve length so as i increase this it should keep working as you can see okay at this point it's probably a good time to save so i'm just going to call it save.blend okay uh we have this this is gonna be the basis for our rope uh let's just do a couple modifications just to make it look a bit better uh first thing we can do radius i think we should bring it down just a bit maybe by 25 percent just so it's a bit thinner and looks a bit more rope-like so that's already good uh second thing we can do is we can actually add in a second curved circle so i'm gonna have two of these and you're thinking oh nothing changed what's the point of this uh the idea of separating these nodes is now i can take the radius of one of them and make it a bit thinner this will just add a bit of variation where one of these strands is going to be thinner than the other and then they twist together if you do this subtly from 1 to 0.8 it's going to look roughly correct but it's going to add a good amount of variation here so here's what it looked like before and then after just kind of looks a bit better in my opinion and i think at this point let's start making the material and then we'll do the hairs and all of that so for the material i guess we should just set up a basic scene right so let's do cycles on the gpu and we just need to add in a bit of environment lighting so i'm just going to add an hdri that i downloaded from hdi haven this one's fine just so we can make sure that our material look good looks good so film transparent all that uh to make a material for geometry nodes as you know you take this whole node group which again is basically a tilted curve that we turned into a mesh we're gonna take it we're gonna apply a material by setting the material we can just use the default one and then we can edit it so in the shader editor we go to the material we could rename it rope and you can see when we renamed it here it also reassigned here meaning that anything we do here is going to actually affect it as you just saw uh what we want to do is we want to give this a bit of extra detail okay so first thing to do of course is to you know kind of pick a rope like color we'll hone in on this as we continue so something like that high roughness since rope doesn't really reflect light we want to add extra kind of like knotted fibers to this as if it's composed of very very numerous several uh tiny strands that make this up instead of actually putting them in geonotes we want to kind of imply that and i think the easiest way to do that is with a normal map so here's how we're going to do it um you might want to use something like a wave texture but the issue with this is it's going to use generated coordinates which doesn't necessarily flow along the ropes you can see here we have these lines going like this but as the curve tilts they're kind of diagonal right we need a coordinate system and just like in the last tutorial tutorial if you saw that we can actually create a coordinate system from geometry nodes by sending some attribute information over okay so here's how we're going to do it so you remember everything we've done here this kind of venn diagram section that is what's sweeping along the curve in the scarf to mesh this is what we can invoke a coordinate system on so i'm going to create an attribute for this so let's capture an attribute and then what are we going to call it uh or what are we going to capture we're going to capture something called curve parameter if you're using a very very recent version of 3.1 alpha or whatever it's going to be called spline parameter but it's called one of the two uh what this does is it gives us the information of how far along the curve or the spline we are which in other words gives us a coordinate of this geometry nodes thing don't worry about it too much either way we're going to capture this attribute and we want to send this to our shader so i'm going to output it out of the modifier so now you can see we have an output attribute we can call this chord because it's going to be our i mean it is kind of a chord it's a row but it's going to be our coordinate and we import it in using attributes again the attribute workflow is how you get information from here outside of geo nodes uh to the shader editor so just make sure we call the attribute the same thing so chord these match uh so that we can now see this information and you can see we get this a nice gradient that now flows with the rope because again the rope is composed of the curve that we are referencing so of course it's going to flow either way use this as the coordinate system for the wave texture and you're going to see now we get these nice fibers that actually flow along this no matter how this is rotated right so this is a free way to get some detail right so i just take this i send it through a bump node to create in the height socket uh to create some like fake normal information right what is real normal information i don't know uh we're getting closer and closer to our churro you can see we're getting these like extra fibers that from far away kind of add a good amount of realism to this uh we just want to bump up the you know how how real this looks uh we can do that by taking our distortion and the wave texture and just bringing that up and you can see that kind of breaks up these fibers so they're not equally spaced so here's before they're equally spaced and after it just adds a bit of randomness it makes it look more fibery and all this so that's already good this is already looking a lot more stranded not on an island but stranded and rope-like you can increase the number of fibers here so this is pretty good um i want to add in a bit of extra color a bit of extra detail and i think a good way to do that instead of using this wave texture is let's use another piece of information we can use ambient occlusion in other words what areas are kind of intersecting over each other so you can see when we zoom in on this rope we have these tiny shaded black areas where the thing's folding and maybe we can use that as an area for a bit of dirt or darkening right just to give this thing a bit more kind of character and shape so i'm gonna take a color ramp just to make this a bit more defined uh yes we do get a bit of artifacting here but it doesn't matter we're never gonna zoom in that close um so i'm just gonna kind of create this mask that shows again where this is folding and i want to kind of take the color and base it off of that so i'm gonna mix rgb i'm gonna take our original rope color that we can edit and i'm going to mix this with the color black depending on this ambient occlusion which might be flipped i believe it is flipped so let's copy or actually first of all set this to multiply uh but let's flip these was that incorrect that felt like it was incorrect maybe we could flip the color ramp because right now what's happening is the outmost part of the rope is being uh darkened there we go so you can see uh now this interior part of the rope's being darkened of course i don't want it to be that much so i'm just gonna raise this uh i guess i feel like everything i'm doing in this part's wrong we raise it here there we go and make it a tiny bit red and darken it again and i think we can make this less intense by bringing down our color amp there we go now we're getting nice control so it doesn't look like we added much but here's the before and the after so you can see it adds a ton of kind of depth and dimension to this um so let me just kind of reset my rope color just a tiny bit i just want to kind of hone this in before we add a bit more detail okay so this this is pretty good so what have we done so far we've created a basic geometry node setup that creates the mesh we sent attributes to make this nice material generally it should be rough not metallic you can mess with the specular and all this but i think this is a good start i think the next thing to bump up this uh realism to the next level is adding in more geometry in fact uh we're going to add in these tiny hairs like little loose fibers that came out which sounds hard but it's super easy right because all we need to do is take this mesh and distribute hairs on it right so i'm going to distribute points on surface of everything before the material so it's the curve mesh but we haven't applied the material yet since i want a different material for the hair i'm going to distribute some points here's what it looks like you can't see anything unless it's in solid view i'm going to bring up the density so you can see each of these points is going to spawn a hair is the idea and we could spawn in basically a bunch of tiny cylinders each cylinder is going to be kind of like a hair coming out of your head is a way to think about it and as long as we make it low res it shouldn't be too big so we want a points to instance instance on points there we go um so for each of these points we distributed we want to instance a what kind of mesh a cylinder you could also do this with a tiny plane or whatever um so we're gonna do a cylinder we take these join them together and yes it's a disaster uh we need to make the cylinder smaller first of all i'm gonna decrease the vertex count so they're basically cubes so that it's not very high res um next i want to take the radius bring it down so it's kind of like thinner hairs in fact let's make it 10 times thinner and then i'm going to take the depth and obviously bring it down a bunch so we have these tiny hairs that we're going to make even tinier coming out of this so let me make them 10 times thinner there we go maybe a depth of 0.5 and this is a good start main issue being they're all kind of they look bad but they're all kind of pointing upwards and i want the hairs to kind of come out of the normal um off of the normal of the surface depending which way it's facing um we can do this using rotation of course you can see we're changing the angle they come out at but nice little trick this distribute points on faces comes with this rotation output that you can just connect and that will automatically do it for us you can see they're all coming out of the normal here um in fact what we can do now is kind of greatly increase the number of hairs we have so i'm just increasing the number of points we're distributing um and now let's work on the look of these so i definitely want them to be thinner so let me let me make them twice as then i'm going to divide the radius by 2. i'm going to take the depth also divide it by two this is looking pretty good you got to remember we're going to take these fibers and make them the right color and all this and a bit transparent so this is a good start um i don't want all our you know hairs to be exactly the same size so i'm thinking we can randomize the scale a bit and in fact we only want to randomize this on the z channel which is kind of the length that they're coming out at so i'm going to combine x y z and what we can do here is we can randomize random value uh just the z thing so this is gonna be a field that goes from zero to one so you can see some of these are kind of long and some of them just barely barely poke out in fact we can change the radius also here by decreasing it there we go so now this is looking a bit better um second order of detail or randomness we can add is they're all coming out relative to the normal but that's kind of it so they look very organized still we want to randomize the orientation as well so we can do that by adding something to this rotation vector so you can see when we add it they all kind of shuffle what do we want to add another random value but this one's going to be a vector since it's rotating on the x y and z axis so you can see when this is set to zero they're all coming off the normal but as we increase this it's adding a tiny bit of randomness okay so we have little hair fibers it's going to take a bit to get the look exactly down like how many what color etc but i'm gonna do a lot of hairs for now and then for the material uh we could play with that right now so remember we set material for the first one i'm gonna give this a material so far it's using the same one but if i make a new hair material and apply that here you can see now these are going to be if i delete all this these should be separate from each other so you can see i can color the hairs differently and all that so i'm going to give this kind of like a dark dark fiber and in fact we could kind of randomize this so here's a trick i saw on the comments of a youtube video a tutorial that i posted that i did not think of i think we can use the random per island to get a different number between zero and one for each of these as long as we realize the instances which might not be worth it but you can see now each hair has a different black or white zero to one kind of thing we could use this to randomize the hair color so i'm thinking let's just do it because i may as well just say that this exists regardless of whether or not it's going to be useful to us just so you know that this trick exists whoops so i'm just going to copy this color paste it in our color ramp here and here and we can have a bit of a darker version so you can see some of the hairs are brighter than others and all this so we have the hair colors and now i just want to take the alpha and bring it down so they're 20 percent transparent or 80 transparent 20 opaque so they're there but they're a little hard to see which means when we zoom out it will give the vague impression of extra detail and you can see i mean i guess you can't see since they're very tiny but as you get closer they do help sell the realism a bit so as for whether or not you want to realize instances this is up to you but again because all of this is based off of a length resampling this should be so that whenever we extrude or whatever uh this is going to keep the same kind of rope distribution and it's going to scatter hairs even on the new sections okay so this is generally our rope uh but now the coolest thing is if we take this we can actually delete the original bezier curve and edit mode um all of this is kind of dependent on this group input so if i was to take this tool if you haven't seen this before this is the curve draw tool you take it you can now draw in a curve which is getting inputted here sent through this math and through these shaders and you can see we have a custom rope that we literally drew on so if you have like a scene with pre-established things in certain places you could literally draw on top of it in places that would make sense like over the barrel whatever and it's going to work like that um additionally because it's all dependent on this input you could also use a primitive i believe a cyclic one will work but let's find out yeah so you can see here i uh input it in a star and now the star i mean other than you can't really fix these kind of sharp corners i mean you could with a fillet but other than that it's working so let's fillet this curve that that just kind of makes it look like a cog i guess but you can see the rope is doing exactly what it's supposed to it has the hairs distributed on etc so uh getting this to a hundred so i feel like right now i got you to eighty ninety percent of what you need getting this to a hundred is just adding in a bit of dirt a bit of variation a bit of whatever on the shaders or maybe just adding in maybe a third strand that wraps in here that's like a bit thinner than the others whatever um in fact i think that's what i did on my original so let me just go to my rope blend so again same kind of thing let's see what this looks like i believe for this one i added in yes i added in three circles so you can see there's kind of a very thin middle one here uh that just kind of bumps up the realism even more just because it looks a bit more complicated and all this uh but that that's the lesson you know this is how you make rope procedurally so yeah well let's exit out of full screen here how long 23 minutes whoa i thought this would be like a seven minute tutorial whatever uh either way we've made procedural rope i hope you enjoyed it and uh this is the part of the tutorial you're not allowed to leave uh where i talk about patreon so first of all thank you to 600 700 800 some um active patrons that are funding this tutorial yeah this tutorial channel and the cg matter one you guys are literally the main contributors that let me create these tutorials for free on youtube uh so thank you uh but for people watching who aren't part of the patreon and want to know what's up here's what it is so you get a bunch of benefits it's not like you just give money and you're like oh i'm such a good person which could be that but what it is is you get a bunch of benefits you get early access to tutorials so you could see uh pretty much every single tutorial at least a day early in some cases much earlier than that if i'm planning to go on a trip or something like that that's usually in the spring and the summer and all this but you get early access to tutorials see it before anybody else you get the blend file so this rope generator i made download it you don't need to make it and i'll give you the nice one too the one i made before the tutorial that i didn't make live um any one file i've ever uploaded there are hundreds at this point you can just download all of them once you join the patreon blends early access exclusive tutorials at least once a month sometimes a tutorial series or multiple tutorials per month these are tutorials that are unlisted you cannot see them unless you're part of the patreon all this exists over there but in general if you want to support this channel and the cg matter channel that this is literally uh the most direct way to do that i would appreciate it you get your name and the credits and all that so hopefully you learned something about rope because i didn't i mean i already knew the information and i told it to you so maybe you know it now
Info
Channel: Default Cube
Views: 22,247
Rating: undefined out of 5
Keywords: blender, blender 3.0, 3.0, tutorial, geonodes, geometry nodes, procedural, curve, material, cycles, eevee, abstract, easy, beginner, render, rope, generator, string, cable
Id: 2VzYMah-nTg
Channel Id: undefined
Length: 24min 3sec (1443 seconds)
Published: Sun Dec 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.