Houdini Algorithmic Live #081 - Procedural Metro Network

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello hello so hopefully this is on live hello this is your jericho and this is the live tutorial for houdini a weekly tutorial for joudini which is called as houdini algorithmic life and this is the 81st episode for this tutorial series and the topic for today is to create a kind of a random generated metro network using houdini procedurally and use that network to run some particles on top of this network as a train so this is one of the example that i have which is which has been created from this a rubber toy test geometry and then procedurally creating a network like these using a very basic concept of um manhattan geometry manhattan distance or taxicab geometry then controlling the point positions on top of these network using a solver to run the points and as a result and these boxes are some random boxes generated from a original geometry to make it as a building okay so this is the final things that i would like to create today creating a network and also running those particles on top of the network as well as having some some building geometry uh nearby the network the network okay so that's my plan and before getting getting started let me first explain the overall process that i'm going to try to do today with the sketch so first of all i'm going to give some input geometry which can be used as a guide to create a network like a boundary geometry then in the second step i'm going to plot some points inside the geometry and then based on some distance threshold i'm going to connect these points with other points maybe by a distance closest distance or maybe a number of connections that each point can allow and so on and create some network these they've when you have created these kind of line networks at the moment the line network is a bit too randomly distributed so it doesn't really look like a um metro network like clean metro network so in order to make it clean i'm going to use a manhattan distance algorithm or a tap calci a taxicab algorithm to create more of a diagonal using a straight or 45 degrees lines to connect each points or reconnect the points using 45 degrees or 90 degrees angle and so on which will create which will eventually clean up the network more look organized these and finally i am going to run some train on top of this network maybe plot some points on each line and let it go on top of this network and using those branches to change the line by themselves maybe randomly and maybe at the fine final step maybe i can just create some other buildings close to the network to make it more look like a three-dimensional like structures or infrastructures or urban space okay but all these are more of a random generated stuff so uh maybe it could be a bit too random-ish maybe not too realistic but the idea the same idea can be could be used for many other purposes so i think the process is still interesting so that's what i'm gonna show and let's see how i can do this from scratch okay so first thing first i am going to create a geometry node and create a input geometry as a guide first of all so let's give any test geometry that you want to use since i have tested with using a rubber toy maybe i can just use another type of geometry maybe backhead should be fine all right so first of all i'm going to plot some random number of points on inside this geometry so i'm going to make this as a volume first using ice offset with some density and then i am going to scatter some points inside this geometry and the number of this point will be the number of node for the network uh it can be considered as the the number of the station for the metro okay so let's see let's create some null node as well to have the parameter in order to control the number of points so let's see i'm going to color this blue then try to create some parameters maybe an integer to define a number of points or a number of node so let's say number of stops or something and i'm going to make it between one to maybe 200 in the range okay then copy this parameter and then paste it into this force total count for the scatter node okay now you could choose either relax or only relax maybe it might be a good idea to relax because the distance between the points will be about the same around the same distance so might be useful in terms of creating a distant network and then network lines based on the distance but it doesn't really matter in me you could also check this off as well if you want to have more randomis pattern okay so i guess i am going to make this turned on for now and what i am going to do here is to first of all create some line network in between those points uh using some distance at the threshold value okay so let's do this i'm going to uh that but first of all what i would like to do is to since right now the point is really at the random point positions inside the volume so maybe it still is a good idea to align these point position maybe based on the grid uh maybe snapped onto a three-dimensional grid so let's try to do that first in order to do that i am going to use a points from volume this one and then try to create the volume graduate points out of this volume that i have created okay so these volume can be used as a the guide for the these point to snap on okay so what i'm gonna do is to find the closest point from this grid points and then snapped on to that point the closest point now it's a bit hard to see the points so i'm gonna raise up the point radius a little bit all right that's good okay so let's snap this first which is pretty easy i'm going to use the wrangle to do that first of all i'm going to find out the nearest point positions from the second input and then get the nearest point positions out of this point number all right now i can now move the current point position current current these point position to the nearest point position retrieved from the grid points as a result all those points are snapped on top of the grid just like this all right so as a result you'll be able to get more clean line network in the end okay now since i have just snapped the point position some of the point might be in the same position so meaning there are some duplicated points in the same positions so maybe i can use the fuse to remove those duplicated points let's see so before 71 now it's 71 so maybe no duplication but that's good all right now next i'm going to try to create the line based on some threshold so to do that i'm going to use a point wrangle for each going to work on each point and probably what i'm gonna do is to try to create a search radius from each of the point and if there are some points within this radius pick maybe a random number of points out of these found out points and then just draw a line like that so let's do this i am going to name this create line to work like this okay and first of all i'm going to set some threshold value which is going to be the search radius so search radius all right okay let's see and then i'm going to search for the nearest points within this radius using a new points function so in order to do that i'm searching for the input zero soul which is the first input then using the current point positions to search and use the search radius now there could um by using this new point for your self input meaning that yourself input the point yourself is being included in this searches so always the first point retrieve from this new point is yourself which is equal to at p so we got a um ignore that point position so if npt at the count of this searched re result is more than one meaning if it's equal or more than two then that's when you want to try start creating the line okay so if it's more than one then i'm going to create a number of lines out of these points now maybe i can also define how many number of lines you want to create so i'm going to create a number lines as a parameter another parameter and let's say i would like to create three lines maybe maximum three lines out of each point all right then what i'm gonna do is to use the for loop maybe from one to a number of lines incremented i by one okay num lines all right and this i will be used as a a index value right here although although there are chances that there are like so many points found out within this search radius so maybe it might be a good idea to just randomly pick um the points out of these arrays for each loop so let's do this you can hear maybe the audio is not so lao today okay let me try to raise up the volume if it's it's gonna sound better how's this that's too loud let me know how it sounds okay i just raised up the volume a little bit all right that's good now where was i so so i was trying to create the number of lines and in order to pick the points out of these let's create a random index for this array so i'm going to create a variable called index which is going to be an integer to access these points and then first of all create a random value using some seed maybe based on the point position and that's probably it that i need also based on the for loop i value so let me try to multiply this by some random constant value and maybe i can add some seed value so that i can change also the random values by yourself okay so the result of this random value will be in between zero to one float value so i wanna con convert it into an integer value to be used for the index so first of all i'm going to multiply this 0 to 1 value by the length of the array all right and then make this a integer value by making a float a floor value okay and then now i think i can just use this as an index value so npts now one thing that i need to be considered is speak is that um right now this flow value might be possible to create a value zero but we don't want to use zero as an index for this array because as i said the zero means this that you get the point yourself which is at pt num or at p so we're gonna make sure that we're not choosing the zero for this value so to do that i'm going to clamp this so that the minimum value will be always equal to one so max one so i get the max value either one or this one as a result you are not going to get any zero value out of this all right so wait a minute now this just doesn't have to be called as an index but maybe i can just call this npt the picked uh point number oops this itself was actually an index value all right now the point has been picked let's try to create the line in between those uh the current point position and the cert the result that being found out with this search radius so let me just change the seat value and try to create a line using at prim zero poly line between the current point number and npt okay maybe the radius might might not enough to search let's raise up the radius to see if i can create those line network okay looks good starting to create some line network which looks doesn't really look like an original geometry but that's fine because it's a bit low res we don't have much number points right now but we could try this out later all right thank you for your comments and if i change the seed i can change the pattern how the line should be created okay so far that's good but as you can see this is a bit too random-ish right now which is not really clean in terms of the network so we're gonna clean this up to make it more organic organized network all right to do this um first of all i would like to remove the duplicated line there are chances that the duplicated lines has been made maybe the point the line has been graded from this point to this but from this point maybe another line has been graded to from this point to this point so there is a chance that the duplicated lines has been created so in order to do remove those duplicated ones i can just use the convert line node okay so previously was 142 lines now it's 123 lines so maybe some of the duplicated line has been removed all right now now what i would like to do now is to make this as a more diagonal or more straight line straight based lines based on the x y and z axis okay in order to do that i'm going to use the idea of this taxicab geometry so consider this is like uh the the street of manhattan and because the one the cav would like to go from this point to this point now initially i mean this just want to go straight ahead if it's possible but since the cab has to go through the road you have to find out the closest distance out of these grid so the the option is to choose either this red blue or yellow so what i'm gonna do is to try to create try to use this idea and even though we have this straight line we're going to split it into x y and in this case we have three dimensions so z axis and probably using this red lines is a more most easiest way to like split the straight line into these straight line these directional line into these straight lines in this case if we have like green lines in two dimensions you need you just need to split this green line into two in order to create this manhattan distance on my taxicab geometry so one line goes straight on y direction and one line goes x on x direction okay so if we have one more axis in this case z axis then we we just need to add one more line so in total we can have we can just use three red lines in order to create a straight taxicab geometry for any kind of directional lines okay so let's try to convert any kind of line into three lines using x y and z which should be straightforward let's think about this how we can do this in sketch so let's say we have a line like this this is 90 degrees and this is 90 degrees okay oops let it go okay so what we what i would like to do uh wait a minute no this is not the original geometry sorry but the original geometry that we have is this green line which is presented as presented as a three-dimensional line and if we wait a minute it's happening we just change this to crash tool why is it changing to a okay sorry so let's say if we have an x y and z direction maybe this one's x this one's e this one y and if we project this on projectus curve line into each axis for the y looks like this line for the z looks like this line and for x looks like this line and if we add all those lines together then we'll be able to create the same lines just like the addition of the vector now the the things that i draw here is doesn't really look like what i would like to do here but uh the concept is you need to have three lines add up to create the original line okay so most of the time when we do this we are we're just using the vectors without visualizing its direction but in this case we can directly visualize this vector each axis value one by one as a line itself as a line geometry itself and then as a result you'll be able to convert this straight line into a three to three x axis related lines so which is easy to do actually let's try to do this so i'm going to name wait a minute i think i have some problem with my keyboard okay maybe some key has been pushed towards something what's happening here okay sorry for that so i'm going to use a primitive wrangle wait a minute okay i think i'm having some problem with some mouse or keyboard or something maybe due to my sketch okay think that's what okay let me try to i think some option key has been pushed continuously for some reasons not sure why let me just reset my keyboard oh my okay not sure what's happening here okay i think it's being fixed hopefully all right okay sorry so where was i uh wait okay something just happened okay i think the connection between the ipad has been disconnected so it's not a problem so i'm gonna create a taxicab geometry or taxicab lines should i say and with the primitive wrangle so currently i have these lines and i'm going to access to each line and convert it into a taxicab geometry as a polyline okay so in order to do that first of all i'm going to get the first point position and the second point position of the line using a frame points then get the point position for the first point and the second point from this point numbers since each primitive is considered as a line so i think there's only two points for each primitive so i can just do it like this in order to get the first point and the second point position right and first of all i'm going to calculate or get the vectors from the first point to the second point by just sub uh subtracting those uh point positions so direction is position two minus position one so this is the vector value goes from one point to another right now what i'm going to do is to compute this or split it split this into three vectors one for x one for y and one for z okay so first of all direction x is just retrieving the x component out of this direction and for the other value i'm gonna make this zero for a direction y i'm going to get the just the y value y component and then for the z value direction c i'm just going to get dz component like this now that i have three vectors i can try to create a point position using those uh three vectors so the first point is the same so we can just use the same point position now the second point position and will be this point position plus this direction x or maybe direction y or direction z maybe you can just choose randomly well let's try to do like let's try to test from going from x y and z so new position one can be position one plus direction x okay and direction new position 2 could be position 1 plus direction x plus direction y now the final position can be either adding position 1 plus all x y z or it's also same as the position two so i can just use the position two for the final point position so now that i have two point position being calculated i can add a new point position using add point like this and then connect all those point as a polyline to see if i can create those taxicab geometry so let's try to to do that polyline is equal to add a primitive polyline and since i think i have in total four points in this case maybe i can use the array for the final input for this one so like let's say new pts i'm going to create this new pts array to contain all the points that i want to use to recreate the polyline out of this line okay so the first point could be a current point number or the point for this position one so that is pts zero now the second point will be this npt1 so npt1 and the third point is this npt2 and finally the final point position was same as this one right here which is pts 1. right okay so some polyline has been created now we need we also need to delete the original lines which is not necessary anymore so i'm going to remove those using remove prim to see only the created uh lines now you can see that the line has been converted into a taxi cab geometry which is which more looks organized than the one before and if i try to select one of those geometry i can see that there's always three lines one two three okay one two three and so on sometime is if the line has is at the same like axis maybe there's only one lines or two lines but that's not really a big problem what we need to know is how we converted this random directional lines into three different component and create this straight based lines okay so so far looks good i think now there is a chance that um we want to change the order of this x y and z currently i'm adding from x to y to z but if we change the order for this one like for example if the z comes first and then maybe a y comes next then the whole network will change like this so maybe it's a good idea maybe it might be a good idea to chan to be able to change the order of this edition maybe based on the randomness or maybe random seed okay to be able to create more variations so to do that we think it's a good idea to make these x y z component or x y z direction more general before doing that i gotta fix this yeah okay so in order to make this general i'm going to uh con um i'm going to insert these three vectors into a one vector array so i'm going to create the directional array a vector array like this and then i'm going to create an array containing all direction x direction y and direction z now what i would like to do now is to cr shuffle these array based on some random seed based on some random c maybe the red direction y comes first or direction z comes first and so on so in order to shuffle the array i don't think there are such functions in houdini so i'm gonna create that using a simple a rather simple method and let's also look at some vex functions what kind of functions that i could use in order to shuffle the array now i think i can use the order or reorder function so reorder is used to order the values based on the indices okay so when if i could if i could create a random indexes or random indices um as an integer which contains the same number of uh elements as this array in this case three elements then we could use that to shuffle the geometry and for each indices i can just pick the random values for each element so [Music] i'm going to create a for loop first of all i'm going to create a indices array like this and then create the for loop loop through all the directions in this case we have three directions so i'm going to create a three iterations three loops and then for each indices i'm going to append some random index numbers maybe using the random functions based on a primitive number plus a i value and maybe additional seed value which you can input by yourself now this random itself will create a float value in between zero to one but we what we need to have is the integer value inside this indices so let's try to multiply this by i don't know some big numbers like ten thousand then make it make a flow value out of this float number to make it as an integer then can apply that inside uh append it inside this indices now as a result you'll be able to get you'll be able to create a array which contains the three random integer values contained inside this then we can reorder this directional array using a reorder function based on this indices right now what i want to do next is to replace these direction x in direction x plus direction z with the value from directional array so the first one will be directions the first value of the directions it could be x it could be y something and the next one could be zero plus one oops maybe something wrong okay and doesn't really look like what i would like to have so probably something is wrong let's see why and sure why let me first check the indices how the indices look like and see what happens okay so the indices looks okay to me yeah in order to use it for the reordering i think that's fine let me let me go back to the vex functions page to see the reorder so returns the real version of the characters or the array so it should be fine right now and let me also check the directional vector value first of all i'm going to check this direction x or direction zero also i'm going to check the direction one and see how it looks like it should be either wait a minute everything is zero okay okay something's wrong okay okay what seems to be wrong here so i have if i didn't reorder it okay now it works so seems like something bad happened when i reordered it okay all right let's see what's wrong maybe i cannot really use the indices that i have created by myself maybe i can try to create the indices using the other vex functions which is called as args sort so let's try to use this one to create indices so in order to use this i am going to first of all i'm going to create a arg as a flow value and in this case i don't really need to use the convert it into an integer so i'm just going to use the random value as it is from 0 to 1 like this and then append this value inside the argument array like this now i'm going to recreate the indices all right using arg sort using using the argument arrays now i'm going to reorder the directions and using okay now seems to work seems like i cannot just make the indices by myself but need to be created using this one maybe uh there are some rules for this integer value okay now i don't want to remove the original lines so just like this okay now i am now be able to shuffle this order so if i change the seed i can change how the connection looks like by changing which component comes first x y or z okay looks already nice i think now let's go to the next one [Music] next things that i would like to do is to create a more of a diagonal curve or diagonal lines currently there's only like 90 degrees like angle for these network but maybe sometimes i would like to have some diagonal curve maybe based on the 45 degrees for this direction maybe for this direction and so on for this direction and so on so let's also try to add this 45 degrees diagonal directional curve to this 90 degree polyline okay so i'm going to also consider what will be the rules for that so now i don't have a i don't have a pen right now so i'm gonna try to draw it with my mouse so let's say we have this polyline what i would like to do is to draw some curve like this like this in between those where the 90 angle is there and as a result i would like to create this kind of diagonal curve combined with the original geometry original polyline okay to do that um one of the idea that i could think of is to first of all let's say i would like i have this geometry now starting from the point zero we have point one point two and point three okay and we can consider the distance between the point one and point zero and point one two point two okay d1 and d2 [Music] now since we i would like to make it as a 45 degrees uh the maximum distance or the maximum distance that i could used uh from this point or i mean from this point is this one which is less than smaller than the d1 d2 so what we need to do is to first of all get the distance value which is the minimum of d1 and d2 which in this case this distance and then use this distance to estimate the point that i would like to start drawing the diagonal line and create the diagonal line like this okay so this is the first step now for for the second step we have kind of a leftover space right here and we have another full length line right here so we are going to recalculate the distance d1 quote d2 quote and get another minimum distance out of these two distances and probably this is smaller in this case so i'm going to draw another diagonal line like this and then for the other for the rest of the curve i'm going to make it straight like that so until in result what we are going to get as a curve is wait not this direction like these directional curve now i could also um multiply some ratio value to this distance which is in between zero to one so that the diagonal line can be start from some random positions to make more variations in terms of the curve bending all right so that's what i would like to try to implement and in order to do that we also need to consider if the line looks like these or if the line looks like this if the line looks just straight then we don't really need to create any diagonal lines so we gotta skip this if we have one angle 190 degree angle then we just need to do one we just need to add one diagonal lines if we have three lines then we can add two diagonal lines okay so that's the rule so it might be a good idea to organize the current like polyline whether it has just two points three points or four points currently every polyline has four points even though if it's straight or not so let's try to make it a bit more organized so that if it's straight then we only have two points if it's just one degree one ninety degree angle then we have three points if we if it bend two times then we have four points and so so to do that it might be a good idea to do it all inside this wrangle node so let's see where we could do that okay so um this is where uh where we are adding two points right now there are some conditions that we don't really need to add those points which is if the distance between this n position one and this position one is equal to zero or the position between this position one or i mean this position between this end of position one and position two is also equal to zero then in those cases we don't really need to add a new point but we can just skip it so let's check the distance between the n plus one and position one if it's close to zero then or if it's more than zero then we can add the point so if it's at least more than point zero zero one then we can determine that this has been this has some distance separated so in those cases i can add a point now i can add another uh rule here the distance between the and position one and position two is also more than point zero zero one so in those two cases those conditions maybe i can add a new point okay and since if the condition doesn't really meet then i do need to re create this npts array so let's bring this beforehand somewhere around here starting with just point one or the first point position then only if the condition meets then i'm going to append this npt1 to this array same for these if i'm going i'm just going to copy this conditions here if the in position 2 and position 1 and position two in position two the distance is more than zero then i'm going to create a new point and add it to this npts array all right now finally i can append the final point number which is in pts one now the visual doesn't really change but the number of points has been changed and some primitive has two points sometimes some primitive has three points and so on let's see if we could find out some lines which only has three or two points for example this one has only one uh directional angle so we try to pick this up nope that's wrong this has actually two curve bending let's see where i could find those somewhere maybe this one yeah like this one so if i look at the point count number this is equal to three so previously was equal to four but we only need three for this one single bending okay something wrong with the network i'm not sure if the network's network is okay hopefully it is right okay so now the geometry has been cleaned up a little bit it's time to make this uh my time to make a diagonal curve out of this taxi cab geometry so let's screw let's have another primitive wrangle name this diagonal diagonal null curve or diagonalize maybe all right so another set of rules that i have to think of first thing first i'm going to retrieve all the point numbers out of this out of each polyline so okay now as i said if we have only three points i just need one diagonal line if we have four points we have two diagonal lines if we only have two points then we can just ignore it so let's create that kind of conditions here i'm going to create a for loop based on changing the total number of loop based on the point number so the total point number minus 2 should do the job so if it's if the point number is equal to 2 then no loop it's been processed if it's equal to three if this is equal to three then one iterations is going to be done if we have four points then two loops two iterations for the loop and so on right and i'm going to get a three point in order to get the first point number second point number and the third point number right in order to create this diagonal line to calculate the distance and so on so p t zero let's say is equal to pts i pt one is equal to pts i plus one pt2 is equal to ptsi plus two and i'm also going to get the point position out of these point numbers so vector plus zero and so on just going to copy this 1 2 one two so let's first calculate the distance between the position zero and position one and position one and position two which is correspond to uh these value this distance is from position zero to position one and this distance is in between position one to position two so float this one is distance between position zero position one distance two is equal to distance position one and position two all right and then what i'm gonna do is to get the minimum distance out of these two distance so what a smaller distance so i'm going to name this temporal minimum distance and then use the minimum function between the distance 1 and distance 2. so as a result you'll be able to get the smaller value either a distance one or either distance two all right now that i got the smaller distance i can now um i can now [Music] what was i trying to do i can now try to create this point position let's say this is d1 this is d2 and what i would like to do is to calculate or get the point position somewhere around here and create the diagonal lines right here and also get this point position right here so this let's say this is called as in position one this is called this and position two and we would like to get this value here based on this distance and if i just use the distance as it is we can just create this line but if we multiply this distance by some ratio then we'll be able to control where does this line goes to so let's try to control distance by multiplying multiplying it using some ratio value it could be random but it might be a good idea to control it by yourself for testing so first of all i'm going to create a ratio flow parameter by myself starting from 1 and then multiply this distance by this ratio okay now let's try to create a new position the first position can be determined by starting from the position zero or position one maybe if we think about like if we think like this uh let's say if we have this and this is position one position zero position two and we do know the direction between position one to position zero position one to position two by just subtracting the point position between so we can say starting from position one we can add some vectors to go to this way or either to this way with the value d multiplied by ratio okay and then determine where the point should come and this distance has to be same for this direction in this direction in order to make it 45 degrees so and we do have the distance already so we just need to give some vector calculations so first of all i'm gonna get the normalized direction going from position one to position zero so position zero minus position one normalized and multiplied by the distance and the second point position will be position one plus normalize position two minus position one multiplied by tm distance okay so these are the these should be the new position that we want to add so let's try to create a new point as a geometry using at point then okay so this is how it looks like right now and let's try to recreate the polyline based on those informations now right now but uh if we have like if we want to add additional diagonal lines for the next loop then we got to consider something else but this is to test if the single diagonal line is going to be okay or not so i'm just going to limit the loop by one for now so that will be easy to debug so currently i only have one diagonal lines for each polyline now let's try to create the recreate a pulley line as a diagonal line so first of all i'm going to create empty polyline maybe outside the loop probably or maybe create a point array point number arrays to be used to create the polyline so mpts create the empty integer array like this and starting from a very first point which is a pts zero the very first point number right here okay then i'm going to then append this npts with these npt1 and pt2 and for the other points i can try to append the last point from the pts now obviously this is missing some points in between especially if you have three lines but let's see if it i'm just i just want to check if the first diagonal lines has been created or not so let's see now i'm going to create the final polyline using these npts and then as a polyline and then also remove the current straight based line straight taxicab geometry so remove prime like that okay maybe that was that wasn't like a very good idea because because i'm missing a bunch of points actually so probably i do still need this loop and also and then let's say this is let me see let me see well actually if i look at this obviously something is wrong especially like these so previously it was like this curve and okay so first let me just pick this curve so that will be easy to debug i'm just gonna pick a single curve to test all right and see what happens first of all i'm gonna check what's the point order for this one okay well one problem here uh the point number is a bit uh random random the first point goes this one the second point goes here so i don't think we can just use this print points as an ordered number but instead i think i should use the prim a vertices or something which should preserve the point order based on the primitive shape so let's go to d frame vertices and this use this one instead which will get which you'll be able to get the vertex number the linear vertex number i think then we can convert this linear vertex indices into a point number later okay so bts is prim vertices and then i am going to loop through all the vertex numbers i'm also going to create an empty point number array and then for each vertex number i'm going to retrieve the point number related to these vertex using the word vertex point like that now i can append this point inside this pt array all right now that should we ordered the point array now but i still have some problem here here let's see what's the problem so let's assume that the point has been started from here so the first diagonal line has been created fine i think now the problem is on the next loop point has been started from this right here so we do need we actually want to start the point from this point where the diagonal line comes to this well we do need to consider the the leftover distances so actually originally if the shape like looks like this and if the diagonal lines comes like this then the only this the only way we could go is this way straightforward without any diagonal lines created okay so and we are missing that conditions so in the second loop i think this the first loops going okay we can check that by just trying to delete one of the point out of this maybe just delete this one and see what happens so in this case we have three points one angled 190 degree angled and so if there's only one angle then one diagonal lines being created without any problem so that's good so what we need to do is this conditions if we have two diagonal like bending i mean to 90 degree bend bending so in this case if i is equal to one right so in this in these cases let's see first of all if we have a directional diagonal curve like these then we need to consider the minimum distance in between this length and this links in this case that minimum distance is equal to zero so in those cases we don't we no longer have any diagonal lines for the second step so we do need what we need to do is to calculate the left leftover distance that might be able to use for the additional diagonal line so to do that we do need to use some of the value calculated like here especially this one right here okay so this is the final distance this is the final distance for the first diagonal line if the loop is the first iteration now after we have i have got this i i would like to use the same value in the next loop to calculate the leftover value okay so let's try to create a another variable called mdist starting from zero okay and then do some another minimum functions between the the distance one minus m dist and the current m this tm dist so this doesn't give any changes in the first loop but in the second loop the m distance should be um updated so in order to use this i actually need to also update the minimum distance like this okay so in the first loop the m distance is equal to zero so it is calculating the smallest bond between the distance one and tm distance now in this case tm distance is always the smallest or maybe equal to distance one so either way this value will be chosen and in the next loop the minimum distance has been stored with this current the first loop minimum distance so in the next loop you have a bit of smaller distance which has been used with the first diagonal line so if the distance the first distance the first minimum distance around here then the left over distance is this this one in the next loop in the next loop first of we are looking these pairs this line and this line in the next loop we are looking at this pair and this line and this line as a pair so distance one means this distance and subtracting with them distance which is the distance that i have calculated previously so what we have is the left over distance that's this and we're going to get the minimum distance between this one and this one which is the current dm distance and as a result i should be able to get this curve right here at this distance right here and be able to create another second diagonal line which look sounds really confusing but let's see the uh if it's going to work or not okay i have some errors i am having a spell mistake okay so currently so something has been fixed as i can see no more x line has been created but currently i only have one two three lines that is because the ratio is equal to one the diagonal line is going straight to the first the second point now if i change this ratio i start to see a second lines being created um so this is the first line first diagonal line second diagonal line and straight line so in total we have one two three four lines in this case well seems like i also have a chance to have one straight line going y direction diagonal line straight line on x or in this case z then on another diagonal line and one straight line on x okay so this is like that okay looks interesting so this is how it goes by changing this ratio i can create a different types of different variations of diagonal lines like these and that should also work for any other geometry so let's remove this blast see if it's going to work on all the other polyline so if it's zero you have an original geometry if it's one you have more diagonal oriented geometry it's 0.5 you have the mixture of the straight and diagonal lines okay looks good and you can just use these ratio like a hand controllable values or maybe you can also make it random as well if you want to make it random then what you just need to do is to change this to random related value maybe based on the primitive number plus a loop iteration value plus some seed value that you wanna that you can control by yourself and if i change the seed i can kind of randomly change how diagonal shape look like you could also use like like the combination with the clamp to control how much you diagonal you want or not and so on maybe it might be a good idea to also multiply this randomness multiply by the ratio so that i can control the maximum diagonal value even though if it's also random so if the ratio is zero even though you change the seat it always is straight but if i change the ratio to one then there is a chance that the maximum diagonal shape has show up okay looks good so now the shape is actually being i am i'm i'm kind of uh satisfied with this geometry itself the line network itself as a metro network i mean it's not really maybe the in real life doesn't really look like these shape but um it's just a kind of a procedural like fun procedure like testing experiments trying to show some way to create more clean manhattan-like network shape okay so this is one way you could do in three three dimensions okay so let's say i am good with these shape i actually like the shape itself okay now the network itself is okay maybe the final thing that i could do is to actually use this to run some train or some particles on top of the network as the animation um maybe you could really create some like node network based on like shortest distance node and so on going from one node to another node or maybe in my case i'm just going to create some random path for each particle to run on top of the network meaning just create a bunch of points on top of the line and then let those points run through the network randomly maybe some if the point goes from this point to the branch the point can go to the left can go to the straight randomly picked at a specific timing based on some random seed if in real life maybe you could create a real path between the station to go from one point to another in those cases maybe using the shortest find pass might do a great job but i'm not gonna do that i'm gonna make my somewhat random no some what random randomly working walking or run running train geometry on top of this network okay so let's do this now in order to do that i would like to make the speed of the running particle constant even though the length of the these polyline is different so in those cases i cannot really use the uv because uv is based on uv in between zero to one so instead of using uv i'm going to use a kind of a distance metric value to sample from a primitive using uv sample function so i'm going what i would like and what i'm going to do is to apply some distance based attributes to each point for each primitive then use uv sample node to access to those distance based attributes and use those to with a constant speed value to move the particle with specific speed i don't know if it makes sense but that's what i like to do and in order to do that what i need to do is to first of all let's say i have this line maybe this line and would like to travel would like to make point trouble from starting point to to the end point with the constant speed okay and in order to make it in order to and let's say i have another uh line okay and i also want to make those particles trouble on top of this line with the same speed okay to do that and to know to let point know where they are on top of each primitive what i what i'm going to do in this process is to apply first of all apply a distance based attributes on each point on the primitive okay so if the primitive has four points and starting from zero then on the next point what i would like to apply as an attribute is the distance from the first point so in this case maybe let's say d1 now in the second point what i would like to have is the length of this curve from the starting point so the distance between zero to one and distance between one to two that's the value that i would like to apply to the second point and finally what i would like to have right here i mean what i would like to have in the first last point is the total length of the curve so in this case a parameter and applying those as applying these value as an attribute you'll be able to sample the point position based on those distance value let's say if you want to have the point position on top of this curve based on the distance maybe you have the quote and the d quote distance is somewhere around here the length length from the first point to this point is the length of d quote then what i would like to do is to by inputting this value i would like to get this point position for the in order to determine where the point is right now at the primitive and to do that you do need to uh apply all those distance attributes to these points on a curve and then use the uv sample function to access to the point position using these d value as a virtual uv value okay and that's the trick and let's see how i could do this in houdini all right so first thing first i we i do need to apply those distance space attribute to each primitive so let's do that i cannot just use a parameter measure node because it only calculates the total length of the primitive but i do still need it so i'm just going to calculate the perimeter first then next thing i like to do is to calculate the distance for each point from the first point so let's do this um i am going to use another primitive wrangle for that and calculate the distance attribute for each point so i'm going to retrieve each point number out of each primitive okay and let's have a variable called i distance incremented distance starting from zero and this incremented distance value will be incremented at each loop and going to loop through all the points get the point number okay and what i would like to do is to calculate the distance between the current point position and the previous point position so this is the current point position let's say i'm going to call this pre-t1 the previous point position i'm going to call it as zero and that is i minus one now there is a chance that this value will be negative especially when the i is equal to zero now that's problematic because we don't we cannot access a negative index for the array so in those cases i would like to reset this into zero so i'm gonna use max function so that it always be zero the maximum value is always be i mean the minimum value will always be zero even though if if it's negative if anything is negative it's been it's going to be resetted to zero so in the first iteration of this loop you have two zero position point which is this one and this one this this point and this point number is the same at the first loop first loop iteration but that's not really a problem because i what i want to do is to just calculate the distance between the the current point position and the previous point position and the first point position is the distance between the first point position and the first point position is equal to zero so that's not really a problem because you want to start the distance attribute from zero so vector position zero is equal to point zero p at p d zero position one is equal to p t one and you can calculate the distance between position zero and position one right and what i could do is to add this distance to the incremented distance and use this incremented distance as a attribute value for a current point number so set point attrib zero i'm gonna call it as t and at p t p t one i'm going to set i'm gonna create a vector value for this t since if we if you want to use the uv sample function you're going to have a uv value as vector value so even though even though if you only have one values to sample as a uv value you still need x y and z value although i think i can have another value other than distance in this case which is the primitive number yeah i i could access to the specific primitive number using prim group but if i use this option then the calculation makes it really slow so instead of using this prim group i'm gonna apply i'm gonna have the primitive number as one of the uv value okay that's uh i think that's a neat trick to remember meaning first of all i'm going to create a vector value and the first value is going to be used as the prim number and the second value is actually the distance that i have just calculated right here and the third value i don't really have anything to sample for anything else so just going to say zero so i have u as prim number and v as a distance now when we use the uv sample the uv sample i think is using some euclidean distance based sampling using this as sampling base so i think it might be a good idea to change the unit between the prim number and distance what i mean by changing the unit is to make one of the number really high in terms of the values so that'll be more how do i say no it will be less errors when we do the sampling between the geometries so those cases i'm gonna try to multiply this print number by thousand or you could do either way i mean maybe making the eye distance maybe multiply by thousand but i think this is more easier to uh deal with since this is an integer value so i'm gonna try with these i think i mean this is not really necessary to do it's just some option to make less errors when we use the uv sampling not really sure if this is working great or not i'm gonna test out myself later but a little trick here now let's see if this geometry has been or the distance has been applied correctly to each point so i have t value t 0 t 1 t 2 and t 0 is the primitive number t 1 is the distance going from 0 to the total num total length of the primitive now the the maximum t1 value is 0.78 now if i look at the primitive there is also a perimeter and now it this one says the maximum number is 0.87 so maybe something is wrong here because this value that this maximum value and the t value the maximum value of this t has to be the same i think so let's see what's wrong here okay so let's see if i look at so this is the primitive uh the point all right now getting calculating the eye distance getting all the point numbers making the loop is the first point this is this is the current point this is the point previously retrieved position zero position one just getting the distance adding the distance and then applying the attribute to each point with this itis looks correct looks correct to me somehow right let me also try to apply another attribute just this eye distance okay and i'm gonna try to just get one single polyline to test out so let me just select one of the curve get a blast it okay so let's check the perimeter the parameter is point five eight two six and if i look at this point now this seems correct right so starting from zero the distance incremented and finally goes to point eight five correct and i prom right okay um another things that i might be forgetting is as i said um the order of the point is not based on the geometry right now so maybe i again i need to do the prim vertices instead of this pts uh print points okay i think that's the reason yeah i think so so going back to where i was getting the print vertices i'm just going to copy these lines going back to this one replace it with these and see nope nope still not it doesn't really changed anything maybe maybe that wasn't the thing let me try to get this primitive 56 56 okay and this is a pre this has a parameter called a .87 and this one the t is wait a minute it does have 0.87 what's wrong previously i didn't really see this value did i did i and now it's gone hmm i am not sure why hmm i am guessing i am guessing has to be something with these uh arrays probably let me think a little bit why this happens let me know if anybody has some idea why this happens so okay so if it was if i have single geometries retrieved then this seems to work just fine although the the order is different but that's not a big problem because it's all based on the vertex order so should be fine starting from zero then the one that this is just two so this one goes next this one goes next and so on so should be fine all right okay i see why i see why that is because some of the point has been fused so that's the reason okay so i think for each primitive the point should be unique uh okay so that was reason okay so let me make those points unique for all those primitive what's the easiest way to do that facet no this will make everything unique i think [Music] let's see let's see if i can use this unique points this will just make every points unique it's not really what i want did die wait a minute maybe that's fine yeah maybe this will just do the job yeah let's see so like this like remove this and check the point number again all right so the maximum is equal to the maximum of the parameter on the prim primitive tab okay that's fine this looks fine now now who was i um i think it's also a good idea to [Music] re-sample these curve a little bit so that you have additional like sampling points to make a bit more high-res sampling so i could use maybe after calculating the measure i can use the resample node with the resample by polygon edge option on and make this links like point zero five or smaller to have a bunch of points to sample maybe like these yeah i think this is enough a bit more all right so make enough points for the uv sample to work in high-res now now it's time to actually use those values applied in each point with a uv sample to determine the point position now let's test this out i am going to use the solver in order to animate the point but beforehand i'm going to test out using more procedural way using a frame value i'm going to use the point wrangle to [Music] okay and i'm also going to i'm also going to create a initial points in order to move so i can just use a scatter node to scatter on top of the current point maybe define how many points that i want to move maybe 20 points for now let's see what kind of attributes that i have on each point so for each point the t value has been sampled that's good this is useful for the primitive nothing so well if i have this t value that's fine i think and we're going to use this t value to determine the next point position when we move the point on top of this primitive so we have two informations from this t one is the primitive number which primitive is this point is running on top of and the distance from the first point which is t1 all right so let's have that as the first input of this pointer angle and have this curve as a guide as a second input and let's try to move this point with the constant speed by adding the t1 value so just gonna create some random or some constant speed value with the parameter let's say 0.01 in this case i would like to move the point by the 0.01 distance for each frame that's what what it means by this speed now in order to change the point position first thing i would like to do is to change the y value of t the current t value that point has by adding by speed multiply by frame value okay and based on this updated pt value i would like to get the point position using this geometry as a guide and this is where you can use the uv sample okay where did the code go so consider that consider this t value v at t is the uv value for the ub sample so in order to get the new point position you can use the updated t value as the uv to sample from the second input sample first input the second input what i want to get is the point position and what i want to use as a uv is the t and i'm going to use this current t value at inside a point attribute as an actual uv now update the current point position with the sample point position and see how the point will move okay something happened let's try to see where the point is moving if it's moving okay or not by showing with the circle or sphere okay the sphere is a bit too big a bit too small okay let's see let's see how it goes okay so i can see that the point is moving on top of a single primitive with this t updated and with the constant speed so testing in terms of testing this is great so only thing that i need to do now is to move to those points on the solver and once it reaches to the corner or the branches branch point you want to change the direction from one primitive to the another primitive meaning changing the t values the for the x component of the t value from one primitive number to the another primitive number maybe randomly so in this case once let's say let's look at this sphere right now and once it reaches to the branch point which is right here this one this point want to go either this way or go back to the original direction okay and that's when you need to ch choose which primitive to go for for the next frame and then also choose whether the t values should be decreased or increased going from one to zero or zero to one okay so that's the things you need to consider when you do the animations inside a solver and once you are good with that you should be able to create an animation running on top of this network and the same idea can be used for any similar situations so let's do this i'm going to just delete those and create the solver test okay so this is the initial points this is the guide and one additional information that i might need is to choose whether the point is going to the positive direction or to the negative direction meaning if the t value is going to be increased with the constant speed or decrease with the constant speed while going forward or backward so let's have another attribute to determine whether it's going forward or backward maybe as initial value could be random so i'm going to just create some random value either positive one or negative one so in this case i can just create random conditions brand based on the point position maybe as well as some seed value and this is in between zero to five zero to one so if it's less than point five then you get minus one else you get positive one okay written as one line condition let's also apply some id retrieve from the point number maybe later on i would like to make it as a trail so having an idea is a good idea to make a continuous trail line okay so let's check let's look at the point attribute and there is there you go you have move direction integer attribute which is either minus one or one so if it's minus one then you're going backward it's positive one going forward okay that's what i would like to use it for all right so i think that's the things as i that's the information that i need you know to go forward inside the solver and this will be the last long code that i need to write here for today so for each point i'm going to access to the point wrangle and also refer to these network as a guide and connect it as a second geometry and run okay now uh first first of all i do need to retrieve the current conditions of the point and see whether it's going forward or backward okay so and also determine the speed as well okay so let's calculate the speed i mean let's have the speed parameter speed let's make it as 0.01 all right and also we do need to know whether the point has been reached reached to the end or to the the first point position meaning if distance becomes zero or if the distance becomes the same as the perimeter of the primitive so let's get the perimeter informations out of the primitive now we do need to retrieve the primitive number in order to use this we currently don't have this primitive number but we can estimate what is the primitive number for this current point by accessing to the t value now um if we access to the t value the x component is actually the primitive number now we have multiplied by thousand previously so let's divide it by thousand as well to make it as a real primitive number and make it as integer okay now be able to get the corresponding primitive parameter and this will be the the end value for the t y okay now let's update the t value by let's call this nt and let's update the t value by adding the current t value by zero speed and multiply by the moving direction whether it it's going to be minus one or positive one so if it's tau if it's if this is positive one then this the con the point is going to be moving forward and we're gonna check if it reaches to the value parameter at some point if this is negative that then we gotta check if the goal if the point goes uh close to zero or negative okay so if i at move direction is positive then we would like to clamp the y value off the current t value the updated t value to the parameter and then else else if i move direction is negative then nt y becomes zero okay now um i guess we do need other conditions right here when d and t y goes more than the parameter and in this case nty goes less than zero all right now in those cases um we do want to switch the primitive number to something else okay if we look at this primitive now let's see let's say if the point is being traveling this way and have reached it to the end right here where the branch point and where the branch point is here now when the point reaches to here then you the point has to ch choose whether you go go back to the same primitive going this way or using other primitive this way or this way so based on this point position you gotta pick up a specific primitive number maybe a random primitive number in this case three out of three right so and this is the condition where the point has reached reach to the branch point so let's create the flag called next prim and if if it if it reaches to the end then the next prim flag will be equal to one and only then you can switch the primitive to something else and choose whether you go negative or positive direction okay okay now we do need to update the point position even though we don't really um switch or not just like we did about the testing so first of all update the current t value with the new point new d value updated t value and then get the point position using the uv sample just like i did previously use what we what i want to get is the p the position value and what i want to use as a uv is the t value and using updated t value with the speed as the uv now i can get the point position i can now update the current point position to this okay now now it's time to switch if this next primitive is equal to one so if next prem is equal to 1 then it's time to switch the primitive to go for the other branch okay so first thing first we got a get all the quote um we gotta get all the possible primitive numbers for each point that reaches to the end so if the point comes here then we gotta get the primitive number for this one this one and this one and to do that i what i could do as one of the option is to first of all searches search for the uh current point numbers at here at specific point positions and then from those point numbers i can retrieve the primitive numbers from which belongs to those points okay so that's how i can i think that's how i can change the value or i can directly get the t value out of this out of each point so what i just need to do is to randomly pick a point retrieve at this position there's three options possible so to do that i am going to use a near points function with really small distance to check since i made sure that the point goes the point stops at this branch when it reaches to this point with these options right here okay now um now i should be able to get the number of points at least one which is which is including yourself okay so if it's just one then just choose yourself again and go back to the original direction which i'm talking about this point so when the point goes from here and reaches to the end there's only one direction one primitive one points at this point so you you can just choose that one and then pick the primitive number out of those points and then you just need to go the other direction in this case so let's pick up a random point number out of this array just like i did for the other stuff i'm going to use the random function based on the point number or point position either way is fine maybe point position multiply by some constant value plus maybe based on the frame as well since we are acting in a animation and do we have a loop nope so i guess that's all i need in terms of the seed so maybe as additional custom seed value that you can change by yourself all right and then multiply this random value which is in between 0 to 1 with the number of points then finally make it as a floor value to make it as an integer so that you can use it as an indice or index for this and bts to pick up the random numbers okay now that i have got this random point number it's time to retrieve the t value which belongs to this npt which and t value has contains two information one is a primitive number and one is either if it's a zero or a parameter value since that that's at the end so vector t the next t is equal to point second input t at npt all right now and what i would like to do at this point is to switch the current t value to the found next t so that we can change the primitive number at the same time we can also change the the the distance value distance attribute value okay and finally we also need to determine whether it should go forward or backward meaning we we need to define whether the move direction goes move direction is equal to one or negative one so in order to determine which ones goes which we need to check the y component of this current uh this next t value let's say if this is the point that we are looking at now if the y component of this point is equal to zero then we want to go this way in this case we want to move positive way meaning we want to constantly add the value to the y starting from zero now if the point this y component of this point has some value equal to perimeter this means is that this point is the end point so we need to subtract the speed from those t value in order to go from this point to the other direction so we need to check whether the y value is equal to 0 or not so let's check check this check whether it's really close to zero um then if it's close to zero then we can move it to the positive direction else move it to the negative direction like that okay and i think that's pretty much it that i need to do i think let's change the seed value and see what happens so we have speed equal to 0.01 and let's see if it's going to work okay somehow the point position has been moved a lot not sure why okay something's something is territory terribly wrong all right okay what's wrong is this it's moving really fast let's see let's see okay so i had this perimeter i have this moving distance [Music] speed comes from here so this is the next okay let's first comment these out so that it will it should stop at the branching point okay okay not moving not really moving is it and let's see okay so let me check so if it has moving direction it has t value and so on that's that should be fine i have 20 points i also have 20 points right here am i getting the reference yep i do getting from the right yep okay and so i'm getting the let me first check if the parameter is retrieved correctly so yeah the parameter has been retrieved correctly now let me also check this t value oh wait a minute the conditions that i i thought i wrote is gone somehow so this has to be and ty if the ntys goes more than parameter then reset it if it's nty goes less than zero then reset it okay so i was miss somehow the code was deleted i don't know why okay so this should be fine okay let's check okay so it's moving one direction that's good now let's look at where i have commented out in order to switch from one branch to another branch okay now seems like it's moving so let's also check the check with making a circle move a sphere moving on top of the line so that we can clearly see what's happening here and copy this point copy the sphere to these moving points and merge it with the line let's see and there you go i think it's moving random let's increase the frame yeah i think it's moving just fine just picking up the random branch when it reaches to the branch point moving randomly on top of this network yeah this is what i wanted to do if you don't want to use the randomness then you can instead choose which primitive to go for by setting some conditions right here inside a solver but for this testing for this experiment i'm just gonna deal with the randomness all right now i can make this a bit more faster if i change the speed value maybe to 0.03 i'll be more faster right i can also make some trail for each point to make it look like a train running like that all right interesting okay now let me so this is what i really wanted to show you for today in terms of the logic and the things that i am going to do next is to just trying to make these lines and points visualized at just a little bit prettier but just a little bit so that you can render it now since i have made it as a metro network maybe it might be a good idea to set some object like um station or building something like that and let's try to do that as well as a option okay first of all i'm going to try to create some voxelized building shape surrounding these network maybe randomly again and based on these uh based on this original shape i could probably create some i don't know box shape or something where the close to the station so let's see let's get the branching point see where i can use uh where where can i get the branching point before doing the resample maybe some around the facet maybe before fast yeah somewhere around facet and what i just need to do is to get the first and last point for from each polyline now how do i do that i think there there is a note to do that i forgot what was it forgot what so just to make it simple just gonna use the primitive wrangle just to get the first and last points that might be too much isn't it wow i cannot think of anything else so i'm just gonna do like this so first get the list off points then remove the first and last points seems like the order of this print points and frame vertices were same somehow so i'm just going to use this print points after all so loop through all the points and if i is not equal to zero nor i is not equal to the last point then remove the point oops i guess this has to be and all right and did it work i guess now i don't really need a primitive anymore so remove prime frame num zero okay and i am left out with only the branching point now i can also use the fuse to remove the duplicated one all right now let's some box to this point position maybe with the random size but let's just go with this small constant size for now and let's consider this as a i don't know station box or something uh little bit bigger [Music] maybe randomize the scale after all i'm gonna change the p um three scale with some randomness okay maybe that's too much too much boxes i don't know okay maybe damn there's too much boxes let's say i round somewhere around here now what uh i'm going to convert it into a voxel so that i can create um like a modular unit for each points to do that i'm going to convert this into a nice offset first as a volume then just say just like i used previously i'm going to use i'm going to get the points out of this volume using points from volume with some specific separation value maybe make this dense grid okay a bit sparse well we can control this later let's move this aside and then create a box with size equal to this point separation copy this box to these points just like that now what i want to do is to remove those boxes where it intersect with these network okay we don't want to have those building like penetrating these network so i mean network penetrating these boxes so in order to do that i am going to remove those points which is too close to the network line by calculating the distance to this lines i'm going to create a threshold parameter and calculate the distance using xyz test for a second primitive second input from the current point position and if the distance is smaller than the threshold then that's the point you want to remove like that right so you can have a space for the network line now you can use this to create the boxes and let's try to combine these two see if you can have both the building and the network assigned to each other and it's a bit hard to see what's going on here so let's first of all color these boxes maybe based on the y direction gradation and then also make some alpha channel applied to make it a bit more translucent so i can do that to these points maybe i can have another point wrangle to control the color and the alpha channel so in order to control the point color based on the y values first of all i can get the the boundary box bounding box information using get b box then create the color based color attribute based on the fit function based on the y value of the point position from when y to max y going from going to zero to one i'm also going to check change the alpha channel maybe using some parameter okay now currently the color attribute is not being used so let's use this with color node for ram from attribute looking at the color attribute then going from a black to blue maybe some darker blue and i think it's not really changing that is because i am missing the color attribute all right so i have now the gradation point color as well as some alpha channel applied now the box looks like these i think it's a bit more easier to see together with these line network right now the line network itself could be drawn with a bit more thickness if it's just a line it's a bit hard to see i guess and let's also combine with a sphere that it's moving maybe i can color these as well maybe base just to use the constant red color value combine with these right so the network is the block itself the building itself is not really blocking the network it's being trimmed out and okay maybe i can also try to make this network a little bit of thickness so for this one i can either use something like poly wire or wire frame maybe wireframe will create a bit more cleaner result and maybe before doing the resample i make this smaller like these now i cannot really see through these so maybe i can also set some alpha channel to this one as well um right and let's see everything has been merged now looks a bit too noisy i can then make this shaded view maybe a lesson a little bit of okay well really after this i mean it really depends on your knees i'm not really good at making things prettier as you can see but um the things that i wanted to show you is these logics so hopefully you find something new here now i am going to organize all those parameters that i have set into one place and i'm going to finish this things that i created uh let me know if you have any some questions so far if i can answer i would like to answer it okay so let me try to have all those parameters set right here okay so what kind of parameters that i created so these one first of all so the radius searching radius search radius for the line network to be created number of lines or let's say branch number and seed okay this seed can be used in many other places i guess apply okay so taxicab so here you go i am going to copy this i'm just going to reuse the same seed value for everything it's not really necessary but just for ease okay so this is the ratio for what was it the diagonal curve so okay what else we sample [Music] maybe this can be parameterized but i'm just going to skip it this one doesn't have any parameters nope moved in direction this one also doesn't have any if you go to the solver we have speed this is obviously the one we need to have speed and the seed we can just call bring up the one that i have copied all right that's it fold this over and maybe the radius of this sphere so all right what else ah what else this wire can be related to the sphere radius as well so i can just copy this one to this wire maybe just add a little bit of offset just a little bit that was too much okay and what else boxes yeah these one can also be parametrized i guess so the box size or maybe station size what's this one this is the randomness scale can come here as well i can copy the seed again paste the seed right here and what else these um voxel resolutions can be parameterized as well i think actually we have another voxel resolutions which is this one this can also be parametrized somewhere around here grid snap distance and the second one is second one is for the building box also all right getting close to having all those parameters and alpha channel hmm i'll just gonna leave this okay that's about it and this should do this should have all the informations now it's a bit hard to see here kind of maybe i come after i'm just gonna ah okay maybe i don't really like the wire frames because it has these through spheres for showing up like this instead i'm going to convert this into vdv come back back to a polygon maybe a little bit of adaptivity now looks a bit better all right and maybe raise up some alpha channel okay like this okay now since i have parameterized everything that i could let's try to change those parameters see what happens if i change the number of stops or in this case i guess i should name this station should i now more number of stations you have or more lines you get and it's a bit hard to see i'm just gonna show up the lines instead it should be easier to see for testing like that yeah this is better okay and still moving all right and we could change all those additional parameters like speed making it slower changing the seed to change all those shapes and what else sphere radius it's not really important search radius so if we have small search radius it's a bit hard to create network if you have higher search radius you have tons of tons of options to search for and you can also increase the branch number to have more branches for each point but maybe reducing to three or four is just fine and if you want to have if you don't want any diagonal curve then you can set this diagonal ratio to 0 which still it should still work i'm gonna have to reset the simulations and still works moving on top of this straight polyline curve which might be still interesting but i would rather have a diagonal curve so i'm going to raise up this diagonal ratio speed up a little bit and i guess that's pretty much it and if you change this grab grid snap ratio if you have to have more cleaner network if you have smaller value you have more organic shape network which which looks still fine you have this kind of island somehow maybe you want to change the seed in this case yeah looks nice another one maybe i can increase the search radius a little bit okay that's fine looks good now everything is based from the pig head now not much doesn't really look like a big head right now but if you increase the number of i don't know number of stations as well as the decreasing the grid snap distance you start to see those big head more and more maybe you have a thousand just like that and this should still work ah i forgot to um parameterize another wait a minute that this is not moving that well i guess the the reason why this is not moving well is because of the re-sampling is not enough right here i guess instead of making this maximum segment length i can instead use this max segment number and reset the simulations nope not really i'm pretty sure this is where it is creating the errors if i increase the okay now a little bit and maybe the speed is too fast i'm not sure what to go for well it's a bit hard to debug with this let me decrease the number a little bit see if it's still going to work or not huh okay starting to have some weird stuff okay i'm going back to the resample node okay i think it's because of this trail thing if i change this to my just disable this trail now the point is moving really fast and i guess that is because i'm making the speed too fast i should set the maximum speed to point one and then reduce the speed to something like this okay so that was the reason so it wasn't because of the trail after roll that was just a speed problem okay so let me make this back to thousand lines or styles on the station okay still works great but it's a bit hard to see what's going on here more of a sci-fi like movement like a sci-fi elevator or something it's better so i mean things can be i mean i title it as a metro network but could be i guess i could be used for something other than like a train network if you could think maybe you could think of yourself using the same a similar system okay well that's pretty much it uh one last thing maybe i should also be able to control the number of particles to run so this is the final parameter okay so let me know if you have any questions if not i am going to end this at this point okay and i'm not sure if anybody is still watching this one hopefully okay this is it okay so thank you very much for watching takes took a lot of time to finish this but i myself enjoyed it creating it the algorithm itself is pretty simple but the result that i get in terms of this network shape is i really like it myself yeah more of a metro like metrolight network or maybe sci-fi like curve curves okay so thank you thank you very much i am as always i'm going to uh upload this uh file that i've created right here the same file that i'm showing right now to the github and so that anybody can be able to download this later after this live finishes from the video description page or from the patreon okay and also doing the patreon page so if anybody is kind enough to support me that would also be great i'll be appreciated okay so that's it thank you very much for watching and hopefully i'll see you next week uh recently i'm changing the date to do the live stream from wednesday to saturday because it's a bit more convenient for me to do the stream okay so that's it thank you and good night
Info
Channel: Junichiro Horikawa
Views: 22,909
Rating: undefined out of 5
Keywords: houdini, sidefx, live, tutorial, procedural, procedural modeling, parametric modeling, parametric design, parametric, fabrication, digital design, computational design, 3d, design, isosurface, lattice, structure, 3d modeling, modeling, computational, generative, line drawing, drawing, illustration, fractal, reaction diffusion, celullar automata, simulation, trail, particle, vfx, mitosis, magnetic field, field, volume, rendering, computer graphics, visualization, algorithm, motion graphics, graphics, remesh, quad
Id: 7L38uTLuJYw
Channel Id: undefined
Length: 175min 58sec (10558 seconds)
Published: Sat Oct 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.