pathway intersections manipulation in blender's geometry nodes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay hi guys and welcome to CG buildup and today I will be demonstrating to you guys something I posted about some time ago um in a certain shorts whereby I was doing this sort of pathway intersection creation I guess I mean see we have something here um if I just mute the geometry not modifier here you can see we have two curves here combined together and if I mute this you can see it's like makes this kind of path of thickness you can call then at the intersection it forms something like this something more cleaner okay it doesn't display such edges and this um this is something I'm going to be showing you how it did see if I just have this uh if you select this draw tool and I can just draw a line there or a path and you can see what it does in the intersection something something very beautiful you can even imagine need like a very clean clean Road here then there is a very beautiful intersection you know don't have those um kind of lines um Crossing each other showing that this is an intersection there's an intersection Point here here there's no intersection at all you know I can just go you know do this and do that you know beautiful something miraculous you can say Okay can do that or maybe I can go even something much better you know of just drawing over and over you know since I can actually I can just select everything and maybe I can just or a circle create something um cool looking a bit like I can scale this up can duplicate this move it somewhere there um or maybe Z and maybe just um select that P that prot just scale it um um really okay control link and shift the that one been place and maybe scale down a bit okay and maybe uh for these two points I can actually from that curve I can maybe set it to um individual Origins and scale it along the Y okay actually the X maybe I should leave it on the median point last time it didn't work and scale along the way and we can see it form Something Beautiful see you can add in maybe um another cycle and grab it to somewhere there you can see what it does in the intersections and that is essential what we'll be doing in this tutorial okay be making this beautiful intersections right here um you can get really creative with this um for example if you're making um an aunt like a pathway for some ants maybe go crazy something like that and because there it's like ants have this kind of Pathways and have the this weird intersections that kind of look like this you know you don't you can e get lost and that's simply what we're going to do um if you like what you see and you want to make it you can um proceed from here on and let's get started okay to start off I'll select everything by pressing a and X delete everything and add in build your pycho and maybe scale it up a bit and control a um apply the skill another thing is maybe to duplicate this circle somewhere there maybe draw something over there and yeah something like this and that one and maybe something there for demonstration purposes okay you can draw any Curves in any manner just make sure there's intersecting but not self intersecting in this spine having um segments intersecting with its own segments okay it because only works in intersections between two different splines this is um to make it work better for intersections of the SP s spline I think within the S spline I think it's more complex compared to what I am actually trying to do so I'm going to the geometry and workspace reduce the spreadsheet window press on the new and look from the top so first thing we have to make sure everything was in on the flat Z meaning that the position of every Point including the handles um are going to be in zero location so what I prefer to do is to convert this into a mesh okay then convert back again into to a curve so much to curve like that then afterwards I'm just going to Simply um set the position of every Point okay so set position also I'm going to multiply this position uh the position of every Point by one like that essentially everything is flat you know multiplying it one in the X and the Y but for the Zed I left it to be zero afterwards simply I'm going to resample this curve okay it's my it is within my preferences to resample this SC that's what I prefer but you don't have to take this tape if you don't like it but I like it and I connect this to the group input and it might be a good idea to rename this into lengthwise resolution okay length wi resolu something like that so afterwards we need this um to give it some thickness and the way we're going to do that is by simply first is capturing this attribute which is a vector and that Vector will be the normals of these of the points in this planes that we currently have but you know to give it some thickness we have to convert it into a mesh and since we newly formed PS and we're going to add in an extrusion and not of faces because we don't have any face but you need an extrusion of edges don't go for vertices it will give a more damaging results anyway the current results are still damaging because the normals that we're using are not the normals that we actually want okay these normals are based on Origin not not on faces because the normals in a mesh are more based on face orientation and edges and vertices normals are just aages of the normals the face in which they are surrounded with so offset I'll set it to zero and I'll set them in the way I like them to be by adding in a set position note and I will give the thickness um location based on this normal here so I'm going to just scale the normal okay and connect this into the offset and yes it's doing something and it looks better but it's not thick because um you know to make it thick actually you have to use this Top Value here and I'm just going to using a m PR node and and essentially this top is having values of Z and one and I want to change that zero to me -1 and I'm going to take this result and plug it into the scale now it's better actually um but the problem is it's too huge okay if you can see from my perspective it's huge and I want to be controlled so I'm going to exen just adding a math mode and that Math mode is going to be set to multiply and essentially this value here controls the thickness so but I want smooth control over this so I'm going to connect in the math no set divide and I'm going to divide it by a huge number like 100 say okay just for better control and I want want it to be controlled outside and it might be a very good idea to rename this value to thickness okay simply that and I can control it from outside and you know moving through the node tree over and over just to make sure that this thing is sticks like no remembering where this node is not really intuitive I guess not really good for our case in this geometry node so we're done we already made making thickness you know making progress um but we need to do something um in such a way that we eliminate such kind of Parts here just remain is a portion like here outside edges the outside edges you know something like you what you saw earlier in the intro or in the shorts that I pre previously made long time ago so what are we going to do um it's very simple first thing we're going to sort of layer out this part that we actually made all these um original curves that we actually had and these parts are like meshes okay and each mesh has a mesh Island and here currently um by counting from the original spines it's like we have a total number of five where we have two cycles this u shaped shoe shaped um path there's this one here and this one going in that direction so what we're going to actually do right right now is set the position of every of these mesh Islands in their own Z position so I'm just going to duplicate this one here and I'm going to combine connect in a combine XY Z and in The Zed remember in the original part we make sure that the point of every um every point in every spine in the original spes or in the same level in the Z which was the zero position now we're going to change such that if we add in a multiply a month node set to multiply and we going to multiply by the mesh Island index okay every mesh island has its own index its own unique index starting from zero and I'm just going to multiply by 0.1 you can necessarily add uh put any number that you want and I prefer 0.1 at this moment so what next now there are two parts that we have to go through after this so actually another thing to do we're going to add in a set position node and that set position is going to also be connected to a combine XY Z but here is where you have to consider about this number here any number that you keep here it be 0.2 0.3 0.4 whatever number even 100 if you like um make sure it's half it's um twice the numbers you're going to keep it here meaning that you take the number from here and divide by two and in our case 0.1 divide by 2 is essentially 0.05 okay and if you can calculate that just take 0.1 and divide by two and let your phone or calculator or anything that you have for calculating do it for you and another thing that we're going to do is essentially delete all faces but we have to delete all faces in such a way that we only remain with the boundaries of this path okay okay like this edges um outside and forget about this edges that make up this path in the middle um you can see those edges unless I turn on wireframe and you can essentially see that we have these edges here which are by two faces while the edges outside are surround by one face so we want to delete the edges as surround by two faces and leave the edges that are surrounded by one face so how to do that is simply a delete geometry because we want to delete the geometry right simply like that then from the selection we are going to um connec in our Compares equal and from this integer part in the a part I'm going to connect in a um an age neighbor okay just type in age and age neighbor and not zero not one but two this is actually what we almost want okay um what next is uh to extrude something okay um I know you won't get what I'm doing but essentially what I'm trying to do is sort of detect this intersection so of make a point here make a point here make a point here make a point here like this geometry should detect this intersection and makes new points over there there and find a way to delete these parts maybe I can um use the not like makeup point there make a point there make a point there make a point there and remove these parts here okay these parts these um edges here that are here that will be formed later and to make that beauty that you saw earlier okay simply like that so what are we going to do now so exential what I'm trying to do is just detect intersections really that's that's the thing that I'm trying to do in this current state so what I'm going to do right now is just um extrude once again um I'm think I sure this the last Extrusion and extrude edges and it looks ugly because of the normals and so offset scale and now we're going to set the position of the newly formed edges which are from this half a bullion of the top of one like that and essentially want to make sure they um the unformed tops are in the highest position possible in this geometry in this correct geometry in terms of the Z position so we're going to use an attribute statistic node for that and in the attribute I'm going to connect in a separate XYZ and connect in the position in this case and in the from the attribute statistic node we're going to um connecting the marks to a in a vector ma set to add then I'm going to combine the result and combine XYZ and like that and this should go to the Zed like that and connect the Y to the Y and X to the X this into the position and what a beauty except that I don't like the lines from the wireframe anymore and I'm just going to remove the wireframe for now okay that's the um one part and what we're going to do is repeat such a process actually from here when we off seted it by 0.5 and I'm going to take this part I not actually that take from here um without clicking the group with shift control D actually and move it there then afterwards we're going to change from 0.05 make sure it's negative now 0.05 like that and delete is going to extrude but in here instead of connecting the max connecting the mean and instead of adding um uh keep it as one but change it to subtract and you'll be done with this part A join geometry and like that and essentially what you can see is that we have created like these two layers s twitched by a space which you might not understand why we need that space and from here actually um yeah from essentially from here okay where we offsetted and deleted the edges that we didn't want so I'm going to press contrl X for that part here grab these parts to somewhere there yes that looks um useful then I'm just going to for the meantime join these things to make you see better spots over here that are new that are are now seen over here we have some edges that are intersecting these faces that are newly formed um from this system down here and those edges are the ones going to be used for detecting intersection this an old way that I used for detecting intersections um although that can works for intersections between within spines and um with within a spine and between different spine like inter inra intersections and um inter intersection if you can call it like that yeah so how are we going to actually detect such intersections well we're going to use my one of my favorite nodes in the geometry nodes and that is the breakast node it's a favorite node for so many of you and I'm highly encouraging you guys to use it I mean play with it or it's really helped me like one of the cloth generator that I made um which one day I'll post the second version I really use the r node in know many things um in this in a cross generator that I made so what I'm going to do is from this output I'm just going to connect in the Rost node and and from the rayus node I'm going to connect in a subtract in the ray Direction and from the vector position one and position two in the second one but the source position should be position two and in the in the ray length change uh duplicate and change the subtract to distance like that and essentially by doing this we have made um a syy of detecting intersections and you'll see that if I start separating um the um based on edges and in the selection I connect the is hit and if I now look from the top you can clear see the edges that we have here are essentially intersecting with I am in some parts because of the 3D cursor and sometimes the origin might even end up confusing you so essentially like that but if you switch to the inverted okay by pressing shift alt um you'll see there won't be any edges um that not intersecting unless you a spline that has intra intersection by this intersections within a spline okay we go with that inter intersection and inra intersection yeah you know it's confusing where they next up um let me just go back to the selection is just duplicating and we duplicate these edges so uh so that each Edge is of its own not connected to the other because we will be doing something sort of um subdivision if I could be doing only subdivision for some reason it makes it um uh more time consuming for blender so let's just resum instead so next up is just a mesh right C to mesh like that and okay something is wrong it's converting it into a curve okay mesh to curve kind of mixed myself up there then this this point uh this count value here is going to be like our Sol so and I would like to control it and I'll just rename it to solve okay something like that that makes it better with a lot better actually so makes it better for better calculation for blender it makes it more accurate more accurate sometimes if you increase it too high it makes it pointless like 10 is actually pointless at this time so something like six is much better sometimes also too much but you know it's too much and if intersections are a lot maybe it's otherwise it's it's otherwise um better to increase it but at this point I think six is enough if it won't be okay we'll have to go back to 10 and forget about calling it point and we're going to use uh field that index and you guys having higher higher versions are like 4.0 at the current moment uh using evaluate at index so position and in the index we're just going to add the index okay by one and now it looks bizarre why does it look bizarre what's the source of bit looking bizarre because of the points um I mean the end points so what we have to do is simple just from this selection connecting a Boolean attribute set to not and connecting the endpoint selection and just like that and everything goes back to normal you know it's like nothing changed but something changed this is the process where we seeing nothing happening you just have to follow as I go or else the result just like you just have to trust your Logics okay so for the second uh set set position here we'll have to again use this rast mode okay and we are going to duplicate this over here and we're going to take this one here okay from the field that index we're going to subtract it again from the vector and from the ad uh currently then we're going to connect this Vector to the r Direction and also distance because we actually want to limit this okay sometimes you don't yeah always you have to limit this then take hit into is hit actually and we don't have to temper again with the end point if we do temper things are going to go wrong and it should should be an end point so just use boan M set to hand and for the position position again you don't see any changes but you should follow what I do okay then afterwards we're going to capture an attribute okay because they are those that we added by the resample but they haven't hit anything so actually we have to do it again here and set it to not okay we want to know them which are they some of them might get even deleted in the way and afterwards we're going to do another set position on but this time we're also going to duplicate this and move it maybe somewhere there and set it back to add okay and in second round not the end point rather we have to say those that didn't hit before okay but those who are going to hit now by connecting it to the Boolean node and connect this Boolean to the selection like that honestly and afterwards what are we going to do we are going to capture those that didn't even hit before and even now and they're not even end points and we're going to capture an attribute again okay and press shift control D okay you might be wondering why don't I even use the user node uh the viewer node I guess I trust my instincts more I hope they don't betray me anyways in the end of this video and I'm going to capture it's a brilliant not a flot and I prefer changing it willingly despite might not make any difference if I leave it to uh to be a float but I prefer that way and we're going to delete touch points and we're going to Del them from that essentially again you don't see any changes they just moving along the edges okay these points are moving along the edges you can't see the changes right now so afterwards simple convert it back into a mesh and we're going to do a merge by distance and we're going to essentially um not involve the vert which have a vertex nebor of one essentially the original end points you can see them like that so I'm going to compare use a compare not set to equal use a Vertex neighbor of one of two actually Okay and like that and to make it more accurate I'm going to suggest we um just use um I mean a scale elements it's coming out of my head and ages and combine XY Z same here and take this one to the center as well and here going to S it to a very huge number and just to come back again to you know 1 over 200 looks like nothing changed but things changed and we are about to see that change okay and I'm going to use in a join geometry node right now and we're going to use join it back with these original ones where we have no edges intersecting and connected to something like where is that towards that join geometry we added and something like this okay it's like the whole process if you're mute and unmute it look looks like nothing happened but you are going to see what actually happened we're going to uncover the Mysteries that we actually made anyways afterwards we are also going to much by distance with using the same same logic that we used scale there scale there um take this combine XYZ take it here and take it there something feels odd take that there and I wonder why combine XY Z oh it's 200 and 200 okay that might might make things better and yeah I did and to make it more accurate we actually want now to match those that have a Vortex neighbor of one okay and type it one there take it to the selection the mod by distance now let me look um actually I I to make sure something is correct and that is it is at this point make sure the number of vertices and number of edges are the same number I mean they're in total the same amount make sure they're cyclic because we started with cyclic we need to end here with Cy click okay now we see the amount of vtes increasing and that's different from the original where we have here we have 1,580 84 initially we had 100 uh 1,430 in both vertices and edges see we started with the cyclic we should end with cylic as well okay so um we done adding the vertices how the hell are we going to delete these edges over here to make it now more beautiful you can say okay remember they also in the same original layers as before remember this layering over down down here that was dealing with the whole um detecting uh the recasting you know this or M we have made here now and remember this part before where we deleted the edges now there this part here okay before we deleted all these and the edges that we didn't want to make sure they look like that we need it okay at this moment now when you see that you kept 0.5 that is positive connecting a rayus node okay simply like that just connecting a Rus node and if it's 0.5 a positive number make sure now here it's negative and from here if it's a negative number connect in another recast node but this time um make sure it's positive so negative keep the positive one in the Zed okay if it's uh negative keep positive it's positive keep negative you know RSE and for both cases we just need an or in this case and we just need to remove this is hit to somewhere here yeah connec in a rear route zoom out and go back to where we actually are okay we already have this important information all we need to know now is delete not everything and we don't actually need to delete points well we want to delete edges and connect it there and looks ugly from this point of view looks beautiful from above essentially that's what I was talking about you don't see any changes but in the end at a time like now we see what we can see you know if I zoom in you can see something beautiful is happening right now and now we have to set them back to the original position which is zero in the Z so just multiply the position okay as I'm doing right now one 1 Zer okay one in the X one in the Y zero in The Zed simply like that and we're going to do again this thing that we did here with the mo by distance and shift D3 and yeah my computer is learning right Bly and we reaching the end what how beautiful and R that route that and connect it to that connect it to that okay and do we still have the same number of edges and points no why don't we have we have different number of edges and points um I don't really know I mean f this one and I wonder why combine x y z actually this now it's starting to betray me once again H I do not know why this is actually happening every point is in the zero okay perfect 0 0 in the center um one Str 0 0 much by distance um everything should be okay but it's not because the edges um and point should actually be the same amount of number yeah but this is actually essentially how you make it okay I'm not sure why that happened but we're going to edit Moree and start drawing hopefully yeah everything turns out to be okay okay see this is what some of you guys requested I do as a tutorial and I'm reaching to the end my computer is essentially dying right now so if you like the tutorial just subscribe and see you next time
Info
Channel: CG build up
Views: 2,373
Rating: undefined out of 5
Keywords:
Id: KvCPQXQy-OY
Channel Id: undefined
Length: 36min 17sec (2177 seconds)
Published: Tue Dec 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.