Houdini Algorithmic Live #055 - Turbulence Morphing

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay testing all right uh can you hear me can he you all hear me hello hello everybody um [Music] let me just test this out hello hello can you hear my voice if you could would be great if you could let me know all right okay so hello this is horikawa and this is the 55th episode for houdini algorithmic life this is the weekly tutorial live that i'm doing for houdini uh based on the algorithmic design um concepts mostly using vex's vex coding to do several design related stuff including animation and modeling and today's topic is to create this more morphing motion graphics effect which i'm gonna show it right now using two geometry to morph between them through through a particle medium like these and i'm going to show you how you could actually create this kind of morphing effect going from one object to another just by using a vex code since this one is not using any solver or anything so it's not a simulation based stuff but it's based on a procedural process just using vex okay so that's what i am going to show you today all right from scratch all right which could be really like useful because it's not really related i mean it's not using any uh solvers which mean is that by using this one uh just to wait for a moment uh did this since i'm not using any solver for this one the good thing about this one is that let me see you can go back and forth let me just delete this to zero and this one to be so you can just use those like something like sliders or frame bars to go back and forth pretty easily without any like generative or recursive calculations so it's pretty easy it's pretty fast with the debugging okay and since this is procedural you can control the way it like blasts changing from one to another used by uh changing some parameters inside this code the main code for the moving it's not that long okay so i think it's pretty easy to understand what i'm going what it's going happening here right so that's what i would like to tell you today all right so let's do it from scratch i'm gonna stop by creating geometry node and also let me save this so that i don't lose the process okay enter a few less morphing so first of all i'm going to stop by single geometry to test out how i should move and later on i'm going to add another geometry to for the target okay initially i'm going to start with the single one so that i can use this as a both for source and the target geometry so any geometry is fine i'm just going to start with the pig head okay and the initial things that i'm going to do is to scatter a any amount of points on top of this surface or maybe inside using a volume node or something but i'm just going to use this scatter node to have a bunch of points on top of the geometry let's say i would like to have 10 000 points out of the surface like this now next thing i like to do is to i guess by using this scattering node you'll be able to have a point randomly scattered on top of the surface but just to make sure that it's really placed randomly on a surface i'm also going to use the sort node to sort out the points randomly okay so that you can move each point from a different like location to a different target so in for the final goal is to have another geometry like let's say rubber toy having the same number of number same number of points and using this different seed for random and going from those points one of the points corresponds to the points on the target and goes from one to another by using some turbulence related noise movement okay and we don't really want to move those points really nearly that which is pretty i don't know too simple and too lame so uh the goal is goal here is to how naturally you can make it to morph from one to another like a turbulence okay so let's do that i'm gonna keep the target as said here right now and i am going to use the point wrangle to move all those points okay so i'm going to connect the these sorted out randomly sorted out points to the first input of this pointer angle and let's name this curve lens noise and pretty much this is the the bex code or vector angle that i'm gonna use to do all the stuff that i need here for today for the stuff that i'm going to show you today okay other stuff is more of a visually related stuff to make the visual a bit more prettier but all the logics it's going to be written in here and that is all okay so let's start writing the code okay first thing i would like to do is to the things that i would like to do here is to start doing the morph from let's say from top to bottom or bottom to top or could be from right to left or left to right by doing it you'll be you may you'll be able to have a kind of a natural like steps so starting from top part it starts to dissolve into a like random particles or turbulence particles and slowly all the particles on the bottom will be affected by those top particles and after all those being all those all the particles on top of this pig head have been converted into a turbulence moving particle then slowly i would like to make it make those particles fit into the target geometry in this case the same pick head maybe from bottom to top or about top to top bottom again slowly start to show up the geometry slowly from bottom to top up top to bottom okay so what i need as an information initially is to have the bounding box information of this target or the source geometry in this case if i would like to move from top to bottom or bottom top i need the y directional values for this boundary box of this surface so what i'm going to use is to first use the get b box function to get the minimum points of the bounding box and the maximum points of the bounding box from 0 0 means it's the source geometry for the points okay so zero max and i need to create a empty variable for a vector for to store the minimum and maximum point positions of the bounding box okay now now that you have got the minimum position which could be somewhere around here and the maximum position which could be somewhere around here and by retrieving the y component of this vector you can get the minimum height minimum y directional value and maximum my projection value and you can use that to determine when those point should start begin to dissolve okay all right so to dissolve i'm going to create like a float offset value which is going to be used as a frame value when to determine when to start dissolving let's say i want to create its um morphing effect from the first frame to the end frame okay and maybe using a thirty percent off the frame to dissolve from top to bottom okay so thinking like that you can first create some values which is between one two in this case if it's thirty percent it's around sixty or seventy two frame somewhere around here okay so i would like to create a value from fret 1 to 72 and use that frame value to create a offset value so for the top part i want to dissolve or i want to start moving as soon as possible like at around one but at the end point on the bottom point i would like to start dissolving these points somewhere around 72 and do it linearly so if it's around 36 frame the middle part of this geometry is going to be moved okay so i'm going from top to bottom so thinking like that i'm going to create an offset frame value using fit based on the y value of the point position which is in between the minimum y and maximum y okay and let it be a frame value which is in between one two [Music] ah let's say one two [Music] this is around let's calculate this by the multiplication of and f and so fn multiply by some more thing let's say range or gradient range more thing gradient range so if it's 0.3 then at 30 percent off this and f f end which is 72 okay and let's see this is okay okay so i'm gonna start i want to start from the top part okay so maybe i should make it from top to bottom for a fit function then for the top part i use one and for the bottom i use this f end frame and multiply by the gradation range okay now let's promote those sliders and let's set it to 0.3 for now you can change this later and let's try this out if this value is really working okay so to do that i'm i'm just going to try to move those points based on this offset value okay okay so what i'm going to do here um let's see let's say i just want to move those points to the uh frame related value let's create a f value which is in between the first frame to the end frame going from zero to one by using creating a fit function it's in a frame starting from one to the end of the frame and set it to zero to one i'm going to use this one to together with this offset to move those points based on the frame okay so to do that i am going to let's say which is better i'm just going to change this one to offset okay so by doing this you can start calculating you can start having this f based on the y direction of this points so when the height is around at the middle it it's not going to have it the f values be kept as 0 until like 36 frame and then at around 36 frame then the f starts to raise up until the end so let's see if that is true i'm just going to check this out by let's say moving the all the points upward by f related value maybe f multiply by i don't know one is fine i guess suggest f okay now i think i should do like this just add a f value to the y so okay so if i play it you can see that uh gradually from top to bottom it moved like these from until 72 frame okay so using 72 frame or maybe i can multiply this a little bit bigger so that it can see the changes and maybe moving to the x direction might be better okay so check until from first frame to this 32nd frame you can see that the particle is shifting based on the height together with the frame values okay until 72 and after 72 all the geometry is moving at the same speed okay so this is kind of a technique that i'm going to use to start that set the timing of the dissolving or the small frame now you also have to do the same things for the end part since if you look at the end it stopped um at the same timing but what i really want to have is to stop by by i don't know maybe from the bottom to top just like i did for the starting using 72 frame to shift and at the end i would like to do the similar things maybe using this same 72 frame to start stopping from bottom to top or top to bottom somewhere around from 240 to 150 or 70. okay so to do that it's not that hard to do you can you just have to say add an offset to the f end for this fit function but this will cause the maximum like uh fn value or the frame end value to be 240 plus 72 so you have to subtract by the maximum of this value which is which could be this one so let's have this as a variable float red gradation range is this value here let's have this right here and also have this gradient range here now let's see what's going to happen now for the first 72 frame it's shifted like these and at the end you can see that from top to bottom it's stop start to stop shifting okay just like that let's make this like 100 frames so that it's easy to debug like this now instead of my instead of adding these values you can also subtract uh directly subtract the offset in that case you don't really need to subtract but the gradient range so in that case what would happen is that it stopped from top the bottom looks pretty much i needed to apply so in this case starts from bottom to top so either way it's fine what i like is adding the offset and subtract by the grade range since the total movement value is the well kept the same in this case okay now that's the proof of concept now having this um information now i can start to have a bit more um turbulence related uh vector values or forces to move the points and to do that i'm going to create some rotational values to rotate the geometry uh initially and then try to add some noise onto it onto the rotational angles as well as the some moving back and forth from the center to have to i add a little bit of like noises okay based on this f value right so let's do that first of all in order to rotate the points i'm going to rotate the points based on the center points of the input geometry so i'm going to get the bounding box center points first by saying vector center is equal to get v box center which is going to be the center point position okay now i am first going to [Music] what i'm going to do next is to calculate the distance from the center to each point and since i'm going to basically using the y-axis to rotate the geometry in this case what i would like to do in order to calculate the distance i'm going to just i would like to just calculate the distance on x z plane and i do i don't want to consider the y directional distance i mean it could work but that's what i would like to do big because i'm rotating based on the y-axis i i really don't need the y directional distances so in order to ignore this y direction distance is only considered the xz plane distance i'm going to copy the current point position like this and then set the y value of this current point position to the same y value as the center of this geometry so that all the points that i have copied will be flattened to a one x z plane if you like to check that it looks like this okay so it's been flattened like this and from here i would like to calculate the distance from the center point to each of the point and that is going to be the distance on the xd plane okay so float distance is equal to distance position flattened position and the center hey now um [Music] and what i need what i would like to use this for is to for the angle for the rotation for the rotation in order to move in order to morph the geometry okay i think i have some errors here so this is equal to distance okay so let's calculate the angle i'm going to start by creating some simple angle values stop by a pi multiply by 2.0 and maybe multiply by f value okay in this case the the angle will be set from zero to a two pi from the first frame to the end frame okay now let's try to use this angle to rotate the points i'm going to start by creating a rotational matrix start by creating identity matrix then we'll use the rotate function to rotate the matrix using the angle and the y-axis and then multiply this matrix to the points to see how the rotation works based on the f value okay so let's set this set the real time toggle so as you can see the geometry rotates from top to bottom using the 30 off the frame and then goes back to the the target geometry which in this case the same geometry from using this 72 frame like these all right now what i could do is to try to use this distance value to this angle somehow to see what kind of effect could it give so if i multiply this distance to the angle right here start c some okay maybe okay there might be a little problem because if i use this distance as it is for the multiplication it's not going back to the original geometry so that's a bit of problem so let's try to avoid multiplying this distance right here but use it for other purposes later okay okay now at this point i might also want to control the timing of the rotation it looks a bit um hard when it starts especially the edge of the rotation when it's rotating and it's not not still not rotated you can see the change when it starts rotating okay so i might not like that so let's try to have a little bit of like uh dissolving like smoothness uh when to start the rotation currently there you can see a line when it has started the rotation but what i want to do is to have some kind of blur blur out the points to pick random points near the edge which one to rotate and which one not to rotate okay based on some threshold so to do that i might need want to use some kind of um random values for that so let's see what i could do here okay so to do that i think what i could do let me think i think i can basically the these offset the rotational offset or rotational shifting is done by using this offset value right here which is in between 0 to i mean 1 to the frame value multiplied by 0.3 in this in this case now i could try to add some random values to this offset value like random values in between 1 to 10 and 1 to 20 to this offset based on the i don't know the point position seed then in that case you basically the base rotational line is at this point 72 frame right here but by adding some constant random value okay in this case 33 by adding some constant random values to this offset for each point you can kind of have a blurred edge where it's where it starts rotating okay so that's what i would like to test out here so to do that i can add some random related values around at p and multiply by the maximum offset or random offset range so let's have this as a parameter small rand offset let's make this 10 for now okay now that the each offset value for the point has been changed even though the even when the y value is the same the value has been offsetted a little bit based on this random values right here i need to go back to this one right here as well to subtract by the maximum of this random offset because in theory you are going to add maximum 10 to this offset so you have to subtract by 10 for the final target or final goal for the fit function based on the frame okay now if i try to look at here you can start to see some a bit more smoothing out dissolving you see there you no longer see the edge after rotation anymore but you you have to you start to see random points going to pick you still have a top to bottom like shifting but you by having this random values right here are you uh kind of see this dissolving edges edge of rotation so by making this smaller you have more smaller blurred edge if you have a few frame then setting this to a small number makes sense if you have like a longer frame to do a more thing he might maybe having a lot of frames for this random asset might make more sense in this case around 5 to 10 might be good if it's 100 frame in total okay that looks good and as you can see it's going to rotate from zero angle to the two pi which makes it go back to the same position so it i think it is always a good idea to make this angle a multiplication of 2 pi which is 360 degrees so i can have another parameter here as an integer like as a rotation value rotational like cycle let's name this red cycle so if it's one it's two pi if it's two it's two pi and so on i mean if it's one it's two pi if it's two it's four pi so if you have five then you have five multiplied by two pi which you have tons of rotations okay let's set it to one or two for now okay two might be a good so it's start to have some effect that i'm looking for right here now it still have some kind of a linear rotational effect in terms of the speed of the rotation so next thing i would like to do is to control the speed especially for the starting and the end part okay to do that i'm just going to use the ramp parameter to control this f value right here so at the start i would like to make the rotation slow and then becomes faster then becomes slower again to make it to the gold hog to the target particle so f is equal to ch ramp to create some run parameter to map this f value which ends in between 0 to 1 let's make it a busier a b spline and create this kind of curve so initially it goes slower then goes faster then slower again now let's see what happens first is go slow and stop slowly if you want to exaggerate the effect you can do something like these which could also be good but i'm gonna keep it like this just a little bit of curve okay starting starting to get a bit more natural here all right now one thing i'm still missing is a bit of a turbulence noise so the next thing i would like to do is to add this eterbiums lated noise and this is probably where i could use this distance that i've calculated previously okay so let's try to do this and to add a turbulence noise i am probably i'm not going to touch the angle itself but instead i'm going to try to move the points inward or outward using the center point direction center point position together with the current point positions maybe creating a vector in between those two points and using those vector using this vector to move the points inward or outward after i have rotated the points okay so let's try to do that okay so to do that i'm going to create some directional value which is from which is to [Music] let's say i'm going to calculate the direction from the current point position to dip from the center to the current point position like these and let's also normalize this oops okay and then multiply this by some value in order to move out to define the distance how much i want to move those points on outward inward okay and probably when the frame is at the one or a frame at the end you want to keep the distance to zero you want to make the distance value for the direction to be zero so making some kind of mountain like curve like a sine wave curve a sine wave value might make sense for this for the multiplication value for this vector value so based on the f value right here which is going from 0 to 1 based on the frame value i would like to first create a angle value for the sine function so let's say s f is equal to [Music] a f multiplied by pi and if you have this angle as a for the sine function you'll be able to have a value going from zero to one and going back to zero okay like a mountain all right so let's try to directly add multiply this to this direction and also add this direction to the point and see what happens so so when it's rotating it inflate the geometry and then goes back to the same target or the source geometry now the base is okay now but uh just inflating this point with the same direction of same distance for each point is not that interesting so let's try to use several like values to make it more natural or make it more turbulence like noise okay so first thing first is to use like a noise related value which could be really straightforward so let's name this noise alt or noise valve using a noise function based on the point position and this point position is the moving point position based on this matrix so after the point has been rotated by this rotational matrix i'm going to use that rotated point as a noise seed but uh i'm also going to uh add another seed value which could be a point position at the same point position but the one that is not moving which is before multiplying this matrix so let's try to have a copy of point position again let's name this vector c pass just like i did right here vector c passes at p and this is the copy of this point position which hasn't moved yet and now i'm i would like to use that cpos as a seed as well and for this one i'm going to multiply with the high value which will create a bit of like higher noise or higher or more dense mountain value from zero to one okay and then let's try to multiply this multi or noise value to see what happens okay so this is currently the result multiplying this noise value if i disable this one let's see what happens you see a bit more inflated look like looking like value but by having this noise value be able to have a bit of noise surface now if i try to dis disable this one c pass let's see what happens you still see kind of inflated surface like these which might not be really fun for myself so that's kind of a reason why i added this additional seed value right here and the reason why i'm using this position which is not moving as a seed is because if i try to multiply this point which is moving then when animating you have a lot of jittering or you have a lot of the movement of the point becomes not smooth anymore you see so this point position is kept as multiplied by one to make the movements smoother and this c pass multiplied by 100 is to make the initial uh the state of the points to be randomized like these so this is for the animation this is for the the the state the current state since this cpos is not animated based on the frame that's the reason it's possible why it's possible and the animation becomes smoother in this case now i might no i might want to move in an inward as well currently it's going out with it only so to make it in go inward as well you can subtract this noise value by 0.5 so that the the range of this noise value becomes from negative 0.5 to positive 0.5 and becomes much better right now at this point you can try to have or you can try to use this distance value that i have created a long time ago and let's see how i can use this first thing i could try is to multiply all these noise values by the distance and see what happens this kind of exaggerate the outline of the geometry which could be interesting without the distance let's see what happens without distance becomes more random issue with the distance you have a little bit of sharpen edge okay maybe i could try using a power function to exaggerate more to have more edges or make it a flow value like 0.5 to make it more blurry blurred edge which is not that effective my comment so maybe after all i might not need this distance yeah maybe not maybe that was unnecessary things to do so let's comment these out having less line of code might be better so let's just comment these out okay now starting to look good um and at this point you can like try to if you have if you want to have more like more of a random like values you can add a different kind of seed to this one or you can additionally add like another noise value based on the different scale of the see pause or pause multiply by i don't know 10 something let's see what happens some more randomist values random-ish morphing will happen it really depends on what kind of uh one thing you're looking for but i'm gonna make it simple i'm gonna go with these setup looks good enough for me now that is for the sort that is when you have only one source geometry but the goal here is to move from one geometry to the the gold geometry the target geometry like these so and let me show you how you can do actually do that using the same technique written here i would like to go from this pig this rabbitoy somehow so i'm going to connect i first going to create a geometry and then have the same number of points well it doesn't really have to be the same number of points but um it is better to have the same number of points if you are if you want to use the whole number the the every number of points right here to morph it to the target points and then randomize the point order so to make the point number the same i'm going to copy this parameter and then just paste it right here right and also let's move this revertoy to the same position of this pick target in terms of the center point so i'm gonna move this somewhere around here make this a little bit bigger like these okay looks good now basically what i'm gonna do is pretty simple i am caught i am doing i'm going to calculate the same rotation and the movement this is the rotation this is the translation for the pig head but i'm what i'm going to do is to sit do the same rotation same translation to this point set as well okay and then and then i am going to just learn from or interpolate from the the first point set to the target point set based on the frame values again okay pretty simple so let's try to do that okay so i am going to delete these delete this one and to do that i do need to get the point position from the second input okay so let's first do that i am going to going to the top going to call get retrieve the point position from the second input at the same point number now there is a chance that uh there the different number of points are supplied for the first input and the second input so to make sure that all the points is going to be used i'm going to calculate the remains based on the total number of the points from the second input so in this case in this way even though you have more points on the first input you can somehow use all the points uh from the second input and if it's goes over the maximum points from the second input you can go against restart from point number zero and use that for the target for the remained points okay now now that you have got the point position from the second input i do need to retrieve the minimum and maximum y value for this target geometry as well okay so pretty much i'm going to do the same things i did here right here for the second input so i am going to name this name the second set n min and n max and use the get v box from the second input for n to fill in the n min and then max okay no so if i have these values then what i need to do next is to have this the same things that i did for the first source geometry i need to create the offset values for the second target geometry as well so basically i'm going to copy these two lines and create another offset for the second input for the target geometry and let's name this n offset using the point position from the second input which is n pass and n max and min y and the gradation range you can just use the same one so i'm gonna keep it like this and an offset is the random of and pause multiply by the brand offset parameter okay so now i have two random offset value or frame offset value okay like these now next thing i would like to do is to somehow use this an offset value for this f value and where i should change and to do that the place i need to change is this the target offset value currently i have offset value for the first value source value for the fit and the target value for the fit function now for the target fit function i would like to change it to the target geometry so this is where i should change this offset value so from i'm just going to add n and i'm just going to change this in offset so that the the offset value for the target geometry is going to be used for this target value for the fit or the frame value okay now let's go down and see where i should change and the next thing i like i need to do is to do this similar um trans forming like i'm doing for the top for the source geometry right here the rotation and translation i'm going to do the same transformation for the the end pause the position retrieved from the second input as well so and pause multiply by the matrix and then and pause that direction just like this all right now probably uh currently i'm just using i'm just using the center point from the source geometry so if you want to [Music] it might be better if you would it might be better to create a center point for the second geometry for the target geometry as well if you want to make it more based on the target geometry center point if the center point of the first source and the second target geometry is different then you might want to create a different directional value for this one right here you might want to calculate the different center point in that case vector and send let's get v box center from the second input and then let's see where i'm using those center where is it which is somewhere around here this one direction okay so i can just say i can copy this one and let's rename this to n direction and end pause subtract by n sen and all the other value is the same now this noise value is also based on the current point position so maybe i can also make this based on the second target geometry so end end noise value is n pass with the c pause is based on again the current point position so let's have nc pause and pause so i'm gonna change this to nc pause all right so looks good and i am going to add this and direction today and pause now visually you cannot see it yet but what i did is to modify this target geometries or target position target point position just like i did for the source target source geometry source point geometries okay so meaning i have two set of points moving like these now what i need to do is to learn between those two geometries going from the peg head to the rubber toy by just using the lerp going from the current point position the source point position to the end pause using like f which is in between zero to one to change the value okay and let's set it as the current point position and let's if i play it with this comes from big head to rubber toy like these okay and if i move this to the x direction i just think it should still work now i'll let a bit of weird rotation happening but basically it should work with any geometry at any positions if i change this to some other test geometry like i know squab should still work i select these okay looking good now if i try to change some parameters that i have set and let's say like the rotational cycle to like four you have more rotations to change from one geometry to another if you change the round offset you have more dissolved gradient edges if you make it smaller you have a direct change the morphing gradient change will makes it be able to set how much of the frame is used to dissolve or to move from top to bottom okay if you just make it like 0.1 most of the geometries or most of the points is going to be moved at the same time and it's all done procedurally so you can just go back and forth in real time without like generating any like simulations or anything okay so that's i think that's the good part of this setup okay i think i have a problem with my mouse it's not let me okay my mouse is not moving right now let me check the battery okay somehow it's moving maybe i need to clean this up a little bit let me take this ball out okay so i hope you get what i meant here on how you could create this kind of a procedural turbulence morphing effect from one geometry to another which wasn't that hard i believe [Music] okay yeah i think and now let's try to make a bit more prettier by having uh creating some trail edge trail for the rotation and also make these moving particles with a sphere or something so first of all i'm going to create a trail using a trail node and let's have this like five four six let's increment 2.5 polyline maybe that's too long okay maybe that's too long let's make it point one and also let's have the points which is going to move as a sphere i'm gonna make it as a polygon make it one frequency make it really small and let's pack this as well and then use copy two points okay i cannot see it so it's raised up okay and all right maybe the point is a bit too big okay and if i play it looks good maybe i can increase the trail length a little bit bigger and let's also set the color of the trails based on the point number on the primitive just gonna use to get the point numbers from the frame primitive and then set some value for the coloring as an attribute to each of the point set point attrib zero let's say u at ptsi with the i divided by the float of lengths bts minus one okay now i am going to color these points based on the value do i have this color i'm not sure let's make this blue okay dark blue used to be light blue let's just keep it white okay just like that and if you raise up the end frame like 200 you have more slow moving frames and since you have a noise related values you you start you are seeing some turbulence like moving in between the morphing during the morphing which is interesting i guess and if you go back to the code the main code right here you could probably add some um additional like noise value maybe for the angle to have a little bit more differentiated angular speed uh to do that you do you still need to make this as a multiplication of two pi at the first frame and the end frame so what you could do is to let's say add angle use the same technique that i use right here using the sine function to create a wave and then multiply by some random related values around at p or yeah p is fine at p multiplied by i know the radians of 60 or something let's see what happens and then i am going to add this angle to this one so in the first frame and end frame this add angle becomes zero so that the end frame always be used will be the multiplication of 2 pi but somewhere in between the 0 and the last frame you have more randomized angle right here which will create a bit more randomized speed rotation which could be interesting is this without this at angle let's see what happens if i multiply with zero this is without that angle and if you multiply by i don't know by one let's set it to like 120 degrees you should be able to have a bunch of different angular added to the points to make a bit more more of a different speed turbulence particle movement yeah i guess i like this all right uh okay i think i have a question from celebrate sale paid what's the reason for the pack stop on the sphere uh the reason is because to make the the previewing faster without the packing it's become slower because you are having all these geometry be calculated for the transformation but by making the pack geometry or pack instance you only need to calculate the single point transformation for each packed change transformation so makes the preview much faster so that's kind of reason since i'm just using the same sphere for all the points it doesn't really matter if i packet to make is an instance if you want to like deform the point position of the sphere then you cannot use this pack but if you just using this constant sphere as uh this the moving particles then maybe just using pack for those uh tons of points might make sense okay so this is pretty much it that i wanted to show today and only maybe as an additional thing i could show you is how i could switch between this pig head and rubber toy and go to the since for the first frame it uses pick head at this point and the end frame it changes to the rubber head but from the next frame i might want to change the first frame i might want to change the first geometry to the rubber toy and then go to the uh pig head on the next frame and for the next target so switch between these two geometry based on the i know the timing first time you have a source as pig head as a source and repertoire as a target but next time you calculate simulations you might want to have a rabbatoy as a source and pick it as a target so let's see how we could do that and to do that i believe you cannot just do it with a vex code but you have to have some kind of um i don't know the the external coding like python or something so if you are interested in this that kind of stuff i could try to do that as well try use the python to switch those source and target based on when it has reached based on the count number of how many times it reached to the end and to the go back to the first okay so this is just a try out that i'm going to do now which not sure if it's going to work or not but let's see but basically what i wanted to tell you what i wanted to show you for the turbulence uh morphing is just it it just is done like this and this is all the this stuff that i really wanted to show for this week's tutorial okay and if you are if you find these things interested i'll appreciate if you could like the video and i will upload the created file later to this video description page of this live video so you can download the file from there i'm gonna do that as soon as i finish this live tutorial and um if you like to support me then there is also a patreon page of my mine uh you which you could also go from the video description page so if you could support me that would i would also appreciate a lot anyway let's try to switch the geometry using a python yeah i like this stop motion at all how's that looks good all right okay so let's the things that i'm going to use is to first create a python node connect it to the end and i'm gonna name it as count up and this one and what i would like to test out is to how many times it reaches the current frame has reached to the end okay so as soon as the current frame reached to the end frame which in this case 200 then i would like to have a global variable of the python to be counted by one okay and i want to use that global count value to somehow use it for the switching variable to determine which one which comes which for the source geometry okay so the first thing i need to do is to check the current frame value and the end frame of houdini and i am not sure how you can get the global variable off this houdini from a python so what i'm going to do is to if you know uh please let me know but it since i don't know how or there's maybe there's a way but what i'm gonna do is to create a channel to have the value that i would like to retrieve which is the current frame and the frame end let's also have a integer parameter named as count which is going to be used to switch the geometry okay now now the current frame since this is a channel i can just use this expression like dollar f which gives you a current frame value and for the frame end you can also use the dollar f end to get the current frame end value and inside python you can have these value using ho or who dot eval firm to get the frame from the channel and the frame end from the channel okay now and what i want to do and what i want to create is the condition if the current frame is equal to the f end then i would like to count these value up by one okay and i think i can just count this value from the evaluation maybe i don't really need to create a global variable after all so to do that uh first of all i would like to create the conditions if the frame is equal to f end then first thing i would like to do is to get the integer value from the count parameter so just like i did here count is equal to count these and then i'm going to add the count by one increment by one now i would like to update this channel by this updated count value calculated right here so to do that you first need to access to the parameter object which is named as count and then set this count value okay now this should work if i play it and if it reached to reaches to the end hopefully the count will raised up by one okay if i stop the estimations it the account becomes raised up by one now while i'm playing it doesn't really show up the counted up values in real time but hopefully this is changing even though this is not visually effective if i stop it you can see the counted value like the right here so probably i could use it on real time as well not sure let's see okay let's reset this to zero and let's copy this parameter copy this parameter going back to right here and i'm going to use the switch node to switch between this one okay like these so for this one um i'm going to set it as zero and this one is going to be set as one if i set this one you get the rubber toy if i set this to zero you get a peghead okay like these so what i want to do is as soon as you have uh you have count value raised up by one you want to change this input selected input to a the different value if it's if it was previously zero then you want to change it to one then if it's previously one and you would want to change it to zero that's what i would like to do here based on this count value that i write here okay which i have copied so let's see if i could do that first try i'm gonna just paste the count like these and for the second one i'm going to add by one okay and what then would like to do next is to let's see more calculate the remains by two this one as well calculate the remains by two so if the count is equal to zero then for this one you get zero for this one you get one if the count value is equal to one then for this one you get one you get zero for this one and then becomes a zero in the next frame again now let's see if this is going to work first change to the from repertoire to okay i think it is working isn't it yeah so rubber toy to pick head pickhead to rubber toy yeah i think it's working isn't it all right that was easy okay since this is working i might be able to do i might be able to switch between multiple number of object so let's say i would like to add like the third geometry okay connect it like these in this case maybe i could calculate the remain by three let's see what happens okay finger crossed starting from pig head to the rubber toy the rubber toy to a squad and squad to [Music] okay it did work all right that was easy okay so that's just it you can use this python code to create to i don't know the modify the channel itself to have channel value itself to have this conditional switching based on the how many times it reaches to the end which i am not sure when i i cannot really imagine the situation when could this be useful but it's just a play so just the proof of concept concept okay so that's probably just it if you have any questions let me know if not i would like to end the uh streaming at this point if you have any idea addition to the one that i have shown here i i would love to try that out if not let's just end this i think i really do like the effect that i've created like these let's try to make this color a little bit bit well just black and white is fine since this is really a simple setup setup you can try to modify these numbers by yourself maybe you can try to modify the axis for the rotation by yourself to see a different kind of moving which could also be interesting currently i'm just using the y direction as a rotation axis but could be any the rotational axis can also be randomized as well which could all which could be really interesting as well maybe i would like to try that out as a last try last time um where is that this one right here okay so i'm currently just using the y-axis but you can try to randomize this one somehow maybe using the axis with the noise function probably based on the point multiplied by some speed or smoothness of the value and then divide by 0.5 for x y and z and then use this as a rotation axis and see what happens i'm not sure if it's going to be good or bad okay i think i'm missing something i think i am missing some thing not sure where doesn't really show where that is okay axis is it right here set zero one zero nope um this one nope okay i am lost where i did wrong okay let me just go back to where i have added the axis okay let me recreate the axis axis set the noise at p multiply by two axis set point five point five and point five and replace this rotation axis with this one and see what happens oops wow um okay interesting maybe i should make this much higher value all right maybe it's not that good as i thought nope not really maybe what i could do is to you based on it's pretty much based on the y-axis but just add a little bit of noise to it and that might give you a little better result and let's set normalize this so basically it is y direction but adding a little bit of like noise on different direction which in result gives more y-oriented but turbulence like rotation okay yeah i like that if i multiply by point five yep yeah i like it like the setup all right looks good okay that's probably it okay so thank you all for watching this is all um that i would like to show and i would like to do another weekly tutorial next week at around the same time as well so if you are interested in this kind of thing this kind of algorithmic design stuff then please try to join and give me any feedback you felt would be appreciated okay so i'm gonna upload the files as soon as i end uh live and you can download for the video description okay okay so thank you thank you all and see you next week bye
Info
Channel: Junichiro Horikawa
Views: 8,586
Rating: undefined out of 5
Keywords: houdini, sidefx, live, tutorial, procedural, procedural modeling, parametric modeling, parametric design, parametric, fabrication, digital design, computational design, 3d, design, isosurface, lattice, structure, 3d modeling, modeling, computational, generative, line drawing, drawing, illustration, fractal, reaction diffusion, celullar automata, simulation, trail, particle, vfx, mitosis, magnetic field, magnet, field, volume, rendering, computer graphics, visualization, algorithm, motion graphics, graphics, voxel
Id: EinxGdGTQcM
Channel Id: undefined
Length: 92min 34sec (5554 seconds)
Published: Wed Apr 07 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.