[Houdini Tutorial] 0033 Frost Wrapper (Slow version)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] okay today I would like to make a 3d version of crossover and I am going to be making the solver based on the 2d solver to defrost solver which has been made by Anton Grabovski and he's already explaining how to do how to make this kind of frost solver plus animations done in Houdini so I am mostly gonna be based I'm mostly gonna refer to as his work and modified a bit of his work to implement it for 3d ver 3d frosting so let me try to explain that how I can do that okay first first of all let's make a base geometry for the frosting for the for the Anton's expects ampuls it was made in on top of grid but for this example I would like to make on a sphere so that if you change the sphere to any kinds of 3d geometry could be reused for three frosting so as a typical shape let's use fear as a template and I'm gonna set the frequency to tend to make it smooth enough and let's set this to let's name this base geo alright now first thing I would want to do is to make a to create a points on top of the sphere which will be a starting point of the frost and I guess I should explain in sketch okay so it basically works like this first of all you have the base points which starts the frosting like this now the things that I would like to do is to let's delete this altogether and set the base point first and from those base point you also set the starting point like could be randomly and from the first frame the frosting frost over will start making the frost from this starting point to de the horizontal direction on the surface on the surface directions and by the time it comes near to the other to the other base points then this will be kinda starting points as well and making the flossing as well and if frost goes by here and when it comes close enough it will become starting point this will become starting point starting point and then we'll do the same growth now that's the base that's the basic now in order to define how the frost should move should grow if you think about how each like frost works basically it's a hexagonal directions external growth so actually basically the growth will go by 60 degrees on a surface each 60 degrees which would make a 360 degrees and which have six size and frost could go any of each direction like this depending on the conditions on the surface like temperatures humidity are there any other conditions sometimes the branch itself would not born sometimes it's just forward branches some type of beaches to branches sometimes this could be six branches so we can control that due to the condition of the surface or in this case could be random as well and the flow the flow of the growth it's it might without any conditions on the surface it will just go straight to sixty degrees but it's not really realistic and somehow it would carve like this or like this or like this or sometimes it would just stop at some things so in order to make this kind of conditions what Anton explaining in his tutorial is to make a gravity field as well besides the base points like this kind of gravity field which mostly goes from the starting point to outside but somehow it has some rotation curve rotation vectors at randomly or maybe using some noise function and not really just just drastically but somehow it will enable the vectors which would try to go too straight to 60 degrees directions to angle it a little bit using those gravity field or vector field so that's the first thing I would like to implement inside Eenie okay so first thing first let's make a base points using a scatter and on top of the surface on top of the sphere surface this IBA too much let me make a note to gather all the parameters I would like your control later and let's color it blue okay and let's go to a edit parameter interface and let's make a first parameter here which will be a number of point so source point I guess so source PT num source PT num and range I would set from zero to hundred why okay let's make another one for this one let's make a number of points for the vector field the base points off the vector field so I will just call it ref be genome FB Kingdom and this could be really high so like 10,000 or hundred thousand okay let's go with this and for the so speaking um I would like set something like 70 maybe for now copy this and paste it here okay let's also set the radius of the sphere which I would like to control here so let's make a float name this radius right and uh could be from zero to ten let's set it to something like five and copy parameter paste it to the uniform scales okay good now after making the points I would like to set some of the points in in for these base points to be a starting point which would start making the frost from the first frame so let's make a point Wrangell to make conditions okay let's make a parameter here float um threshold CHF Thresh also a random seed let's get this here and if the rand at PT num plus seed is less than threshold then make the set the attribute star to be 1 or wait am I missing something a frenzied okay maybe I could just set the groove to be 1 so [Music] set point group start to be okay I think oh yeah I have to set the number of point here okay let's check that out in a geometry spreadsheet and do I see anything nope because this is set to 0 threshold okay if I set the threshold to something like this so 30 percent of T points will become the starting point one that won't be too much maybe I'll just go with the 10% now and the seed will change the position of the start starting point okay okay um let's also set these to the parameters since this those are pretty important just let's make two one is the source point threshold source point threshold and this could be from 0 to 1 because random is from 0 to 1 and also the random seed source PT seed source CTC this could be any kind of ranges so I'll just set to 0 to 10 and I'll just set some random number here let's just set point 1 here for the ref point I'll just set some random number here as well okay and let's copy this paste it here also copy this random seed and paste it here right and I'll name this arch points okay now let's also make a reference points which will work as a vector field in order to define the direction how the frost will should grow okay let's do that okay so let's do the another scattering connected here now this points could be really high number like this because it's just a reference and you want to know really like detail a point position at points all detail densed informations for the vector field so maybe this amount is okay maybe too much I'll just reduce this to fifty thousand okay and also I'm just gonna turn on turn off the relaxations or maybe not mm maybe not oh maybe I would want some random behaviors for each point so maybe I'll just go with this okay also I would like to give each points a normal direction right now it doesn't have any as a normal directions I would like to set the normal direction based on this surface so the easiest way I could think of is to use array and connect the first points to the first input and then the collision to the second and also turn on the point urges intersection normal which will give you which should give you the normal points I thought let's check geometry yeah um no no it doesn't have any okay doesn't seem to have a point intersections oh yeah I have to set it the method to minimum distance okay now I have all the points with the normal directions it's good turn this off and next thing I would like to do is to make a actual vector field from this point from this collection of points together with the starting points since I would want the the vector field to be produced generated from the center of the each starting point which will which will ran over the surface 360 degrees and so in the end it should give you something more like a Voronoi diagram with the vector field so let's try to make that oh it's a good point wrangle first the modified points for this point with the normal directions and as a reference set the starting points to the second input let's write some code here okay okay um let's set the first parameter float seriousness CHF this is for the noise function and float max angle this is for how much it should the vector field should rotate using the normal axis to make a use the noise function to create an angle and use an angle to rotate the vector field which comes straight at first but if it's straight it's not really natural so I gotta use some random functions to make it a little bit more natural okay and let's get the Nero point now from the second input using the point position the current point position I will get the closest starting point information starting point number using this or base point number and then from that I could make a vector and pass equals to point from second input and make a direction this direction will actually be a vector field the base for the vector field and I will just normalize this from the current position I mean from the starting point to the current position now let's test it out to see how it looks like right now without using the noise function okay to the direction attributes direction vector attribute so I'm just gonna set the direction here that I have just made and let's see how it looks like let's make a marker here and I'll name this steer as a direction and not the text but vector that's a bit too big okay so it looks like this each point have its direction from the starting points to outward like for 360 degrees and if you look far from if you look at from far away it does make a Voronoi cell looking pattern yes but right now it's as you can see the vector itself is pretty too much straight up and if we use this for the frost generations the frost will become pretty much straight as well which will be which will be looking pretty much artificial so let's make let's make a noise function to the random randomize this flow vector feels a bit okay um let's between here let's make an angle and use the a noise it's the aggregator noise and based on the point plus the smoothness x max angle and this is indeed written in degrees so let's convert it into radians okay and let's make the vector phone rot crow tanyon quaternion for the rotation with the angle and the axis the axis will be the normal direction since i'm just wanna rotate this vector feel like like a typhoon based on their and axis normal axis now the new direction will be q rotate brought deal and let's normalize this again here to see how it looks like now i have to promote the parameters here now let's try to move this a little bit okay doesn't change a bit because the max angle is a bit too small because this is said this has to be degrees seven degrees so let's go to parameter settings and set the maximum range to eight 180 degrees know if I change this now I starting to see some changes here think yeah with the smoothness and the angle I do see some changes so it's not that drastic but you can see some changes on the a few changes on how it curves how it rotates how the vector field transformed based on the noise function and I'll just go with 90 degrees maximum and smoothness of know maybe 0.3 something could be any the intention here is to make somehow a bit randomized this vector field okay I guess I'm not gonna promote these parameters to the controller here because this is kind of minor setup so let's continue the next thing I would like to do is to right now I only have the direction vector inside this reference vector said on and I don't have those direction vector for the starting points so what I want to do is to refer to the reference vector field to set the base direction vector to the starting point now for that one I would I can use the transfer at reviewed transfer okay and connected here and what I would like to transfer is oops don't need this right want to transfer is the points attributes one is direction and I could also promote a transfer a normal attribute direction as well so let's look at that so first the direction vector has been successfully transferred and also the normal direction has also been trashed for it as well okay now let's go to the next one before doing the calculation as a solver let's set the initial conditions for the points using the point R angle let's name this vector field okay and for initial points I'll just name this init point and first of all all of these points are the base points all these points should be the base points so I will set the group and to to say that these points are included in the base group so set point group base PT num2 one okay and also in later on the base group and those points those points will lose the attribute those glutes will lose the group base but I also still want to keep the initial condition of the points like which which one is how when I mean where did the frost initially started so even after all the frost growth I would like to I still want like to know the initial point position a point number of the frost branch so for that one I'm also setting another group called source beating them with one and all so let's set a point group whether is if the point is on the end of the frost branch I'll call the end now for the initial numbers I'll set to zero and show conditions I'll set to zero because I would like to start from it I don't want to end from the initial points now let's see if I'm getting it so I have the group age group and group sourcing group start okay anything else yeah let's also set whether the point have a branch so inish basically the frost branch should be looking like this let's say this is the starting point and the breath the main branch domain and growth will go like this for could be this will be around 60 degrees and sometimes you don't have that was randomly but let's say this is the domain a growth direct growth branch and from those from this main branch you'll have another sub branch like a leaf on top of this curve link for each divided point you'll have this kind of leaf like branches and whether I will define I will set the group whether if the point this point have those sub-branch or not and I will name it as fork so if the focus one then the points have this sub branch if the point doesn't have any sub branch then the folk because to 0 so that's the group what I'm gonna set right now set point group fork PT nom 0 right now you don't have any sub branch for initial points so it will be 0 and let's also set a group for the fork end which will only which means these of the end point of the sub branch and right now I don't even have any fork I mean sub branch sold this is also will be set to 0 and finally as an attribute let's set the length of each point now what does length mean for each point means is that for each point like here if it this is the point am i I'm looking at it I'm looking at right now then the length will be this length if this is the so for this point you will have this length if this is the point position then the length will be like this if it's the last points then you'll have all the branch lengths and same as for the saw branches if this is the point then this should be the length for this point if this is the point here then the length will be from the starting point of the sub branch to the point position now that's the point lengths that I'm gonna use here okay now that's for the initializing the points I also need to initialize the primitives well I don't really have any primitives right now at this point because there's only points and there's no primitives as you can see but I can still set the initial attributes and groups so let's do that okay a primitive Wrangell and I'll name this in it trims now the first thing is the first thing I would like to do is tea I give is the generation integer value which will be used if if if if if it's the main branch the that's starting from the starting point I mean this branch this big branch then the generation will be zero if if it's the sub branch then the generation will be one okay and also a side sign will be defined whether it's on the left side or on the right side if it's on the left side it's zero if it's on the right side it's one and I parent a parent is the point number of all the primitive number of the parent of the this sub branch or the yeah so if you're looking at this primitive then the domain the per parent primitive will be this main branch so that's how parents should work so I'll just set 0 for initial number then also set the color for the primitive right now I'll just go with white okay now that's enough for the initial attributes let's put this into the know I'll name this horse TT and I also would like to make another no copy paste this one and connected to the vector field and I'll name this as a ref point okay and finally let's bring this base geometry the sphere geometry down to here and start doing the frost calculation using the solver which will be the main point of this tutorial okay so make a solver connect the source point to the first input and the ref point to the second input and the base geometry to the third input and let's get inside okay now first thing first I would like to make a initial branch like from from each starting point first of all what I need to do is to get the [Music] starting point just a starting point in order to start but before doing that let's check out if if the starting points are being reduced about initial condition up here so let's use it lead to set the condition here if wait what kind of okay so I have to start now nothing seems okay I have to set points and delete non-selected and I do have some several points which will be the starting point and that's good okay I just wanted to check that now delete this and make another delete component and the first thing what I would like to do is to go to a points and set set it to delete select it and I would like to like to wait a minute delete the points which is on the the base which has the base group here and let's also make a point wrangle here and connect prep frame to the first input and delete it points to the second one and then [Music] that's a search for the nearest point on each starting point or or the base point yeah I'll just set it to base here so basically I'm all looking at the base points right now and then I'm excluding the points which have the base group right now that this is all base so this doesn't really make any sense but right later on there'll day there will be points which is not included in the base points and for that one what I'm trying to do here is to convert the base point convert the base point depending on the radius of the closest nearest a other point a nearest other point hmm okay let me make a sketch for what I'm trying to say okay now say this is the base point and this is the other points right here and right now let's say that starting point is only here right and when from the base points it will make a search around its position like this like this like this and if the base points from the base points if it finds a point which is not including the base in this case it's the points on the red colored red like this then the base point will become the starting point but if the base point couldn't find the the red point which will be the point with that's not included a base group then the base group stays as it is and will wait until the red point comes close enough to make this be to make to make to convert this into the starting point so that's what I'm trying to do here so I'll make ain't handle PC open you see old and I'm looking at the second input with the P with the current position and let's also make a variable I mean the parameter the search radius and one and if the PC iterate and all since this will be only one point which I'm this will be only one point maximum one points I will just do one iterations then set the start group of the point grant point point set point group start to be one okay and I'll name this set start so this is the conditional script which will convert the base group to the start group in order to start generating the frost okay alright then actually use that start group to create a initial branch's initial main branches for each starting point now I'll set the filter to start and run over the points okay now let me write some scripts and this is pretty much based on the anton Grabovski already wrote so I'll just go pretty quick and just trying to explain what it's doing first of all let's make a increment available which starts from 0 and make a while loop Inc till 6 and this is 6 because I would like to rotate the angle of the branches 60 degrees so 60 degrees by 6 is 360 degrees so that's why it's 6 and increment the Inc variable by one at the end okay now the first thing I would like to do is to I don't want just all the starting point to have six branches but I would just like to have random number of branches for each starting point so make a condition here first if random p-ting um+ include incremented number and plus maybe I could add seed values so let's make a float seed CHF seed and add the seed here this will give me the random number from 0 to 1 and then make a condition okay let's make another parameter here float frien's equal CHF per is Orions and if so then increment the ink variable and then continue which will skip which will skip all the rest of the calculations that I'm gonna write next because I'm adding incremented and because I'm adding one to ink variable and it only runs six times but I'm skipping one here so if this match is 50% of times by running six when it runs six times then it will only run three times for the later calculation okay the next thing I would like to do is to first make a base angle which is a radiance the multiplication of the 60 degrees and also let's get the rotation axis which will be normal vector in this case okay and let's make a matrix rot for the rotation well let's make a matrix let's convert to rotation matrix using a rotate using the angle and axis okay so the basic direction of the point will be the art there I'll I already say each point already have this variable so what I want to do here is that make a a new direction with by rotating this original direction vector by rod the rod matrix rotation matrix now it's also let's also set how much it should move for each branches how much it should move for each frames as a branch let's make a variable called step and here making a step vector which will be the current position plus the direction modify Direction times step number this one why I don't have an error right now so let's all just continue now let's search for the points with the specific radius here or maybe I could just use a new point which might be simple since I already know I only need one reference so make a MPT air point with the moved point which will be this one this will be the new position of the point okay which will because it's being moved with the step value with the direction and I'm searching the second input of this one which should come from here the second input is the reference point which is the which have the all the vector fields and I'm referring to it using this new point and by the step back position which is the new position and then I guess that's it and I'm just searching for the nearest point and then from that new point I could get a attributes from the points of the from reference point points I what I would like to get is the direction vector on this new point position so vector and NDL and direction so it's the neighbor directions and near direction I guess is a point from the second input named direction at MPT okay okay so now I've got the the new direction for the new points this is the new points what I want to do next is to create since this is the initial branch creation I would like to make a primitive to be a polyline and from now on when the branch grows the vertices will be added to this primitive and the first point of the primitive will be the current position obviously and the second M the second point position will be D right now I don't have any points right now so at point at step back positioned okay now also let's add a vertex to the primitive with the pd0 and pd1 and let's set some parameters I mean the attributes to this primitive first of all set prim achieve type the type will be used whether if it's the main branch or the sub branch type a Type B type C you type something and I'm gonna set as an integer so the initial branch type will be B the main branch which sought starts from the starting point so I'll just set to 0 and 0 will be the main branch and also let's also set the set a point group name and because the PT one will be the last point so I'll set the end to one and set point group n2 this is not group this is attribute and to PT Cyril to be at Mach and and also set the point truth 0 direction of the PT 0 to be direction and for the set point mmm truth 0 PT 1 this could be at mark and but if you really need if you want to make it more precise I could add another near-normal here we'll just say and nome point 1 n m PT and i can set and norm here lastly set point trave direction for the last point p and direction right apply there's no error and last of all after all the iterations six times i would like to set the base to be zero since this has been converted into the the branches I'm not gonna use it for a starting point anymore which means I also need to set the starting start group to zero as well set point group right okay ply and let's see how it goes I also said I also have to promote some parameter here no see it could be any number as Bryan's could be like mmm 0.3 or yeah point three is okay this will means that 30% of the success rates will be used so 30% so probably two or three branches will be created if it's through three I'll just go with four then 40% and the step is the length of the each starting initial branch so let's say something like mmm 0.1 or 0.15 and let's see how it looks like and there you see those initial branches for this one you have three branches this one have only one branches this one had four branches and if you increase the step you will have longer branches Longway initial branches if you have increased the Bryan's the and okay you have less branches if you lower the Bryan's you'll have more chance to create a branch so guess what I'm saying was wrong for the variance if lower it is you have more chance to have more full six branches so I'll just go with the 0.5 10 is for 50% so you'll you basically have a chance to have three branches for most of the time but hmm right now it's 2/3 and I could also change the seed here to control the initial conditions now for those parameters I think I can promote it into this controller since I think I would like to control these this wall here so let's do that the first thing Bryan's branch Ryan's branch is goes from zero to one not a float step value step lengths which will be zero to one as well could be a larger or could be less and also the seed so I'll say branch seed let's name this branch step as fall so that I could easily see what kind of step I want here right and the branch see could be from zero to ten could be any number okay and let's say that uh so the Orions I won't why I wanted to be 0.5 or something branch step could be like 0.1 something and the branch seed random copy this and go to the solver and paste it on here and I'll just copy this to the seed as well and change the name here branch seed also for the step change just to step okay let's see let's see if it changes bodies those parameters so the branch of orion's if I lower the value I have more chance to have six branches but if I increase it I have less chances to have full frenches if I change the seed I have randoms branch conditions and also for the branch step I could change the length of the the branch step cool alright this is okay this is pretty much fine now let's continue inside a solver now I have those initial condition initial branch start all namely a branch start next thing I would like to do is to create a solver definitions in order to grow these small branch so based on the a vector field on the reference points okay let's do that okay so first thing first let's make a point wrangle point wrangle and I'm just gonna group this in order to organize a little bit and connect the branch start to the point new point wrangle and this will be the base growth now for since what I want to do now is to create a new branch on top of the end point of each main branch so if you look carefully at the branch start I have said the second points created as an initial branch to be included in the end group so I am gonna filter using key end here and create some branch girls okay let's do that now first this is also mainly based on the Integra box keys functions got us first make a void function called base growth and trim vector yep normal and direction and the new point which will be point one we're gonna add a new point on the step position maybe this is not really clear I'm just gonna name it and pass as a next position and add vertex to the current primitive which is this 1 2 P 1 okay and set point group and to PT 1 ok I have any errors and set point a trave the normal from this input and set point drove in X Direction 2 ND r ok all right now in order to call this functions [Music] first thing I need to do is to search for the obstacles since if you're making the branches on the 3d surface there is a big chance that those branches somehow collide each other at some point like if you have those kind of branches from one point and second branches from the second point somehow at some point this branch will collide with the other branch and I have to make a condition whether when it's gonna collide and I have to avoid colliding it in order to make it more natural or as frosting generations are frost growth like to stop the growth when it hit with the another branch and just end the growth up until here same for the other branch if it goes until here and if it find the collision on the forward attractions then should the growth should end here the generation should end here which will fill the spaces with the generated branches without any crossovers let's do that okay so doing an end to the cold let souls first make a variable step like how far how the step lengths of the branches which I used it before so I could use the same variable inside a controller no prouder first of all I have to set up I have the promoter parameter here in order to link and I float max lengths watchful VD maximum lengths for the branch okay and also load dot threshold which will be used in order to define the direction of the newly created branch the last primitive last point of the branch last tip of the branch so this will determine this this will be used to define the created condition for the angles okay now float another one I would like to have is the max angle which will be used also used for the angle for the tip of the branch and to to set the position of the tip of the branch oh I'm just gonna explain it later and I'm just gonna promote these for now and for this step I could copy the parameter from the controller and so let's go back to the controller and copy D which was it step branch step copy this parameter here then go back paste it here okay the maximum length I'll just set to 10 as a maximum I guess I don't need to set global parameters for this one the dot slash old okay we'll just set 2.8 and for the max angle I'm just gonna set it to 3 so this is being treated as a decrease and I'm gonna explain how it's gotta be used all right now okay so first thing first I need to set as I explained previously I need to make a condition whether the branch will be collided with another branch so in order to do that especially for the 3d geometry the effective way to do that is to first go back to the previous points which is this one and then since each point have normal direction like this so first of all let's make a point wrangle and I'll name this block boss and move this point to the minus direction off the normal direction my point five I mean it really depends on the size of the sphere so if the size of the sphere is pretty small then you should also decrease the value here as well so I guess I'll just go with the point two five right now so by doing this I have just moved all those points by two point two five to the normal the minus direction of the normal direction and now from here I'm gonna use the extrude poly extrude and can extrude using the point normal existing or existing fine and the distance PD the double number of 0.25 so the 0.5 which will give me something like this and this plane the collection of planes could be used as an obstacle to calculate an intersection so I'm gonna connect this block geometry to the third input here oops and for the second input I'm gonna just connect the reference point which will be the jewelry this one which have the vector field to the second point okay now it's time to calculate the collision the intersection I'm gonna use the Ray intersect function here first of all let's make help out tribute cold all P and O UV which I don't really not gonna use this just need those variable in order to calculate intersect so intersect from the second input which I connected the geometry with the point current point position plus the moving direction moving direction and times some value to determines the movement I'll just say step x 0.5 and or now this will be the starting point of the race oh I can't I guess I cannot I'll just say 0.1 step times 0.1 yeah and the direction plus the distance will be VR via mark Direction times step times something like high value like 3 it's fine think 203 is fine I think and the ALP value LP and all UV which I'm not gonna use it alright so now have the Ray if the Ray is minus 1 which means I the Ray couldn't find intersection which means there's no collision so I could make I could make a growth on the branches so this here is where I should write how the branch should grow okay I'm gonna name the new position and pass which will be at mark P plus the direction on the point directional attribute is on a point time step which is how far I should move and this itself is fine like this but in order to make it more natural or more and Rand amick it's a add another random value here which Anton is also doing it in his tutorial so I'm gonna use a bit new one brand PT nom 2.2 to 1.0 so the step value will be shortened randomly by 20% 200% in between 20 percent 100 percent okay which will give you more variety I guess to the two it looks it looks now now now let's make a let's search for the near point using a near point to the reference point using the new point position and I will get the nearest point one point and from that I could get the next direction which I did last time using here at LPT okay now since the primitive since so right now I'm making a branches on from the end of the point of the main branch and since the branch the main branch already has a primitive so what I would like to do is to refer to that primitive number first then add any vertices into that primitive to create a long branch one single primitive with the multiple points so in order to access the primitive I could go and trim equals two point trims and the primitive which included ends with this point number and I think most of the time you only have one primitive so I'll just get the first primitive number here then also let's get the length of the primitive which I'm gonna apply later on I'm just gonna read attributes called lengths and let's make a condition here if okay the first condition here is if dot be at mark direction - and the era the next direction is less than that threshold dot Thresh then make the next direction to be the current direction if not then use the next direction this means is that it's seeing the angle between the current direction on the points and the next direction and if T if the angle is now this is like from zero to one and if it's one close to one it the angle will be close to 0 which means parallel this and this is parallel if the results dot is one if not then the there is some angles in between these and this and this and I have set the threshold here dot threshold so which means if the angle is bigger than some point so the point five will be 90 degrees I think or in zero will be 90 degrees yeah zero will be 90 degrees so if the angle is somehow a bigger than this threshold you calculated by dot then don't use the next point direction but just use the the direction which was which is on the current point which is on the current point so use the direction on the current point if I explain it in the sketch is what I mean is that so this is the rate okay so let's say oops you have this kind of branches and from the endpoint of the main branch you want to go to the next branch now what you have to do is to define the direction it's this way or is this way or is this way the thing is that are you first thing you could do is to from the current position you already have this basic direction vector here right so you already know where to go next which will be around here using those this vector using this V art mark direction okay so and the length of this step will be step now you already have this new position what you want to apply to this point as an attribute is a new direction for this point whether to go this way or this way or this way or any way now in order to set the points in order to set the direction Y you could do is that previously you have made we have made a reference points which is a vector field which has tons of points like going this way going this way this way this way this way or something like that so while you Y you could do is that from this point search for the closest reference point may be such as this one this is the closest and from from from those point you can get the direction vector on this reference point and with this vector and the previous direction vector you could compare the angle between this and this so will be something like this and eventually you will have a angle value here and you could get the value using the dot using the vector 1 and vector 2 and if it's close to 1 the this is parallel which means it's the angle will be 0 but if it's close to 0 then the angle will be will increase more so so if it's Syria I think it's 90 degrees if it's minus 1 is the opposite side now inside a cold I made a condition if the dot this value is less than something like point eight five point eight then which means if the angle is bigger than at some point then just use this one for the new direction but if it's less than like this angle or less than point eight or the larger than point eight I mean think I mean less than 0.8 then wait let me well if less than point aim which means its if it's bigger than then then just used a previous direction but if its larger than point eight which means it's close to zero angle zero then use the vector which is on which is attached on the reference point which have more curved behaviors like this but if you use the previous direction it'll be just be straight up since I you're using the same direction so it's better if we could use the reference the vectors on the reference point but the problem is that the points from the reference the vectors on the reference point have at some point have a really a opposite direction like say this is the starting point and as I showed you the vector field really looks like this so up until here the branch could go pretty well using the reference vectors but from here if you compare the previous vector with the reference vector it's obviously the angle is much larger than like could be ninety degrees could be more which if you just use the reference points vector as a next movement the point will just go like this the branches will just go like this which is pretty Jaggi and not really good so as soon as it met with the reference point which has more than certain angle you let's just use the previous angle which the original point half so that it will just go straight up go straight now that's the condition what I would like to make here and inside e an tong graphs alpha skis code he's doing more and I say more detail danced calculations here so I guess he didn't want it to make the make it pretty much straight if it couldn't find a reference point so he what he's doing is that he's making another calculations in order to use the previous direction but somehow randomized the angle to rotate rotate the based angle so that it won't go too much at official but that's too much coding so I'm just keeping it to make it more simple here which means I don't need to use this one to max angle and now I have those conditions let's make one more condition here at the end if the length is less than max length then use these so I would like to stop the branch at certain point using the max line condition now hey they called the base growth function that I have made on top finally with the frame number impasse normal vector and next directions and finally set a point group and at Pt num to be 0 since the point will not be used as an end point anymore ok apply and I don't seem to have any errors except and if I run the program it should make the branch growth until it collide with the other branch let's see it ok now it is running but as you can see it has some problem here because it's not running through the surface of the [Music] base geometry in this case sphere it's just running out of the sphere running out of the surface and in that case there is no way we're gonna collide with the other branch so in order to run through run on top of the sphere I need to have the Ray here and collide was the base geometry which is a sphere I'll name this FB T I'm doing this base GL and connected to here and set it to the minimum distance let's also calculate the point intersection normal in just in case right then let's do the clock solver animations from the start yeah now it's doing the main branch generations and as you can see the branch stops where where it met with the other branches now that's good now thing I noticed is that what I'm expecting more is that when the branch grows like this I want the other points to become starting point as well when it finds the closest point here and seems it's not doing it something must be wrong inside the code so let's look at it and this this is where it should do that I guess this here yeah I didn't have the radius parameter here okay let's promote this set the parameter to some number like 1.5 and maybe I could promote this to the parameter but I'll just leave it as it is I don't want to make him what too complex like the one but this is really pretty important for average so I guess okay let's go back to the controller and I have make a new parameter search read search radius search rad and let's set the maximum to be 1.5 initially and copy this parameter and paste it here base relative reference right now let's go back on top and see how it goes by playing if I play it you can see that when the branch goes grows and if the tip of the branch get close to the other starting point like this this starting point will be activated as a next frost start the branch this and this branch will activate the other point as well like this one and the branch is blocked by the other branches and right now it seems pretty well at this point yeah now this is good for the main branch what I want to do next is the sub branch and that will be the main part okay at this point I'm speaking like two hours and but the original tutorial made by Anton Grabovski is like and six hours in total so I'm pretty much short cutting some stuff I'm not really doing the detail here I'm just briefly trying to get the idea of his algorithm to implement it for this really okay now it's grouped this as well right so the next thing I would like to do is to at this point let's set the lengths for each point as I told you before so for each point I would like to set an attributes called Lang then and but the point itself doesn't have lengths attributes what I mean by lengths is that T from the base point the starting point to some if you're looking at the current point like from here the legs will be from the current point to the starting point the length of this right here and same for other points so let's do that let's do that okay kinda for that I'm gonna do the primitive wrangle and for all primitives first thing I would like to get every points every vertices yes trim for tax count and let's set the initial float initial legs to be zero and now look through all the points but from the opposite side so which means from I ain't I equals to n PT s minus 1 to 0 like this because as I said I have to convert combine all these lengths and between points if you look from the end if you look from the start you just need like several lengths in between points alright and if the eye is MPTs -1 I'm doing this because I'm gonna have to do I'm gonna have to get two points in order to calculate the distance in between the points so the first one the current point or the vertex point vertex index Peak Tram num premium at eye and the previous point it will be vertex point zero vertex index zero I'm numb I plus one this is important okay now I have the point a number I can get the position for a both current and current previous point so the current position will be point zero P at the current point and the prayer position will be point zero p rev to Fiji right and the lengths I'm just gonna increment the lengths with the distance on between the points like this alright now I guess that's all about it now I have not after calculated the length what I need what I want to do is to set the point attribute set point trip call length to the current position grande point position with the legs right so how's that okay so okay in terms of the length what I was explaining was a bit wrong now I realized it's a bit wrong kiss bye bye using this the higher pointed tip of the point as as far as go as far as as far as far it gets from the starting point the length will be really short so the length of this point will be zero I guess because it's the tip of the point and by this calculations and the points which is all on close to the starting point will be the length between the last point where to tell the current point so what I was explaining it was a bit wrong here the attribute length for the point is if this is the Blanche if there is a points in between on the branch the length of this one will be zero the length of this one or this one will be similar to this value and for this one is this value because this is what it's doing inside a code I was a bit mistaken about this one sorry for that well okay so after I got the Ling's let's do the sub branch finally okay I'm gonna use another wrangle I'm gonna call this fork and which will be a primitive wrangles because I'm gonna do want to do for each main branches so a primitive wrangle and I would like to set the filter and when the generation is equal to zero and do I have a generation here with the primitive nope let's go back and let's go to the initial primitive we are here I'm gonna I'm not gonna set the attributes as a gen but I'm gonna set as a group so set prim a group called gen at prim num2 zero right mm let's go back and reset this over here so that I could search for the gen here and maybe not let's go restart go back and still I don't seem to have it okay let's go to the primitive if I have nope I don't seem to have it okay and they're so primitive at this point I still haven't done still I don't have it I guess it's because this is zero if what if I said to one no I guess it's because there's no primitives generated initially I must have been unable unable to apply the group so I'll just go with the integer attributes in that case because in that case I should be able to have it if I look at the primitive yes I have a gen okay now then I will say if the gen equals to zero which will be which means it's a main branch now let's write some code here this will be pretty long first thing I would like to do is to make get the points from the primitives each primitives so int and pts equals two Prem vertex count at Prem numb and four in zero and pts and PT equals to ver vertex point vertex index from numb I may be this could be dumb using more simply like using point prim prim points or something well maybe it's depended on maybe it's better to use the vertex because it's on in the order so I'll just go with this and and fork get fork attributes from the points the initially the main branch should have 0 sub branch so this should be 0 from the main points the main branch points and also let's get the source attributes from the points whether it's started from whether the points on the starting position or not okay and make a condition here if fork is 0 which means there's no sub branch at this point plus and source is 0 which means a the point that sub branch is gonna be made is not on the initial starting point all right so in that case vector toss will be a point position at NPT and vector axis is a normal vector that the point position and the direction could be get like this okay spell mistake my seams okay okay now um so in Anton kebab skis gravel skis are original tutorial he's making four types of sub-branches this I'm just gonna follow that so basically what I'm gonna write here is pretty much the same so you can copy/paste from his code if you would like to first of all it's choice so the choice the integer choice will be the type of the sub branch it goes from 0 to 3 so you have four types of branches and make a condition with the random so randomly create a brand sub branch out of four choices powerful types so let's make a random value before making the condition R and using the PT num plus probably a seed C number so float seed CHF seed and seed which will be from do to one now here comes the condition if the random is going to larger than 0.25 or mmm let's say less than 0.25 then let's make it simple choice will be 0 if random is larger than 0.25 and less than 0.5 then choice will be 1 if random is larger than 0.5 and random less than 0.75 choice will be too if random is larger than 0.775 then choice will be 3 so for those numbers I guess I could also parameterize it in order to define how much of a times you should have come like if you want to control the amount of types to get if you can control those numbers as well should I do that ok I'll do that I'll and one what's the what's the correct name for this one mmm range one CHF range one float range two range to load range three right and replace those with the range range 1 this will be range 2 oops Finch 1 this will be range 2 this will be range 2 range 3 range 3 can you apply let's promote those parameters okay so the first one seed could be any number the range 1 could be 0.25 inch 2.5 range 3.75 all right all right okay so you can see the branch generation function if the choice is 0 let's set the color to be read if choice one and the choice one choice you will be the left side ranch the choice one will be the right side branch and the color will be gleaned green okay okay if the choice C goes to two then the color should be it doesn't doesn't have to be but a blue then if the choice is equals to three then the color be yellow all right now and here I would like to call the function in order to generate the starting branch of the sub branch so initial branch so for that one I'm gonna make a function on top of here called and void Fork using some parameters like position axis Direction color as well as the integers choice primitive number and the point number right okay okay what I'm gonna write here is the function in order to create the initial branch now first thing first step which will be the step length of the branch and as as for the main branch I have already set the step on the no controller before so I'm gonna just use that from oh let's promote these and folder steps let's go back to the GL one copy the branch step rabitor and then go back and paste it here alright okay another one P float and X this will be some value in order to use it for modify the angle of the sub branch I'm gonna name this and X float PT off angle this is the offset angle based on the point position in order to make the angle of the sub branch more randomized based on the point position and the primitive number so I also want the prim off angle to be prim off angle and finally float seed now let's all promote these parameters and let's see what parameter could be promoted globally so for the angle exp I'll just set 0.7 and for the PT offset PT offset angle I would like to say this as a decrease on Sept 15 so based on the point position there's a offset of 15 max or 15 degrees for the primitive angle like to sit at 260 so maximum of 60 degrees offset will be applied based on the primitive physician and for this one in this one PT I'll sit and Pt a prim off said I think I can promote it globally so go back go back to the controller then let's add that number here okay so sub-branch PT offset sub-branch PT offset yeah I gotta say angle okay and the range could be from zero to ninety degrees and let's another one add another one soft branch let's just delete the space in between the southern branch sub branch frame offset and South Branch frame offset and the range from zero to 90 degrees fly right and for the PT offset 15 frame offset sixty let's copy this parameter go back to the solver and paste it on here okay paste it here as well and rename this to prim offset angle okay let's go back to the code and where was I so now I have those Bratz variables I need to use those two in order to set the initial sub branch before doing it I would like to convert this PT offset angles and prim offset angle to a scale value so float scale prim equals power and random with the Aang X with Prem off angle so in by doing this you'll have random angle based on the primitive number together with the egg X to have an angle between 0 2 in this case 60 same for the point scale point I'm let me just use the fit for this one fit 0 1 R + + PT 2 - 1 - 1 x PT off-angle okay now since for the sub-branch for the main for the main branch you'll have based on this main branch you will have two sub branch on each points like this basically as a leaf so I'm gonna make a full loop to iterate just to and here comes a bit complex conditions here first of all let's make a side multiple valuable so from zero and if I equals to zero which in this case I would say this is the left side and will be side mult will be one else they fall if it's on the right side side north will be minus one and I'm gonna use this variable later on in order to calculate the flipping angle flipped angle okay so next let's make a matrix rot in order to use it for the rotation in order to make it as a rotation matrix and make an angle here based on the the scale frame and escape point which I made using those random value with the maximum offset angle for a both point and primitive so the angle will be radians 90 degrees plus it's 90 degrees because since I'm what I'm gonna rotate is the direction off on the current point and the direction is on is heading to the main branch so by rotating in to 90 degrees it will create a rotation angle like this if it's 90 degrees so that's why I'm writing 90 degrees plus scale point and scale grim to offset the angle okay now here comes some conditions for each choices like how should the angle be modified now the first condition if the choice is not - which - is both sides the three years symmetrical so I mean the three is also both sides but at the branch is symmetrical like like this one like here so the branch Direction is both heading to the same direction but for the both side what I mean by both side is that if one side is going this way and the other side will go this way one side is go this way and once I oh this way like that something like that and if it's on just on the ref side you will have only the left sub-branches andand on the right side you'll have just initial branches and if it's on the right side then you will have the wrench just on the right side and on the left side you will have just initial branches sub branches and that's all four types one two three I mean 0 1 2 & 3 okay now what was I go back to the fork and if the choice is not to which means the choice is not both sides which means if it's either on the left side on the right side on the symmetrical then multiply the angle the base angle by side malt so the side malt is defined based on the side of the ranch either it's on the left side on the right side okay so if it's on the left side the side malt will be 1 the right side the side malt will be minus 1 so that's the first modification for the angle and that's else if the choice is 2 or I could just else if here comes another random value since for the both side for this one this could go right here or could be this direction as well so it could be either way the right side will be higher on the left side will be higher so that's 50% 50/50 chances for that so let's make random in order to make conditions so R and based on the primitive number plus some random number plus seed is less than five then add the angle by 180 degrees times I so if it's on the left side it's this will be zero it was on the right side this will be PI that's it okay and I think this is correct I hope this is correct mm-hmm III I think oh no no no this is not wrong this is not correct sorry the condition is okay if the angle if the 50% chances I will multiply the angle by minus one just flip okay that's good now another condition if the choice is equal to one which means on the right side then set the angle also flip the angle by multiplying by minus one else if the choice is equal to two which is which means both sides then add angle by I times I in order to create something like this I'm just creating this angle and this angle so there's two branches to sever inches with different angle but if you look from far away it looks like single straight line okay now now I got the angle I'm gonna rotate matrix using the rotate with the angle with the axis okay now let's set the new position for the point new point so vector and toss the current position plus the direction times rotation which will define the rotated direction time step in OS so that you could set the size of the step okay now using that let's make initials of branches so for that first let's make a prim using add trim with the polyline and PT 0 equals to add point PT 1 and point step no wait a minute [Music] new position correct yet and I guess I guess I don't need to add new point here probably because I already have it here this should be the starting point so instead of adding new point for the PT 0 I could just say and PT I think let's try and add vertex for the primitive with PT 0 add vertex 0 frame 81 ok let's just set some primitives first set primitive with the name Gen generation now the generation 0 was the main branch so the generation 1 will be the sub branch now another one set frame a drill and watch will be the parent a true in teachers this could be the NPT which will be the parent point number I thought it will be a primitive number but actually it's a point number so NPT ok and set frame active side - four decide it's either zero one and I could just use the eye on the full loop and set prim a tray for the color I'm just gonna use color from the input and then set trim a trave type like what type of sub branch is gonna use the choice plus one so if it's choice zero then it will be 1 if it's choice 3 will be 4 because choice 0 is the main branch I mean the type 0 is the main branch okay next I have set this type let's also set the set point H Rev with the N normal for the ptn watch will be access and set point at Rev with for the direction at PT 0 actually I don't I don't think I need to do this time because it's already being set on the point position but anyway anyway I'll do it direction times rotation okay that's a new direction and set point true for PT one this could be access or I could also refer to a using the ref points but right now I don't really seem to I'm not connecting the ref points here so and it's gonna be too much long code so I'm just gonna use axis well that shouldn't be that different and set point three zero the Year PT one tier x rod so basically the same as this one PT 0 maybe I don't maybe let's mmm well let me let me keep like this and see how it goes and finally a conditioned final condition if the choice is larger than one or which means larger than one means either both sides or symmetry symmetrical type or choices less than 2 which means left or right side I equals to zero then set point Trev and case the that will be the the end point position end point of the sub branch where it should where it is the end point of the sub branch and where it should start the next growth so set 0f and that this will be the sub ranch and PT 1 2 1 ok the reason why I have this branch is because for the left or the right I only want one initial branch and for the other side I am ok to have a F and to be 1 but for the other one FN should be 0 and nothing's gonna be grown from this F and Eco 0 ok and from what I remember may be the F end is set as a group let's check that out F and is yeah indeed it's in group so I have to set it as a group side here so on set point group FNP tomorrow okay that's it hmm I think that's good for the initial sub-branch let's try that out if I got it let's enable this one just reset here and here go back and let's play okay it kind of started but no it's not making any branches obviously sub branches obviously so something must be wrong let's see what's wrong okay now this should be related to this one should be right to this one maybe this is is this is the point which was wrong so right like this okay go back nope still nope still no okay let's see it's all just pulls a little bit and see what's wrong okay um obviously I found I found why it was wrong with this because the reason is because I have made this fork functions but I haven't called it yet here yeah that's stupid okay so let's go down and inside our conditions for each choices let's call the fork and actually create the sub-branches so for the first one pass access your color choice trim and PT and actually I don't have to write it here but I could write it outside the condition and make initial color condition like vector color 1 1 1 and by using the condition change that color okay like this and this should give you the conditioner I want possibly now apply accept clothes enabled array and then go back and play yeah so right now it's just an initial sub branch but it is indeed creating at each main branch and that's good that's good yeah let me look at the initial scatter points and their starting point seems like I have many points here which might not be a good idea hmm let's check that out because um okay let's give another mark called source with the text is fine let's color is red and Heidi's I don't need a direction I only need a source now am I missing the source right the sources on the group right now and and the fork is as well and what I did wrong is that I get the condition as an attribute right right so we're I did wrong is around here or here okay so not this one maybe this one okay so yeah this is the condition I got wrong I'm getting a attribute like this but actually what I want is the group whether the point has the group or not so let's do like for that um I could use in fork equal in point group and what was that correct spell in point group okay and for ik at MPT and source in point group 0 source OTG alright and delete those and this should go well so that I could delete the branches on the starting point the sub branch on the starting point hopefully go back yep now it's deleted now it's more clear okay now I have the initial sub branch what I need to do is as well as I did for the main branch I have to make it grow mainly in this Fork and the next thing I would do is the growth for those folk sub branch so [Music] I'm gonna make another wrangle in this case a point wrangle and got a filter it I'm gonna name it first with a sub-branch growth and filter it what the f end says this is the end point of the sub branch like here or here here here okay getting tired first of all let's make a variable load step this again step I'm gonna copy from the controller later on float angle CHF angle this is the base angle for how the breasts of RAD should grow and float max Lang the maximum length of the sub branch and this will be the ratio that will be from 0 to 1 in order to make a comparison between the main branch lengths and sub branch lengths so the sub branch length should not be over main branch lengths okay and seed right and here since this is the another growth as I did for the main branch I wanna check the collision here oh this is really tight this it seems like it's being built from the same point position let me check that out this doesn't look correct oh well it looks okay now okay so in order to calculate the intersection or collisions I will do the same as I did for the base the main branch growth so the for the second input I will connect the reference point again here and then for the third input I will input the collision geometry which will be calculated the same as for the main branch so I'm just gonna copy this one paste it and bring it up here up around here connect to here which will make a collision plane geometry like this and connected to the third input here good good now let's do the collision detection as I did for the main branch first I'll make an empty barrel vector and make an array use an intersect from the second input I mean the third input from the point position will plus the direction time step by 0.1 and the length of the direction that will be the array will be VR at Mark directions time step by three it's the same for the main branch and I'll be on all of you V okay now if the array is equal to minus one which means there's no collisions which mean you can grow you can continue growth first thing I would like to get is the parent point number from the primitive so in parent equals prim parent at frame so a prim Nam inside a pointer angle will give you the primitive number four which point is consisted on okay and this will give you the parent point number then after that let's get the float parent links so each point has lengths so I could get the legs at the parent point like this and I could also get the lengths for the primitive which is a sub sub branch branches lengths like this now here comes where I would like to compare the parent point links together away is the the max links I mean the sub sub branch lengths so if I look at where I've set the parent I think it was something around here check me check yeah so this is where the why I set the parent and the parent is a set as NPT and NPT is from this input on the fork and here and NPT comes from a vertex point on the primitive all right so it's more like previous previous point on top of the curve on top of the primitive I mean this have branch so inside here what I'm making as a condition is like this if length which is from the primitive the current sub branch primitive things is parent length x max length is less than parent length x max length then add the branch so being looking into this conditions why it is but honestly speaking I couldn't really get why the condition is like this because it still works like this like legs larger than parent length times multiple max length I know it's it's a condition to reduce the length of the sub branch and somehow it's comparing the lengths with the parent legs and I think I might not be getting the correct image what parent legs means basically it should means is it should mean that delaying itself is that from the parameters of the links of this branch and the the parent length is the length which is on the previous point of the current point which should be this one for for the initial point so for this point the distance the parent things distance is like from here to the end point and it's comparing this length x max Lang with this length with this whole things but in this case this hasn't been born yet so this hat does doesn't have a in for information how much how much how far is it or how long is it so definitely you will get the next branch but for for the next French yeah maybe it's doing the same conditional stuff I'm just using this condition right from the tones tutorial so if you want to get in detail you should look at his video although it's in Russian so I couldn't understand unfortunately and first I'm gonna make a random angle using the base angle which is from the promoted parameters and use the fit so you one with the random like random + seed to convert it into -1 to 1 okay it's okay first let's set some value here angle I mean the step step I could just copy from the controller so let's go here and copy the step and go where okay this one copy this go back paste it here okay the angle angle is the like how much how drastically the sub-branch should change for each iteration so doesn't have to be really big because if it's too big it will like call so like two degrees or something it'll be fine and for the step if it's same as this main branch it might be too long so I will multiply this by 0.5 here okay and this could also be a speed could be one I'll try with the one first and the max length this is the ratio of the length so I'll just go with the 0.75 and de-seed randomly applied and I don't I don't I don't think I need to promote any of those parameters globally so I'm just gonna leave it as it is and let's continue with the code okay so I have made the angle the random angle next thing let's get the side information from the primitive whether its branch is on the left side on the right side okay let's get let's go to the geometry spreadsheet if I if the primitive have the side okay yeah it does have so it's okay now if the side equals the one which means on the right side then the random angle I'll multiply by minus one so that it flips the angle flips and make a matrix rot rotation matrix is an ident and rotate the rotation matrix with random angle with normal axis okay the next direction will be the current direction x rotation which will rotate the vector and the vector and pause which will be the next position will be the current position Plus and Direction bra time step okay and add a point to the next position at point two and off right and also get the prime number from point prims at frame number no I mean the PT number and just get the first one and at the vertex to creme with the point of added point okay and for this new point set the primitive I mean to set the group and attributes first of all set point group F and PT 2 1 and set point trip 0 n PT normal vector and set point at Rev direction with the new direction and finally set point active no set point group to the F end of current point two zero because I have already I have just made a new point for the tip of the branch as a tip of the branch sub branch now X apply I don't get any errors hopefully now except now let's see how it goes let's go back to the John hi the points and gold do the calculations and Yi I think it's going but something something is a bit wrong here obviously yeah especially right here it's it's pretty weird what's happening here yeah it's I don't think it's correct at this moment let's see what's wrong with this yeah as a graphic it's fine but as a frost totally not okay it's totally not okay okay let's see oh yeah one thing I was missing is that um since I'm comparing the primitive lengths and I don't have AI haven't said any primitive lengths yet so let's set it measure got me use the measure node and get the parent parameter and override the name with length okay let's do that again go back still something is wrong yeah something's totally wrong here hmm let's go back I am going to pause this a bit to see where it's wrong okay I think I know where what's wrong I seem to have several sub branches here and that is because after I created the sub branch I haven't set any like flags for the main point that points on the main branch that you should you shouldn't have any more sub branch from already generated already used points and that flag is the fork which is set on this one fork you can see that there is a condition so yeah here if the fork is zero then create the point but then I haven't set it to 1 after creating the South branches so it's always 0 it keeps going with dr0 so it keeps creating a new branch from this point so that was the problem so for the end of around here let's get set set point ouch set point group to the name fork at NPT with one now hopefully this will do the job let's go back with the ray displayed on reverse and let's see and yes I think it went well pretty well I guess I'm missing some more variable because the angle is pretty much 90 degrees based on the main branch so I think I miss forgot to promote some of the angle I think let's check that out for this one I click here let's find this one if I click here it's still fine yes but basically this should be the place where it controls the angles it's oh yeah this is zero that's the problem now let's go back controller okay doesn't seem to be linked so I'll just copy this parameter go back here paste relative reference I'll just delete all the lead channel and then paste relative reference which will give me 60 okay now let's do the generation again yeah yeah yeah it looks more natural the angle looks more natural well this is a bit exaggerated it looks pretty good looks pretty good I mean it's still pretty straight from what I see what does making a curve a little bit yeah let me check with the growth calculations where it controls the angles so I have those step angle max lengths and Here I am rotating the angle with this one and please let me just debug by making this angle a bit bigger like 15 so for that it should give a really exaggerated curve let's do that okay play yeah it does it does curving so it's it does working now I'll just make it back to two I guess I would just need to reduce the size of the step for the step lengths for the sub-branch so that it will be less that will be more higher as compared to the main branch so I'll just multiply by 0.5 and now it's it's more natural I think yeah look much better look much better looking much better okay okay okay maybe I could also make a parameter for this mm I guess I'll go with this I'll just make it 0.4 just to make it more high-res and finally since this is just a curve right now I also wanted to make it as a 3d geometry like using poly wires so in order to use that I have to set some P scale for the scale on each point so I'm gonna first I'm gonna make a point R angle after the measure and name this P scale and apply peace P scale by 1a increment by 0.1 and let's reduce a clump and the P scale to be 1 by setting the filter piece if the piece scale is less than 1 then at those so the P scale will be stopped at 1 the maximum will be 1 the minimum will be 0 or 0.1 all right now after that that's not enough for the P scale I also have to do some modifications for the P scale based on the length on each point the length satrapy is on each point so let's do that okay make a point wrangle again outside the solver connect to the solver then be scale and this is how it goes this is also based on the Anton's algorithm I'm just gonna use the same one piece scale okay it's getting slow I'm just gonna save this equal x equal how fit length of the points and from 0 to 1 and point 1 to 1 and CH I need to give a channel for this one I think I'm just gonna give a one so I don't need to use a power after all mmm maybe I could use the as a powerful CHF XP XP and @p scale x equal a bit so y 1 mm and PT nom and point two point nine to one point zero which will kind of a randomized the scale a bit then Y scale equal clamp P scale by zero and one or 0.5 or something okay let's see how it looks like with the Polly wolly was just P scale okay let's play a little bit okay and connect a poly wire and the divisions for spine and the segment spine okay I need to use the P scale for the radius of the poly wire so I'm gonna use the expression here point LP input and PT p scale zero times something like point one yep looks okay I don't see any shadows right now so let's touch the normal to see how it looks like okay now it looks a bit weird on this like here so I guess the calculation is not enough oh I see why because the X a X P is right now zero so I have to make it be one oh yeah now this looks more like frost now the base might be two thing I could increase by multiplying here so I could parameterize this one as well so let's go here make a parameter thickness which goes from zero to one fly point five copy parameter and paste relative reference here that's good now if I could change the parameter here I could control the base thickness of te frost yeah that's it Frost okay now it's mostly over I mean what else I need to do let's just set the color for this frost maybe for this one is white is okay for the sphere let's say let's assume this is a bubble blue bubble under like light blue bubble Alps okay and wait merge together and I also need a normal for the bubble yes yes let's make it darker great so here it is a frost over let's start playing it I'm gonna pores and skip to where it caches all the frame all right let's see the results okay let's play yeah looks really like a frost still slow well so yeah this is it this is how I implemented the Anton's to defrost solver into 3d capable frost over basically it's pretty much the same for the core function called algorithm I just tweaked some of the calculations so that I can use it for the 3d and also I have removed some of the code as well to make it more simple although it took like three hours to explain yeah it's a long trip okay thank you for watching it hope I hope you learn something thank you
Info
Channel: Junichiro Horikawa
Views: 10,516
Rating: 5 out of 5
Keywords: houdini, tutorial, recipe, parametric, procedural, algorithmic, algorithmic design, design, 3d, howto, algorithm, vfx, mathematics, nature, vector field, field, frost, solver, freeze
Id: 4I3zVgGuSmw
Channel Id: undefined
Length: 195min 23sec (11723 seconds)
Published: Fri Aug 03 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.