Barbed Wire with Geometry Nodes in Blender

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] about a year ago i made a video where i made barbed wire mostly with modifiers but now we can use geometry nodes which gives us a little more control when it comes to changing things like the thickness last year's barbed wire pack is still on gumroad but i'm updating it to include all of the geometry node stuff too so if you don't want to make it yourself you can get it over there the 10 tier on my patreon also gets my gumroad products for free i'll put links for everything in the description and if you want to get a better look at what is in the new barbed wire pack i uploaded it to sketchfab so you can inspect it yourself speaking of sketchfab they're the sponsor for this video if you want to sell 3d models you can do that there and if you want to buy 3d models they have more than 3 million to choose from they make the browsing process enjoyable by letting you inspect the models in the browser so you know exactly what you're getting you can download in multiple formats and if you use their importing add-on you can easily use any of their models whether they're made for your program or not use my link in the description to check out sketchfab here's a quick summary of what i'll cover we'll start by making a path for our barbed wire to follow then we'll use geometry nose to give it some thickness we'll use two circles as the profile curve so that it looks like two separate wires which are twisted around each other next are the barbs which use a spiral curve as their base shape we'll give it the same thickness as our wire and also duplicate it so we have four spikes instead of just two we'll make the ends come to a point and also stick out then we'll instance the barbs along our wire figure out how to change the spacing and get them rotated the right way at this point we can put barbed wire wherever we want but if you stick around to the end i'll show you how to create bundles of wire like how i did in the cable generator video alright let's get started alright so here we are in blender i'm using the 3.1 beta for this all of this will work in 3.0 also and i'll just talk about the differences when we actually come to them so first i want to make a path for our barbed wire to follow so i'll just hit shift a to add in a plane if you want you can use a curve too but i like using a mesh so i'll select the plane tab into edit mode make sure you're in vertex select for this select everything hit m to merge i'm going to choose at center that's just going to merge all of the points into a single point and now we can just extrude this wherever we want so i'll just move that up a little something like that all right simple shape and now that we have this we can go into geometry nodes so if you don't see a geometry nodes workspace up here just click the plus button general and then geometry nodes so we can just select our mesh and hit new to add a new geometry nodes modifier right here so first thing we want to do is add some thickness to this so to do that we need two nodes so i'll hit shift a and then s to search i'll add the mesh to curve i can put that right here and also the curve to mesh so the reason we're doing this is because for the curve to mesh we have this profile curve so we can plug in whatever shape we want here so i'll use a circle curved circle right here we can plug this in now you can see this is a little thicker it's a little too thick so you can change the radius right here you can also change how many edges there are right here so right now this has 32 if you want low poly you can set it to something like six i'll just leave mine at six right now if you want this to be smoothed out before both of these you can add a subdivision surface like that so if you're using a curve instead of a mesh then you don't need to use this node you can skip that one and also the subdivision surface this only works for meshes so you won't be able to use this if you really do want to use this then you have to turn it into a mesh then use this turn it back into a curve then turn it back into a mesh it's kind of repetitive another thing we can do to control the resolution of this curve is with a resample curve node right here so if you have this set to count then this is the total amount of vertices that will be along this line instead i'm going to set this to length and this is how close the points will be to each other if you turn it down lower it'll get higher res and if you turn it up higher you can see they're just further apart from each other so this is the distance between each point so i'll set this as something like .05 all right so right now we have one tube but we want it to look like two instead of actually creating two separate curves all we have to do is use two circles for our profile curve right here i'm just going to preview this node and if you're using the node wrangler you can hold alt shift and left click and that will just preview it right here it basically just plugs it directly into there so this is what it looks like for us right now i'm just gonna change this to eight instead of creating a second one of these what we'll do is bring in a transform node like this and we'll also bring in a join geometry so instead of creating two circles all we have to do is plug this into the join geometry twice you can see when i change the translation now we have two circles um i want to have these two circles move apart from each other instead of only one of them moving so i'll add a second transform node right here one will move up and one will move down and i want them to move apart from each other based on this radius right here so i know they're all going to use the same value i'll just bring in a value node and i can plug that right into the radius right here we'll change that to like 0.5 for now and i want this to only move on the y-axis but you can see there's only one plug right here so i need to bring in a combine xyz and that will allow us to select an individual channel like that so we can use one of those for each of these and now we can use this value to plug it into the y and this one we want to move the opposite direction so we need to subtract it i'll add a math node and set that to subtract the first value i'll make zero and then this i'll plug into the second value and let's just make sure we plug this into the y and now they're the right distance from each other right there and when we change the radius they'll stay like proportionally the same distance from each other which is nice if you do want controls for moving these further apart from each other we can bring in one extra node right here a math node and just set this to multiply so if you have this set to 1 it'll look normal but if you turn it up they'll move further apart from each other and you turn it down they'll move closer this might be nice for if you're using like a lower resolution like six you can see they don't quite touch each other so if you wanted them to touch each other then you could move this down like that all right so now that we have this all we have to do is plug this join geometry into the profile curve and then we can plug this back into the output and now it looks like we have two separate cables and we can just turn the radius down however low we want one other thing is if you want these to not look hollow at the end all you have to do is click fill caps on the curve to mesh and that will just plug those up so let's try to stay organized and put a frame around these so just select all of these and hit ctrl j now to name the frame usually what i do is just select the frame and hit f2 and we can name this whatever we want i'll just name it profile shape you can also rename this by opening this little arrow right here to open the side panel you can also open that and close that with n like that so when you have the frame selected it'll give you the option to change the label right here all right now that we have these two wires we want to twist them so to do that we're going to work right here before we turn this curve back into a mesh and we'll use a set curve tilt and when we put it right here you can see this kind of makes them spin around each other like that but it's not twisting it's just kind of rotating so we need this other node called spline parameter so this is one node that is a little different in 3.1 so in 3.0 i believe the factor is a node called curve parameter and then length you have a separate node called spline length except it doesn't work exactly the same as this length right here i'll talk about that a little more later but first let's just plug the factor into here and see what that does basically what the factor does is it looks at a curve and at the beginning of the curve it gives it a value of zero and at the end it gives it a value of one and in between all of the points are kind of interpolated right now this is zero and that's one and if we bring in a math node set to multiply it'll make it twist more over here and over here it will stay still so we can just turn this up now and you can see it starts to twist one thing that's not good about the factor is when we move this in edit mode let's see if i move it really far over here each of those twists is going to stretch out and get longer like that so if we use the length instead that won't happen so i'll just turn this down to something that looks a little better so now when i move this you can see no matter how far i move it it won't get stretched out and i think that looks a little better so if you want to do this in 3.0 basically what you have to do is get the curve parameter and the spline length and multiply them together and the output will give you the same result as this length right here once again if you think this looks a little too low poly all you have to do is make this value right here on the resample curve smaller so if we set this like .01 it looks a little smoother and we can also change how many sides our circle has right here to like 32 and you can see that's a lot smoother now i'll just turn this back okay now we can work on the barb to get the barbs started what we're going to want is a spiral shape and this is actually pretty easy in geometry nodes because there is a curved spiral that we can use i'm just going to use a join geometry over here just so we can see our wire and our barb at the same time plug that spiral in over here all right so this is what our spiral node looks like and this is what it looks like over here you can see we have a start and an end radius and we can have them set to different sizes but i want them to be set the same size we also have this rotation that is changing how many times it's rotating around itself like that and the height which is just you know the height so first let's give this some thickness with a curve to mesh and we can use the same profile curve that we used over here we can just take this circle and plug it directly in grab that plug it into the profile curve and now this should be the same thickness as our wire and we can still adjust it over here now i want this barb to stick closer to our wire so it looks like it's actually wrapping around it so we can change the start and end radius like this but instead of doing it manually we can make it match the radius of our cable so to do that we're going to use this value again i can just take that and plug it into the start and the end radius and it looks like this is not quite wide enough so i'll add in a math node put it right here and set that to multiply i'll multiply that by two and we also want to add the width of the cable itself because if we look at this just as a spiral you can see that it is wrapping really closely to it but once we add the thickness it's getting a little too thick so to add that extra thickness you can just duplicate this node put it right here i'll change this to add and we'll add this value right here and now it's sticking right up next to it so this value right here that we used when we turn that up it makes these circles spread apart so using this value allows our uh our barb to always match the width of the wire right here if instead we just change this to three it might look like it's working but once we turn this up it'll go through it like that so it's important to use this value right here so now we need to make this tighter and that's going to be the height but if we change the rotations you can see we're going to have to change the height again we want the rotation and the height to be kind of proportional to each other so i'll bring in another value node right here and we'll use the same value for both of those i'll plug that into the rotation and into the height right here so now it's not squashing it as we're changing the rotations but we need this to be tighter so for that we'll just bring in this multiplier right here and plug this in to the height and i'm just going to grab this value up here the radius of our circle so now this looks a little too tight so i believe we just need to bring another one in here multiply it by two and it looks like that should work fine yeah one thing i don't want to forget barbed wire usually has two separate wires that are wrapped around each other you can see there are four ends so we actually need to create a second one of these so these need to be spaced apart even further so we'll just multiply this by four and now there should be room for a second one in there i'll do the same thing we did for the circles to create a second one so bring in a join geometry right here and we'll bring in a transform and we'll plug this into the geometry also and all we have to do is rotate this on the z 180 degrees and now we have four separate ends like that so now i want to make the ends spiky so to do that we can use a node called set curve radius and you just want to plug this in before you turn it into a mesh because this only works for curves when we plug that in here you can see it lets us affect the thickness so the ends i want those to be a value of zero so they're completely pointy so we're going to use another spline parameter for that and we can use the factor for this once again if you're using 3.0 you just have to look up curve parameter to get this factor so we can plug that into the radius now this end is at zero and this end is at one we want both ends to be at zero and for it to be thick in the middle so we need to do a few things in between here to get the right values so there are a few ways to do this um the easiest way is with a color ramp so you can just plug that in right here basically we want both ends to be black or a value of zero so we can just press the plus right here move this white one to the middle and put that over here i'll change this to black and you can see it's pinching the other end now and all we have to do is put this one in the center so set the position to 0.5 like that if you want you can add another white one like this and then you can just push both of these to the edge like that to get it pointy uh for my approach i like to use more math nodes so i'm just going to delete this and bring in a math node first what we're gonna do is multiply this by two so instead of going from zero to one it's going from zero to two i'll duplicate this and change this to ping pong and set this to one so what this is doing is saying when it gets to one just go back down to zero with this one we moved a value of one to the very center and instead of going to two it's just going back down to zero and the ping-pong we'll do this for any value but we have it set to one when we set it to 0.5 you can see it gets sharp multiple times like that this is just explaining how the ping pong node works but we want to set this to 1. now to pinch the end so it's thick until the very end we can use a map range node and we just want to change this from max value right here and this will just affect how pointy the ends are like that i'll just set that to 0.1 for now next we want the ends to flare out more because you can see in our reference these stick out quite a bit right now ours is still following the same path as our spiral so to do that we'll use a set position right here so now we can use this offset to move this around but you can see it's moving it just like side to side we want this to kind of um move out from the center and basically just expand the radius of our barb right here we can use the curve tangent and when we plug that into the offset you can see it's doing exactly that it's just expanding the radius of our barb and we can control that with a vector math node you want to use a vector math node you can see this is a vector because it has the same color as the vector nodes right here so we can plug that in right there and just change this to either multiply or scale i'll change this to multiply and now when we have the set to zero nothing will happen when we turn it up it'll expand and we can target just the ends the same way that we targeted this we can just use the factor i'll just plug the factor directly in right there so instead of doing the ping pong trick bring in a math node right here and set this to subtract when we move this up it's kind of shifting the middle point like that so the value that you want for it to be right in the middle is 0.5 and if we want to change how far this is spreading out we can just bring another multiply uh vector math node in here i'll change this to scale instead it does the same thing it just changes all of the values at the same time now we basically need to just do the same thing we did here where we're extending the range in the middle that zero point right here we just want that to extend up and down so if you want you can use a map range for this this isn't the way that i end up using but you can do it if you want basically you just want to move the two min value up to something higher like 0.4 and this to like 0.6 so you're just moving them close to each other and then when you scale this out you can see they'll kind of flare out more but there's just more space in the middle but the best way i found to do this is with a float curve so you can just click anywhere to add a point like this and if you're dragging it around and you hold ctrl it'll snap to uh like cleaner values like 0.5 so i want to bring this one over here and bring a second one right there and i think that is giving us a pretty good shape and now you can just make it pointier with the scale node right here one thing that's kind of strange is it kind of like it kind of curves a little and that's because it's going up and then down right here we can just select one point and then shift select the other to select both of them and then hit this button right here auto clamped and that should clear it up so if you're using 3.0 this node is going to look a little different you won't have these buttons down here instead you have to select these points and then click this arrow right here and there should be an option to change it to uh auto clamped so once again i'm just going to clean this up by putting a frame around it and hitting ctrl j and i'm going to hit f2 to name it barbs and once again if you think these look a little too pointy all you have to do is change this value right here on the map range to something smaller so like .01 or something like that also how pointy you can get these will depend on the resolution of your curve that you're using the spiral over here and if we turn that down it'll noticeably get pointier and lower quality but if we turn it up really high you can see there's more resolution at the tips but you have to turn this up pretty high and i don't really recommend doing that i don't think it's worth it so next we want to instance these barbs along our wire right here so instead of using so instead of instancing onto the wire itself like right here after we give it thickness and stuff we're going to instance on this point right here where it's still a curve so we can just disconnect this barb from the join geometry we're going to want to bring in an instance on points right here and like i said we're going to use the resample curve right there that's as our points and for the instance we can use the barbs right there and now we just have to plug this into the join geometry now there it might be hard to tell but there is a barb instance on every single point and obviously this isn't what we want so to determine how many barbs are on our wire we're just going to use this selection input right here and the value we're going to plug in there is the index which is just going to return every point that we have in our curve right here and the way selections work it's a boolean value so it's going to look for the value zero and delete that one it's only deleting that very bottom one right there because the first point has a value of zero that's just how indexes work it starts at zero instead of one so next i'll bring in a math node and we're gonna set this to modulo we'll just set this to like four for example so the index value goes up in whole numbers so it's it starts with zero and then goes one two three four five the modulo is basically saying every every time it gets to four start over so what that ends up looking like is the first one starts at zero and then goes one two three and then it starts over so it's basically skipping every fourth barb like that so this is pretty close to what we want but we want it inverted so instead of skipping every fourth we want to show only every fourth so we can do this with a boolean math and just set this to not and that will just invert it so now when we turn this up to something higher we can actually get them spaced apart but for this to work right these have to be whole numbers if you use any decimal value it's not going to work right to control that a little more easily you can just add an integer node and plug that in here and that will just give you only whole values like that so now you can you know change the spacing really easily i'm sure you've noticed another problem we have is that these aren't rotating along our wire so to fix that we're just going to rotate it and the value we're going to use to rotate is another curved tangent and we can just plug that right into the rotation and this is doing something but it's not working exactly right basically what we need is another node called a line euler to vector and just make sure the tangent is plugged into the vector right here and now this is working correctly like it's rotating properly we just need to change the axis to z and that should make it rotate if you want more rotation control after this you can add a rotate euler node right here i usually change this to axis angle and then local and we only want this moving on the z-axis right here so make sure that z is set to one and now when we move this you can see it'll rotate it like that one thing that i notice that i'm not really liking is that these are all rotating at like the very bottom instead of the middle and i think that might get us into some problems when it comes to tight curves like that we basically just want to move these on the z axis right here we're back looking at our barbs so i'll just make some space right here and add another transform node and i just want to move this down half of the height of one of these barbs so we have the height value right here and we just need to bring in a combine xyz that way we can target just the z and we can plug this height value into the z and it looks like that's going in the opposite direction ring in another math node right here and we just want to divide this by negative two so this is rotating from the middle now and it looks a little better i'm just going to change the thickness of the wire over here something a little smaller and if these look too spiky we just have to go to our barbs and change the scale value right here to something a little lower if you don't want to have to change this every time you change the thickness you can always tie them together that's what i did for the one that i put on gumroad and i did that with a whole bunch of things so that you just don't have to tweak things as much to get a good result but i'm not going to spend a whole lot of time on that in this video so if you want these to be all rotated slightly differently we can bring in another spline parameter and we can plug in the length just like we did for twisting the wire it's basically using the same method and then you can control how much it's twisting with a math node same way just multiply it like that and if you want to be able to just overall change the rotation instead of using a multiply we would just use an addition so we can change this to add so when we have the multiply set to zero and they're all rotating in the same direction this will move all of them the same speed basically and we can clean this up over here and rename this instance rotation alright so this is everything we need to create some working barbed wire and now you should be able to just go into edit mode and extrude this wherever you want and you can tweak all those values like moving these barbs further apart things like that now if you want to add a material to this you just need a set material node you can put this right at the very end and that will change the material of basically everything if you want the barbs and the wire to have two separate materials you could just put one right here for the barbs and one right here for the wire for this example i'll just put one at the very end then we can go over here to material properties and add a new material and now we can select that over here and we can change this to whatever we want i'll just go up to look dev and make this metallic if you want to be able to control some of the parameters for your barbed wire but over here instead of tweaking a bunch of nodes find your group input right here and take this blank slot and plug it into whatever value you want over here you can also select this and duplicate it and move it around wherever you need to so we can you know put one for our subdivision our resolution right here this is our twist value and if you want to rename any of these you can just hover over your geometry nodes and hit n to open up this side panel and then go to group and here you have options to change everything like if you want to change the name of this you can change it to subdivisions or whatever one thing that's cool about geometry nodes is if you want you don't have to use a mesh that you created here you can make another mesh in geometry nodes so i can just bring in a cube or something like that and just unplug the geometry right here and this will disappear we can just plug the mesh in right there it looks like i need to turn the subdivisions down a little bit like that and now we have a cube that's made of barbed wire so recently i made a video about making bundles of cables and i released a product on gumroad and i just updated it to make it more modular so that you can mix and match different effects so i'll just append one of those nodes i'm just going to go to file append and then find that file and if you go to my gumroad you can download the updated cable generator basically you just want to find that file go to node tree and right now i have a custom node named generate bundles and you just want to select that and append that and then you should be able to search for generate bundles and all we have to do is plug that in right here and that should generate like multiple wires right here so we can just turn the subdivisions up a little higher and now we have all of the options from our cable generator and from our barbed wire generator so if you want you can just add a whole bunch of barbed wire like that change how far they're distorting something like that or if you really just wanted to create an array you could do it like that just use the location offset so any way you can think of to generate points and geometry nodes you can use that to make shapes for your barbed wire so if you watch my last video about moving points with geometry nodes you'll find a few different methods in there to play around with which is one of them that i'm using right here alright that's it for this one use my link in the description to check out sketchfab and check my patreon for the project file from this video i'd like to thank my patrons for their support and i'd like to thank you for watching have a good one
Info
Channel: Joey Carlino
Views: 33,026
Rating: undefined out of 5
Keywords:
Id: CIvDpR8LQxM
Channel Id: undefined
Length: 27min 20sec (1640 seconds)
Published: Sat Feb 19 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.