Houdini Algorithmic Live #032 - Shortest Path Growth

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello hello uh i'm not sure if the sound is on okay so hello everybody hope you can hear my voice this is the 30 second uh houdini tutorial live that i'm doing weekly and the topic today is to create this kind of line flow network line growth using a short short test path method and i think it's going to be really easy this time for this week since there's not going to be much coding needed for today's work that i'm going to do so yeah it's going to be pretty easy and by using this you can create this kind of smooth animations by changing also changing the geometry as well could also work for any kind of geometries like big head or taurus or anything and you can also kind of change the way how this line flow animate or growth on top of the geometry by changing the weight function or cost function on top of each point so that you can kind of control how these flow works okay and well but that is pretty easy i mean that is pretty simple to do so let me show you how and hopefully i can finish this less than an hour for today right let's do this low okay so i am going to create from create a geometry node from scratch hello everybody and let's start by creating a null node so that i will contain i will store all the parameters that i want to control the use to control now let's give several kind of geometries like sphere taurus and big head so that we can change the geometry later on now let's also define the size and let's for the spheres i'm going to change this to a polygon and since i am going to use a shortest path node it works on the edges of the mesh so more edges you have more density you could get so i'm gonna make the frequency for the sphere a bit bigger like 15 and for the taurus i'm gonna make the resolutions to something like this maybe 50 to 100 that might be too much not sure or maybe i can do a remesh to create a triangular network like these with the target size of 0.1 might be good okay and for the pig head maybe i can also do the remesh or maybe i can just use this as it is but let's try with the remesh all right so let's try with these geometries i am going to use a switch node so that i can switch those geometry with some parameters so for these for this select input parameters i want to make a parameter from 0 to 2 so let's create that first into a node controller i'm going to create an integer let's say i'm going to name this shape the ranging from 0 to 2. let's copy this then paste it right here okay now i can change the shapes now next things that i want to do is to create well let's first set a node normal node to calculate the normal for the points just in case and what i want to do next is to define the starting point for the flow just uh to start the growth so it could be anywhere but i am what i'm going to do is to create a add node which then i can control and add one point by checking it then i'm going to use the arrow to define the position by myself manually but as you can see the point is currently not on the geometry so i want to make this point attached or cohere to this base geometry so i will use the array node to do that so this is the point that i'm going to project this is the base geometry and i am just going to use the minimum distance right or maybe i can just use um point wrangle instead of using this ray using a new point maybe that's that might be better okay so let me do that way um i am going to create a attribute node attribute wrangle and say set the name of this wrangle to set start okay and i'm going since there's only one point that i want to move i am going to set it as detail and i'm going to connect this starting point the guide for the starting point in the next second input like this okay now first of all i'm going to retrieve the point position from the second input which is which currently you only have one point so i can get it from second input p at index zero right now now i can calculate the near point number from a base geometry which vertices on the geometry is close to this point that i have added manually by using new point with this position that i have retrieved from the second input then let's store this number into a detail triangle maybe to specify which point is chosen maybe i will set the color for this point to something obvious so maybe something like red so i'm going to say set point at riff cd npt set one zero zero okay now where is that okay so here it is so this point will be the starting point for the shortest path growth will happen right now let's let me just connect this to a a little node first let's just name this geo okay and then i am going to use this find shortest path okay now the this should find shortest past is itself is a really strong node it can do what what it can do is to find out the the shortest path between the selected starting point and selected endpoint and using this edges on the mesh all right and what i'm going to do is to create the shortest path for every vertices exist in this mesh from the starting point so that the geometry will will be covered by all those shortest paths okay so that's what i'm going to do so to do that first thing that i have to do is to change the option for this output pass currently it says from each start to any end but i am going to say from any start to each end which will be able to create a multiple curves from a single point to every endpoint and right here i need to define which point will be the starting point and which point will be the end point so for the starting point which is this one you can access to this point number by going to the detail rank detail attribute which i have stored an attribute for the starting point which is called npt so this npt value is the actual number of this point i think if i show up the numbers yeah i think it is so i can use this number for the starting point for the shortest path and for the end points i am going to define all the exist point number in for this geometry okay so for the first one i can access to the detail angle so detail attributes so what i'm going to do is to first use the back um bracket back how do i say back back um quotation back quotation and then inside i'm going to write a expression to access to the detail and i'm going to access to this null geometry null node detail attribute so i'm going to name use geo then access to the attribute name mpt and for the first value so it's going to be zero so as a result i should be this should convert the value into this number point number now for the endpoint i'm just going to type this star mark right here which will create a all the shortest paths from the starting point to every each end point every each vertices which will create this kind of a blocky path path still looks interesting but the base things that i i'm going to deal with right and you can kind of change the path based on how you define the edges so if you do the remesh for this one you can also kind of see some different results let me try that and as a result you'll see a bit more jagged line without it you see a bit more cleaner line let's see for the other shapes for the torus it looks like these with the remesh without the remesh it looks like these more straight based lines but for this one i think i like the remesh version well let's also see the pig head now for the pig head it looks like um a tree vine now if i re if i disable the remesh it looks more like a drone-like path right okay so but i guess i need i want i like the remesh version better so i'm gonna go like this now the next thing i'm gonna do it's pretty simple i'm just going to smooth this curve out using smooth note and i would like to control the smoothness for this curve so let me have some parameters for that one i'm going to open up the edit parameter interface again uncheck for a bit linking then go to the smoothness and drag and drop the one that i want to promote and i'm going to change this to smooth let's say the maximum b hundred okay and let me also change the shape back to the sphere and let's try to see the changes by raising up the smooth so starting from zero so let's create something really beautiful like this okay so now it this itself is already i mean almost close to the complete thing uh completed things that i am seeking for what i'm going to do next is to just to make sure that these curves are on top of the base geometry i'm going to use the ray node again for these curves to the geometry with a shortest distance a minimum distance option now those curves are all going to be on top of the geometry just to make sure that the curves are not offset inside or outside the geometry but that might not be necessary as well okay so and i'm going to connect no node let's name this well maybe anything geo2 is fine okay and final thing that i want to do is to create some animations so that it looks like it's growing from the starting point to the end point of this for each curve and the easiest way that i could think of is to use a carve node and for this one i'm going to try to see which one does which so i have enabled both umv and okay i'm seeing a bit weird result okay now it looks good so if i change if i enable first u and second u and if i change the first u to zero and if i move the slider for the second view from zero to one it will create a growth like uh line flow like i want it so let's try to change this procedurally based on the frame value so i'm gonna set the end frame to something like 100 then change the second u to with the expression the current frame divided by the frame and value as a result you'll be able to create a value from 0 to 1 based on the frames and you can create this kind of animation pretty easily all right now as an additional things i can do to this geometry currently if i have started the if i set up the starting point for the sphere all the end point will be at one visit uh one point which will be the backside of this sphere right that's pretty obvious but um that is because it is using the distance um distance as a pass cost and so the speed of the pass will be always the same for each uh every path but by changing by changing the cost or weight at on top of the geometry that i'm working with you can kind of uh change the path itself say currently the pathway is equal to one for every point on a geometry like if you look at this currently the default value for each point each vertices on the mesh that i have provided is equal to one so as a result the actual cost that's going to be used for the shortest pass is going to be is just a distance but you can add additional weight to each of the point to make it to make some of the paths go slowly than other uh areas so say this area has some mud areas which will prevent the pass to go at the same speed it goes slower so the past tried to find out the path will try to duck or try to prevent going through this mud space to reach to the end of the point in a more quick way and a lot in a shortest distance in a shortest um time or shortest cost so by changing some of the weight values on top of the geometry you can kind of change the flow the type of flow or shape of the flow curves so let's also try to do that and let's try to see what kind of results we get by doing it and what i'm going to do is to use a noise function to apply some weight value in each vertices for this mesh so i'm going to use point wrangle and let's name this weight and it can be just a simple functions i am going i'm first going to calculate the noise value and i'm gonna name this white using noise with the at p as a parameter and let's also have some additional parameter in order to control the scale of the noise parameter right and it might be better if i change the ratio at the range of this scale from 0 to 10 okay and let's also visualize how it looks like by changing this scale value at each point so i'm just i'm going to update the color of this mesh of each point by uh using this noise value okay so to do that i am going to just multiply c d by weight which will give you this kind of um black and white noise image now let's also look at the range of the noise value and i think i forgot to put it as a attribute so i'm going to put this value the weight value as an attribute called weight like this and let me also save this somewhere and check the value okay so this value is in between point eight three two point two so i think i could also clamp this value a little bit like it never reaches to zero it never reaches to one so to make the to make sure that you have at least at some point you have zero at least some point you have one i am going to clamp this value a little bit so to do that i am going to use clamp for the weight and let's say the minimum 0.3 and maximum 0.7 and after that i am going to use the fit function for the weight so that the range will become from 0 to 1 again now the contrast will be more obvious right now let's see how i look uh how let's try to use this weight value as a cost to for the fine pass find shortest pass so more cost you have the more weight you have uh you'll the the speed of the shortest path will be slower i mean the distance will be longer so the shortest path will try to prevent going through that edge or try to go through that points if the short the weight is small smaller then then the shortest path will try to go through that point meaning that the cot if the cost is less than the distance is short okay so keep that in mind and i am going to use that weight attribute by going into the path cost tab for the find shortest path then i'm going to enable this point cost attribute and use weight okay now let's look at the result now currently the weight value is zero because i have scale zero but if i and they increase this value you see that somehow the shortest pass flow changes based on the noise value on top of the point and make something a bit more organic right and the animation still works oops not for this one but this one like this yeah and if i make this scale really big it becomes more random-ish network create like a river-like network all right so that's kind of pretty much it 30 minutes it's pretty fast so that's the things that i wanted to show you today not much things to say for this one because that's pretty easy to create let me just promote the parameter for the noise scale and that is pretty much it so i mean you can end watching this live at this point since i have already finished it i have already uploaded the files to the video description page on the youtube so if you're interested you can download the file from there and yeah well if you have more if you have some more time well maybe i can try to do a similar things for the carve nodes with a primitive wrangle is it difficult to make it crawl like a snake um let me see i think it's it i think it's doable it's just a matter of how to control the weight on top of the geometry that you are using so for the crowling maybe you can use like a sine wave functions to apply a sine like uh wavy and weight functions on top of the sphere to create a snake rolling like pattern maybe i can try that i mean it's just a matter of changing the weight so let's try this try that out so what we can do um what will be the best way to do that let me see well let's say that you already have the starting point somewhere which in this case where was it this one okay so from this point let's try to make like a wavy um weight value okay so to do that what will be the best way all right maybe i can calculate the angle from this point to all each of those vertices sine with surface distance that could probably work yeah let me let me check what let's try with that let's try with that so okay so let me and comment comment serve this distance and the parameter that i'm going to use is i don't need a pt group let me go to the vex function page what kind to see what kind of parameters that i can use okay well geometry pd group attribute search pt okay let me keep a space right here let me just first calculate the distance for each point from the starting point so first thing first thing i'm going to retrieve the starting point number from the detail okay and let's also get the starting position at the point then let's calculate the distance from that point zero pt group well i'll just say empty to apply for everything or just say use this one okay and then p our pt num is ordered from the origin point maybe it's easier than surface distance well if you do remesh i think it's not going to be older so probably it's better using surface distance instead and closest pt is the output okay so which i might not need it but i have to provide it so into cpt okay let's see and use the distance well i'm not sure what the metric is right now so let's just try it directly with the sign and maybe multiply by pi okay and that will be value from negative one to one so okay let's create an absolute value of that sine value and then apply to the weight and let's look at the color well hello okay now i have a problem that is because i didn't created the roll for this one i think i'm missing something okay so first one is serial second was string third one is also string okay i was missing uh i think i was missing one more parameter which is this one spt i think search point search point returns distance from the search point to the closest point in the wait uh wait maybe not yeah i think i i'm doing right wrong i am doing it wrong what i have to do is to say well spt is correct for this one but i have to change this to a current number so maybe i should use a current number for this one but um i don't think i can use pt num so i'm going to name it as id and i'm going to create a another attribute beforehand using point wrangle okay and then what else do i need what it's saying no matching functions for float surface distance integer string string integer integer is it oh yeah i was missing this one which is the method to use measure distance except values are edge and surface edge distance is measured along the edge to model the model surface distance across the single polygon well let's try to choose surface then okay and how's this now it looks all black let's look at the weight value now it is all equal to zero close to zero so something it must be wrong maybe the things that i wrote right here might be wrong okay let me change this to something different like random numbers to see if the if you can change the value okay it is changing so kind of obvious that it is not this one is not retrieving the id value right here that i have created for each point just this one or maybe i can just say i2 a pt num yeah that might work okay now i am having some calculation time well it's not like it doesn't look like what i intended to have um what if i don't have an absolute well i guess it's the same yeah i guess it's not really what i wanted ah let me look at the comment so i have to make a web like growth effect at work i found i thought find sure this path was the way to go any tip to make a web-like growth effect at work um well if you're talking about the spiderweb like network i have tried creating it using a uh pop grains before and i have uploaded the files for that as well so you can search for that i think if you search for spiderweb with houdini i think you'll be able to find that thank you cara spike for your comment okay well let me see what i can do with this one maybe i will try to use the other method by calculating the angle from from this point to each vertices yeah let me try that way okay so to do that i'm just gonna leave this as it is and create a new weight path okay i have a question how much time does it take to learn vex um i well i spent at least a year to learn how to write vex code at least for my needs it took me a while because uh the syntax is a bit special because it's based i think it's based on the shader based coding it was pretty new to me so if you already have some ideas about shader programming i think it you can do it in less time if you don't maybe it takes more time it takes exactly one month on week two so daniel is really fluent at vex and he made it in one month and two weeks so if you some people are really good enough to know that know how to write it in really short time but i took i think i took me a while to learn vex okay uh what was i what what what what what what was i trying to do first i'm trying to get the detail value from as a starting point then the next thing i would like to do is to get the normal direction stored in that point so get the normal fspt right then next i would like to calculate the angle for each point so to do that i am going to retrieve the vector direction between the current point minus the point at the starting point so this plus is equal to point zero p s p t okay so it's pause and let's normalize this all right then now i have two vectors one is this one and one is this one let's get a calculate the cross vector so cross product using cross function between normal and direction so you be able to get the perpendicular directional values to the normal and the direction now what you can do with it next thing i would like to do is to [Music] probably use a maybe it's a bit of too much of coatings but i can use this dehydral dihedral functions to remap or rotate this cross vector to lay out on the x the d plane so let me do that how do i do this so i need to create a rotational matrix using this one so is the head dihedral so i want to map the normal to set one zero one use that rotation matrix to rotate the cross vector like this now i can calculate the angle from this cross vector by re retrieving the calculating the 8 and 2 or cross vector z and cross vector x the angle should be in between minus pi to pi which means my minus 100 180 degrees to 180 degrees and now i can use that value to create a sign wave i guess or well let's try to do that so float sine wave sine value sine angle and maybe i can multiply it with some multiplication of two to control the number of waves and now that i have a value in between minus one to one what i can do now is to get the absolute value okay and then store that multiply color with this as voltage show up okay doesn't work doesn't really give me value that i want let's see i'll let me also promote that to the weight okay everything is zero okay let me see why is that that is because this value is zero all right now i see some watermelon and what i want to do next is to based on the probably based on the distance from the point to each point maybe i can shift those to left or right right so let's have that as well just the surface distance seems to be really expensive so i'm just going to just calculate the linear distance between the point uh okay so distance between the current point and the s pass and let's see use this as a shifting value so i'm go i got i gotta have to change this to an angle how do i do that float well let me just bring it this up to somewhere around here then let's add this distance by some pi and see how it works okay now let's also have some multiplication value um shift did i closed it off okay and let's also increase the range oops let's also increase the range of this shift from 0 to 10 to see the result okay i now i see something interesting but maybe there's too much wave now that's too spiral well that could be interesting so let me try with this to see what kind of pattern we will get and well it's not a snake snake-like crowd but it's more like a spiral-like network but still looks interesting all right now probably i can to create the snake likes stuff i think i can use the sign for this distance value and use that as an angle shift right here so let's try with this one and see the result and let me try to see what will be the better range for this one multiply by pi oh okay that might be too much and it's okay well it start to give me something what i would like all right now i might need a bit more multiplication to this one all right all right looking good looking good looks start to look good okay interesting interesting now let's see how it looks like well not too obvious maybe i can make it a bit more obvious by making this value more shifted and maybe i can also control the the range of the value in between 0 to 1 for the weight value right here so to do that it might be a good idea to use the ramp node ramp parameter so i am going to update this weight using ch ramp named let's ramp with the weight value weight and let's see make this b spline make this b spline it doesn't seem to change am i doing it correct okay i think i need to multiply this one to right here okay this seems to make a bit more obvious patterns let's see well looks okay well still it's a bit interesting maybe increasing the resolution and reduce the number of curves probably you could try that um to increase the resolution we can raise up this one and currently i'm using all the points right now uh when because of this one because of this one but i can pick up the point randomly where to connect by let's say create another point wrangle name let's name this pick and and set the group for the point that i want to use for the endpoint so if random some threshold then set point group and okay and should be at p okay so let's say if i am going to use like 30 of the endpoint as an end point now to do that i can go to the shortest point and use and instead of this one now the result will be let's just look at the result by going to the end frame yeah try let's try to control the threshold right here to 1 10 right interesting so you can control a bunch of stuffs by by controlling the weight value or changing the starting point and point and so on maybe the change in the weight is really interesting i mean because there's a lot of ways to do that not not limited to what i have shown but probably many ways but just to make the curves organic in a pretty way maybe using a noise is always a good start because it's pretty if you try to make it artificial it looks artificial so maybe i might need some some noise value to this one as well to make a bit more organic if you want it okay well let's try to see this with other shapes to see how it looks like so this one for this one it's not really obvious that i am making like a curl-like shape that is because it looks like these all right so yeah that was the optional stuff uh it looks so simple looking at you typing what you're reflecting for the problem solving thank you for sharing well thank you for your comment um well i'm doing this kind of things in daily basis recently so i get used to thinking in geometrical way i guess that's why especially i'm using the houdini as a main tool currently for doing any kind of geometrical operations so yeah i really love this tool right now let me promote this threshold value as well it's a good parameter maybe i can also switch the type of weight between the noise and the sine wave based okay i i am going to upload this file after i have finished the streaming so if you have interested you can go to the same webview webpage to download the file did they mention some web server api 15.8 presentation i think they have listed the function for web server api on the presentation but i didn't really hear the detail about it but it sounds really exciting we could do that if we could access to this kind of geometrical like functions through a web api that will be really great that means we can use we can create a web app with this kind of like expensive rich functional geometrical functions now that is a lot of possibilities all right now uh what i wanted to try previously but which i couldn't do on time is to create this kind of animation without using carve since the carve just create the animation from the zero distance to the maximum distance for each primitive at the same time but i wanted to change the like the scaling timing for each primitive for each poly line to be defined by the length of each polyline so if the short if there is a short distance a short length polyline i want to make that curve to be grown fast and if there's a longer version a longer polyline that i wanted to make those polyline in with longer time but carve wouldn't let you do that because it will just you just have to define the umv and i am you i i cannot access to the primitive number inside this expressions using the curve carve so and i found out that there i found out in some i think in it was in the odd force forum where people are posting the way to create a network i mean the controlling the length of the primitive by using some vex function by importing some library something but it didn't also work for me because when i used it it just what it's just doing is to just trimming each control point of the primitive one by one so the animation doesn't really look smooth let me search for what i have what was that i think it's in the history somewhere let me see i think it's this page so there was a suggestion to use this function and the function itself works but doesn't really give me a pretty result maybe i can show you that so instead of using carve i can't use a primitive wrangle and okay using this one and let's change this distance to frame value which i can calculate it by the current frame divided by the f and and i also need to cut measure the parameter for each polyline like this and am i missing something else okay i think it works now if i look at it now i also need to delete uh fuse the unused point as well now let's see the animations it looks like now it might not look that bad wait doesn't look like what i am seeing last time looks smoother than the last time i saw it well maybe this works maybe using this might work so how can we get the shortest path through point cloud if we want to make the girls inside a volume instead of geometry how can we get the shortest path through point cloud if we want to make the close inside volume instead of geometry while the shot is fast it wouldn't work for volumes so you i i guess you cannot use this uh node because the shortest path only works for the connected networks i think using the graph theory so if you want to make the similar kind of shortest path using the volume you have to make you first have to make a network ins using the point cloud inside volume or some something and making that kind of network might be really expensive so yeah i guess uh but that i get i can i think that's the only way i can think of in order to create a shortest path for the point well first you need to create a bunch of networks connecting each point then do the do the similar calculations that's done right here in define shortest path maybe you can just use this as it is i mean if you have a sphere if you get the volume if you get this scatter point in order to calculate the shortest paths you need to have a curve network going through all the points so first thing you have to do is to create a curved network and to create a curved network out of this point i guess there are several algorithm to do that i i'm not sure what will be the best way to do that one way you could think of is to use just the point wrangle and search for the some closest points in some distance with some so let me check the parameters okay so zero p and let's say search and connect all those points together using a curve now you'll be able to get a duplicated line so we're going to remove the duplicated later on and that's the reason why this is not this might not be a really effective way to create the point you can get the near point positions and then calculate the distance and if the distance is less than i mean i don't need this i mean i didn't need the distance as well i just need to create the lines add trim poly line and pt num to npt and i didn't need the position as well and raise up the short search distance okay doesn't make anything all right am i missing something okay polyline pt and pt for loop argument oh yeah stupid sorry i was looping through zero okay now it's too big now you might gonna need to make this kind of curved network then remove the duplicated lines using convert line which will be the easiest way to do so currently i have like 10 000 primitives if i remove the duplicated lines it will become half of the lines half of the lines now i i guess i can connect this to a let's say try to replace this with the sphere right here so if i change the shape value to three and if i look at the result what could that be now i think i'm looking at the cache well it looks more like uh well it doesn't look like anything it looks like a hair but that's actually how you could i guess you could create the calculate the shortest distance for the point cloud so well that's probably it there might be a better way to deal with this kind of point cloud point cloud not sure what will be the best way um but yeah it's an interesting topic okay so this seems to work well so i think i've tried i've kind of satisfying myself experimenting all these stuff with you guys thank you for sharing your knowledge and questions okay now i think it's a good time to finish any way to make secondary growth lines from that so maybe you're mentioning maybe at some point create a another lines from some of the point i guess you could do that maybe using conditions or for loop this is when you have made completed the shortest path the first shortest path from here um let me see let me think well let's say you are picking the half of the point as an end point that means some of the point is not being used as an end point so we can use that as a second endpoint needs to reduce the line count first yeah there's too much lines right now like these maybe from here we could try a secondary line for some of the curve okay so for these well i to avoid the collision that might be too hard so i'm gonna i'm going to ignore that so i'm be minded that there's going to be a collision between curves and curves to prevent that i think you need a complex conditions but if you can accept can collisions what you can do is well at this point let me see if there's enough information for those points maybe not okay so the number of points that i get from here and the points right here is different obviously now um that will be the best way maybe the shortest path to the closest point on the perimeter primary lines shortest pass to the closest point on the primary line we'll just pass to the closest point on the primary line hmm that might be interesting yeah sounds like it's con it's going to connect uh line line i'm not sure let me try let me try so first i'm going to retrieve some of the point from the curve that has been created which is this one or just could just before doing this moves might be okay if i'm using the same point okay so let's do that by using primitive wrangle axis into some of the primitives maybe it needs another threshold with some seed value i'm just going to make it constant seed and and threshold okay and let's say 20 and i'm going to get the some point at the primitive maybe i can retrieve the center point or something and let's see how i can retrieve the position on the point the primitive instead of just getting the point number i think i can use some uv related functions let me check let's say uv sample oops no no no uv sample interpolates value and an attribute straighten uv coordinates this might work geometry attribute name evw let's see it should be an auv name no well i think i also need this i think this one works let's try so integer i mean what i want is the vector position using uv sample zero the primitive group is a two i or i mean a i2 a prim and the attribute name is p and uv attribute i mean i didn't have a uv all right well that will be the problem okay i didn't have uv value so to get that maybe i can do the resample and make the maximum length segment or just set the segment to small values like these might be that's fine and also check curve u this will be the uv value that i could use okay and for the uv value uv attribute name wait attribute name is the one that i want to get right and the uv attribute name the name of the point of vertex attribute contain uv's default uv is created into the name attributes which sample the attribute okay so first i need to retrieve the curve view value and set it as a uv value i'm just going to update you and then use uv and the one that i want to search for is 0.5 zero zero which is going to be the half of the primitives i hope hopefully and let's check that out if i'm getting the real point that i want by setting the color to red okay set point pt okay some of the point is at the end so i think it's wrong let's just retrieve one of the primitive and where did that point go the red point i think i'm not seeing it where is that okay let's check if the point has been changed 28 20 okay so no points being added i think i need to make this available 28 29 so somewhere the point has been created but i am not sure where that is city at the end okay let me just delete the primitive then oops what's this okay i don't see ah so here's the point that i was looking for and before delaying now well it doesn't look like it's in the half way distance so yes the way that i wrote is obviously wrong and maybe the curve u is not in between zero to one i'm not sure let me check well it is in between zero to one and preview so i thought i could use but seems like uv sample is using a distance instead of the actual v i'm not sure i'm not really sure what if i change this to 1.0 okay now it doesn't change the positions now that's the problem if i change to zero if i change to negative one well okay now that's a bit strange maybe i'm using the parameter in the wrong way hmm what if i change this to uv and what if i change this to p well if anyone know how to use this uv sample in the right way well i guess this is wrong will be great so what if i change this value well this also changes the value now that's well let let's not do this way if we copy the whole network and replace the first and add node with the primary lines point would it work if we copy the whole network and then replace the first and replace the first add node with the primary lines points oh i see yeah i think it works yes i think it's i think it works so in that case after we have created the line and yeah replacing this with other values or the next step in that case maybe we could use a for loop for each loop with the for each count node let's try that let's try with that well i might also need to feedback let's see how we can do it for each count for each number set it to two and the merge iteration is fine but for this one i might want to fetch the feedback okay now connect this one to or not two to two so this was the geometry so i think connecting this one is okay and then the first point that i get is this one so i can connect right here right now going down and going down and what i can use is what i can go maybe right here is fine probably and go right here okay now next thing i should do is on the second iterations i am going to get a curve instead of the point so let's change it to single pass to check and from the second iteration of the for each loop i am getting this weight maybe not wait wait right doesn't fetch feedback which piece fetch with well fetch input is not obviously a correct things but i would i wanted to have the feedback value connected to the end do i have to make this a for each feedback loop i think it's a bit wrong okay let me reopen this file to see if i'm getting some changes okay well i guess it's because i'm checking this one now now it should work i guess i cannot use a single pass for a feedback loop okay so it after i have retrieved if after i've gone to come to the second loop i can pick some of the point from the primitive well what i'm just going to do is to just use point wrangle pointer angle and just pick random points out of those primitives that will be the easiest way to do and i am only going to pick the point if the number of the point and points 0 is more than one then i'm going to in this case remove the points that i don't need so throat if there's only one point i don't i don't need to remove it that's the point if rand at p some threshold then remove point okay right now i can delete the primitive to show only the points now there's too much points right now maybe i can count the number of points that i need well for that i think i need to use detail loop through all the points so say and pt count is ghi and say i only need five points for the next iterations and then [Music] hmm or i don't need to go through all the points i just need to look through the number of point that i need create the random numbers again and this time i'm going to create an integer value as an index this time i cannot use p but instead i have to use i multiply by some seed value so let's just make this constant and multiply by n points which is going to be the total number of points and that will be the index by also maybe i need to floor this value then i can add a point as a new point at this index hmm and everything else i can just remove it so let's set some groups to prevent deleting this point group point so set point group start and then pt one okay and the other point that i don't need i can just delete it using another delete delete so i can i want to delete this point without the start wait that looks too much okay so starting from one seven okay i think i have created four five points now i am not deleting the start points obviously somehow let me check the geometry spreadsheet going to the start there's yeah there's still five points great let me delete the points first okay so all right now this works okay so i am left out with the start but for this add node i also need to set the groove start group point start okay and finally i can bring this to right here to set set it as a start and i think i also need to delete the start attributes.detail attribute and that start attribute has to be array now because i have multiple points and currently i only have i can only store one single point on the npt detail value now it's going to be a bit more complex well maybe i can do it one more for each loop to make it to make my life easier maybe i'll do that okay so to do that currently i have five points right so i can do for each point obviously the calculation time will cost a bit more but this is the easy easiest way that i could think of so connect it right here then go right here and right here now wow i am not sure if this is what we were looking for but somehow we got some values but somehow it's not changing it's not animated i think it's cached again right now in terms of making animation i i think i start i have to start those points which is in on top of the primitive after the primitive has been after the primary primitive has been made so i think i gotta deal with some vex functions right here when to start each point animation all right to do that won't be the best way but let me just make sure that what i have done right here is looks if if this is correct or not so to check that out i am going to reduce the number of points that i'm going to make first let's set it to 2 for now for this one and let's also reduce the number of lines we're controlling the threshold okay now what is happening here okay so let me just change this to a first loop okay so it looks like this starting from this point right and on the second loop right here we are seeing okay i think i need to also change the end numbers right here because i am picking the same number numbers over and over again for each iterations so to change that i need to access i need to change this seed value for the random value right here so to change that i think i need to con connect to the detail iteration value the for each iteration value from two for each loop let me create a metadata for this one what nope connect it right here so now i can access to the two iteration value from detail of the metadata one from the second input one from the third input and then i can use it for this brand so i'm going to add it multiply by some constant value added by my some constant value we'll be able to create a bit more randomized curve network and as i have told you the curves are colliding to each other so might might not look that pretty but it is what it's doing yeah i think it's what it's supposed to do okay now is the timing now is the time set the timing when to start a second curve network to grow well we can control that by setting some attribute for each primitive maybe with an id for this loop did this first loop with the number of iterations as a primitive id okay so right after i have created the geometry i can use primitive wrangle primitive wrangle and connect with this metadata to the second input let's say id and i'm going to apply the id for the primitive retrieve from the detail of the metadata for the first loop iteration and if we exit the loop we are now having the primitive for id1 and id0 so id0 is the primary polyline and the id1 is the secondary polyline and we want to grow the second polynomial right after the primary line has stopped growth and we could do that right here using the function that i copied from the odd force forum and where is that i think i lost that page wow you can just you can search for this at just prim links now let's try to do that now what we can do first we need to know how many like um ids out there what's the maximum id for the primitive so i am going to use attribute promote well well we know that there is only two ids but let's say we want to increase the id numbers by increasing the iterations right here we could also do that so just in case we want to change that we are going to make it a bit more procedural go into the primitive and set the detail and i'm going to look through the id and i'm going to look at the maximum value change the name to id max now the maximum should be one because there's only two now inside the primitive wrangle i can first access to this maximum id and also retrieve the current id and we can calculate the division and get it as a float value so float current id is equal to id divided by float of id max so the value will always going to be in between zero to one even though how even though how many numbers you specify right here okay so based on that information we can combine the with this frame values which is if the frame is equal to one it's close to zero and if it's at the end it will be one and in this case we want to finish the first primary polygon to polyline to stop growing at frame 50 and then the second one start from 50 to 100 okay so let's try to do that using this adjust prime length functions now to we could still use this but we need a conditions maybe we could use a fit for cid wait let me see let me think let me think let me think okay well we need we know that there is uh there's two values right here right and two value the value two is the actual actually id max plus 1. so what we can do chf i'm going to create it as a variable right here and replace this with variable and i'm first i'm going to divide this by a id max plus one right now and wait wait wait and also let me see let me see let me think so this for the second idea i want to start it from when it gets to 0.5 when the f gets to 0.5 right so [Music] uh then that is when the cid is equal to one right but that is actually maybe i should divide it like this plus one so i have a value between zero to point five right okay now now i can use this value to remap this f somehow let's name this nf and fit cid so and that is in between zero to one and i what i want to do is to convert it into a value in between our weight maybe not maybe not let me think let me write in this sketch okay so i have it 0 from 0.4 which goes from 0 to 5. okay all right okay now okay i think i think i got it so fit cid which is from the current let me just try with the first primary line okay so this when the cid is equal to from 0 to 0.5 and i want to convert it to 0 to 1. so in that case i what i can do is to fit cid which is from point zero to point five two point zero two point one so that's what i want to do for the first one so i'm going to make it a bit manually and try to convert it into more flexible equations later now for this second point what i'm going to do is to convert the value in between 0.5 to wait this must be f this should be f and from 0.0 to 1.0 and what i should do is to replace these sources with this cid so that i can use this as a single equations right and now i'm starting to get what i want so this should be cid right and this one should be cid plus 1.0 divided by float id max plus one does it make sense okay let me check so let's think that when the cid is equal to zero okay which means that's the primary number primary polyline so if this if if this is zero then this will be zero this will be zero plus uh one divided by two so point five so that's correct let's look at the second primitive if it's second primitive then the value is cid is equal to 0.5 so that this will be 0.5 and this will be point 0.5 plus one divided by two so that's one so that seems correct but let's also think about if the id max is equal to two so meaning there's three versions that case and f3 will be fit if the it starts from 0.66 to 0.9999 which is a kind of equal to zero and and compared to that two in that case uh let's see if still this still works so cid will be um 2 divided by 3 is that instead 1 2 1 1 0 1 2 2 divided by uh weight number of two divided by four is that it okay that seems wrong i d max no two divided by 3 that's fine so that is 0.66 so that's correct and 0.66 plus id max this will be 3 so 1 divided by 3 is 0.333 so 0.66 plus 0.33 is equal to 1. okay so it looks correct so i guess this should work now what i need to do is to place f instead of place nf instead of f now i think i also need to provide some more informations um what if the cid is too okay so we need to think if the cid is out of the range of this source is well let's just test if this works at this time okay so 50 all right looks seems like it's working so we have finished the first loop and start to go to the second loop second polyline yeah it is working now i wouldn't say it's that pretty but at least the code is working as i expected i think now if i increase the values there should be three iterations for the animations let's check um well visual wise doesn't look that pretty but um the logic explained here might be useful for some cases uh i hope okay okay let's say make animation let's and this should still work if the account is equal to 1 which was the original animations that i wanted to create alrighty yeah so it became more flexible to use multiple options and became really complex now sorry for that there might be a better way to do that but um i'm writing uh while i'm thinking so became really ugly in terms of the network well i hope you are okay with this uh oh you don't have to feel guilty about this um i'm really enjoying it making this on live i'm really enjoying it that's so i really appreciate all guys all of you guys comments really thanks for thankful for that okay so whoops now yeah some errors crashing errors i'm glad i saved it uh let me go let me check okay well since it crashed let me just end and it right here i am going to upload the file that i have created should be inside a temporal folder okay well thank you very much all of you guys for watching appreciate it and thank you all for the comment i really like those comments what uh with those questions so that i can try out many things during the live i really enjoyed it so i'll see you next week as well if you have time i'll be appreciated if you could join us again i'll try to find out some different topic and i'm gonna do the live at the same time next week on wednesday 9 p.m in japan time several different times on different regions okay so yeah see you see you all and thank you very much and hope to see you next week goodbye good night
Info
Channel: Junichiro Horikawa
Views: 5,259
Rating: 4.9813085 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, magnet, field, volume, rendering, computer graphics, visualization, algorithm, motion graphics, graphics
Id: F99HanaSMoA
Channel Id: undefined
Length: 118min 18sec (7098 seconds)
Published: Wed Oct 21 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.