Motion Blur Deformation with Vex - Houdini 16.5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this lesson we are going to explore using the dot product to create a stylized motion blur deformation effect in Houdini and apply it to a mix America will prep our mesh with some of the modeling tools and then dive into the world of X & Y end up with a hopefully somewhat usable user interface in the end so grab a coffee or a burger let's hang out and enjoy some quality computer time for those of you who are looking to follow along with the model that I used the model was obtained at Mick Simone I'm not able to include the model with the downloadable file because it's not okay for me to redistribute it but I can tell you how to obtain it so you go to mix mo create an account if you don't have one and then you should have something like this there's a characters tab in animations tab under the characters tab we're gonna search for Maria and we want Maria with prop JJ um click that one proceed use this character cool and there she is and then we go over to animations here and we search for sword and then the one we're gonna want is this great sword slash and there it is and then you just want to click download and I chose an FBX file just the first one there and hit download and there you go alright so first things first let's import our mix mo character so we're gonna go file import film box FBX and here next to my hip file I have made an FBX folder and put the FBX file in there I'll hide accept and import and here it appears with a new sub-network if I hit spacebar F it'll frame up the character and scrubbing the timeline we can see the animation I could play to and there we go it's pulling back a little bit fast and going to go down and lower right here and hit the real time toggle see it playback at 24 frames per second excellent so that's the sword slashing animation what we'll do is we'll kind of do a little bit of work to clean up this sword and then we'll apply our effect to it so let's hop inside here now here's the rig and it's kind of get that out of here the rig is kind of scary at the moment but this is just literally all the bones and joints that make up the body and that make up the character and what we're interested with is this little section over here we've got this which is actually the character and if we go up and over here this is the sword now what I want to do is we've got this part of the network here which is really bringing it back into the animation I want to start from this point right here and we can do a little bit of work I'm going to turn off the texture you can see that this is pretty triangulated at the moment I'm going to just build out build this out in into some quads so that it works a little bit better with our effect so let's first do a poly split I'm going to come out to the end here I'm gonna turn this on flat wire shaded and I'm going to type I'm gonna hit the C key go up to model polygons poly split and we're gonna start here we're gonna go to there and I'll hit enter and that should have made a split for us there I'm gonna hit the W key to go into wireframe mode and hit the D key and turn this to dark under the background it just makes it easier for me to see and then I'm going to hit C go up to model polygons poly split again and I'm gonna anchor on that point and split over to that point and hit enter again alright so now we've sort of quad it off this section here the next thing I'm going to do is get rid of these big triangles that are going along the sword so let's switch to edge mode selection I'll grab these two and that one there and that should be good and I'll just hit delete and you can see what it's doing over here is because I had this node selected when I started doing this it has it has effectively been you know building off of our network when I'm making these non procedural edits so let's continue I just want a bunch of quads here because we're gonna be deforming this and it needs you know the more the merrier so let's do an edge loop I'm gonna type tab edge loop there we go and let's start going in this direction I'll just put one in anywhere and then hit enter and it's made a poly split for us again I'm going to crank the number of loops up to let's do like let's do 100 cool and then let's go up to the top here and add some more edge loops around the tip same thing hit tab type edge loop and we'll put that there anywhere is good it select it over here crank this one up to 10 that's great then let's do some edge loops along the length of the sword so I'm going to again edge loop and we'll do in here or actually before I do this I'm gonna delete that one before I do this I'm going to actually delete this top part so that the loop can pass over the tip of the sword so I'm just going to switch I'm gonna switch I'm in edge selection mode I'm gonna grab these three edges and hit delete you can see it's dropped on a dissolve known and if I hit the W key it's got a primitive face that it's put here at the end for us so at least I can do when I do my edgeloop operations I just only have to do two of them instead of for now all right so let's go back to loop and we'll start here and then I'll select the poly split crank the number of loops up to let's do something like yeah that looks good we'll do seven and then tab loop again and we'll do it the exact same thing over here select the node and set this one to seven so now we've got some pretty nice squatted stuff going on over here I'm going to just hop out to the end here and what I want to do is just fuse the tip together back together so that should be good before I do this though I actually want this to be a little bit sharper and if I fuse this tip it's going to kind of come to almost like a duller edge so I'm gonna pop all the way back up to this dissolve where I right before the dissolve where I where I deleted the end off of it and if I select this poly split right here I should be able to continue to work on our network and hopefully it'll all work out but I'm going to grab this edge I'm going to go into edges mode alright so I'm gonna go out here I'm gonna go back and hit W go into wireframe mode so I've got my edge mode I'm going to hold a middle mouse click it does the loop selection I'm going to type tab edit and then I'm going to slide along that edge there and it looks like it actually slid along the surface without me having to say anything about it which is that's fine but I just want to bring this out so that it makes a nice sharp and so when we delete this last portion and then we finally use its vit we end up with a very sharp result so I'm gonna go back to the dissolve yeah I think that's getting rid of this and then let's go all the way back down here poly split fill okay that's good yeah and you can see that it's that it has maintained that nice really sharp edge all right cool so now I'm gonna just grab points so select points Mon I'm just gonna select all the points that are clustered at the end there tab and type down fuse it's gonna drop a fuse and if you look really closely when I cranked up the tolerant of the distance on this fuse until all the points collapse into one and there we are okay so I think that this is good enough for right now and we'll just simply let it go through the rest of its network we can always come back and change some more if we need to yeah I'll put down a null down here that we can refer to and this will be called out sword awesome so now let's create a new geometry Network and import this this model into and we can do all of our stuff in there so I'm going to hit tab and write GL for geometry and we'll call this mo blur deform ER and let's hop inside don't need the final node it's merge oops not not regular marriage we're gonna do an object merge and we're going to grab inside of the great sword slash FBX we're gonna go down so we can see our Maria JJ um I'm not sure how that pronounced that I'm gonna grab this one and accept and then we'll make another object merge I'll just option drag that off to the side and then we will select the sword sword accept and for both of these I'm going to select into this object to transform into this object and then we can merge them together to view the result of both of our sections imported now I'll turn off wireframe mode and if we hit play yeah our geometry should be in here and everything is looking good awesome I'm gonna just set up a couple groups here so that we can easily you know discern between what part is the body versus what part is the sword so let's put down a group and over here we're going to group and call this group the body group and then this group over here which will be not the body group but the sword group and awesome so now that we've got that all merged up this is actually because Houdini is in units of meters this person is gigantic so I'm gonna throw down a transform and bring it back down to sort of Houdini scale and the size that I found that represented that the best was 0.01 a hundredth of the size now she's back to being the right size okay and so now we've got motion we've got our moving the next thing we need is we need to get velocity information we don't really have if we look down at our attributes here or point attributes we've got normals and we've got position you can see the normals like so if I hit the D key and turn up the visual on the guides my normals are scale at the point - I'm just going to turn them up a bit higher so I can see them and there they are so we've got our normals and but we don't have a velocity vector or velocity vector is usually here so I'm going to do is I'm going to set up I'm gonna throw it on a trail and why are that in here and activate it and instead of trailing I'm just going to compute velocity and if I turn on this this little icon right here display point trails you can see it's actually kind of making a nice you know trail with the motion I'm gonna do that cool all right yeah so you can kind of see where we're headed with this what we could do is we could do something like say however fast I'm moving I want you to move me back by a certain amount of my velocity so let's get started doing something with this let's just throw this is mostly gonna take place inside of a wrangle so let's throw it on a wrangle and why are that in and we've got our you know velocity attribute here which is cool so let's try to play around I'm going to turn off this vector real quick and then we will type let's just create first off a global multiplier to kind of scale the effect so we'll do a float mult and set that equal to float channel global multiplier and hit this little button here it'll create a slider for us doesn't do anything because we haven't told it to do anything yet so just to kind of get some sort of feedback let's move each point along the velocity vector by a multiplier that we've defined here so let's go down here and say yeah P minus equals at V times multiple enough and now if we grab our multiplier you can see with these whoops with these velocity vectors when we start to scale this effect you can see that it's actually pushing all the geometry back until it gets looking really ridiculous but in the direction of the velocity vector so you could if you're if you're after something really wonky and weird-looking I mean you go with this I mean that looks pretty great right it's just wobbling crazy mess of a person and you could do if this is what you're after you know it's you know time for sushi you're ready to rock but let's try and dial this in a little bit to make more of a actual motion blur effect so we're gonna go I'm gonna bring this multiplier down for right now so let's pause on this first slash here and kind of analyze things a little bit so we've got our velocity trails and we've got our normals now I'm going to just change the view of the velocity slightly so that we can actually view forward vectors is alongside our normals and make them slightly different colors so I'm going to turn off the velocity trail I'm going to come down here and right click on this little visualizer and under scene I'm gonna hit the plus and add a new marker in order here I'm gonna call this velocity I'll give it a color of let's say orange and we're gonna select the attribute V and then that will create that's creating text we don't want text it's just writing out the velocity vector we're going to actually add a a vector and it's pretty big so we'll just bring the length scale down to something that makes a little bit more sense excellent so now when we go over here and then switch this to wireframe mode you can see that we've got a bunch of velocity vectors that are pointing in the direction of motion and we also have normals that some of them are pointing away from the direction of motion and some of them are aligned with the direction of motion and we can actually use this information to determine you know we can say you know hey if you're if you're that leading edge that is going in the direction of the velocity I don't want anything to happen to you I want a nice clean leaving edge but behind if you're facing away from the direction of motion I want this to be a nice stretched out I want this to be a nice stretched out value so one way to do that is to use a dot product the names aren't scary but it's a lot simpler to use in practice basically what it means is if the two vectors are perfectly aligned with one another the dot product yields a value of one if the vectors are perpendicular to one another you'll get the value of zero and if the vectors are completely facing away from one another you'll get a value of negative one so what we can say is hey if the dot product is less than zero I want you to deform it by some amount of the velocity let's write it out so we're gonna create a new variable for for a normalized velocity it's gonna be a vector we'll call it NV for a normalized velocity and it's going to be equal to normalize the V attribute then what we'll do is we will create the dot product and we'll say the dot product will give us a float value so we're going to create a float and it's going to be dot it's going to be dot is equal to the dot of and V and at N and n should already be normalized so alright now that we have this let's plug that it I'm gonna take this value we're gonna bring it down here and we're gonna say V times malt and basically our dot product is gonna be acting as a multiplier up on that so we're just gonna multiply this all times dot so now if we zoom away you can see our global multiplier when we start applying it it's actually starting to deform this it's starting to deform this sort but it's doing it kind of in a way we don't want to remember we were saying before that we just want to affect the edges that are moving away from the direction of motion well we have to kind of clamp this off so to do that we're going to create a new variable called mask and the mask is going to simply be the clamped value so when you put down a clamp function that basically takes a value which we're gonna feed it the dot value and we're gonna say limit the amount of the dot value to be but within these two numbers and that's going to be negative 1 and 0 so anything that's over zero is gonna immediately be cut off to zero anything less than 1 there won't be anything less than 1 but if there wasn't anything less than 1 it's going to max out or minimum out at negative 1 all right let's do that now instead of using our dot down here we're going to just replace it with our mask and now when we multiply you can see that it's actually starting to move these sections of our sword back a little bit you know if we come back here let's crank the multiplier up a little ways and let's let's play this out a little bit and see what it looks like you can see it's starting to generate what kind of looks like a nice motion blur effect now it's kind of Jaggi over here if we go back to our initial slash you can see that it's kind of you know we've it's got messed-up stuff going on because if we go back to our undeformed surface there's like our normals are going in all sorts of different directions around here you can see that they're kind of splitting so we're gonna do a little bit more work on this sword to smooth this out so let's go back up here if I grab this sword out sword I'm going to just hit this little arrow key to jump into that Network ok so where were we the last thing we really did was we fused our sword I'm gonna just move this over here so let's turn off these normals I'm going to actually I know leave these on so what I'm gonna do here is you can see our normals are very much oriented to these surfaces of this sort and it's creating there isn't a lot of variation it isn't very smooth and the smoother this is the better of a result we're going to get and we have all these quads that we made so let's take advantage of them I'm gonna throw it on an attribute blur and what attribute blur does is it basically allows you to smooth out smooth out the the values of your normal so let's let's activate that and by default it's going to be smoothing out the position I can see right here so I can crank this up you can see it really starts to smooth out the position of all those of all those points but we can do a different attribute let's add N and now if we look at this nice angular shape that we're getting here with these with this sword then we start to crank up the blurring iterations you can see it starts to round out those normals so that they start to kind of you know fit around a nice shape so now let's hop back to our other Network I'm gonna go hit the back key here here we are hit the space F key you can see that our our deformation has been way is way more smooth now one thing I'm worried about that i'm not quite sure happened is the dot product works best if you feed in two normalized vectors and i don't think that our n is normalized anymore or no I don't think our normal is normalized anymore so I'm going to go up here I'm going to drop down another vector and just normalize it real quick it's gonna be N lower case and upper case N equals normalize at N and there we go it doesn't look like it made any difference but it just makes me feel better so we're just gonna go with it cool what else can we do here now I see you know when we when we played this back it looks like it's affecting her body so if I you know there's various ways I can control that if one of the ways I can say is you know we're getting some sort of deformation around her hands if I don't want that I did create this group up here for her body and for the sword I could come down to this attribute wrangle and simply select the sword group and now we're only deforming the sword which is fine we'll just do that for now that looks cool and so what else can we do maybe what we could do is we could analyze the speed disorder how fast is it moving the faster it's moving it's going to be moving faster at the end of the sword you know we can use that as a value to drive a ramp okay so what's let's add that in here before I do this position adjustment I actually want to take all of these this value and assign it to a new variable so I'm going to go down here I'm going to type down a vector since this since the right side of the equation of a position has to be a vector so I'm going to write down vector displacement and set this I'm gonna cut this paste it up here and down here we're gonna say minus equals displacement and nothing should happen it's good so it's all still working excellent so now when we do all of our you know formulas and stuff we can just build on and add multipliers to this section right here and then ultimately apply it to the displacement and you'll see why in a little bit we're gonna actually use the placement displacement variable do something else but first what we need to do is we need to measure the speed of our points so to do that we can simply look at the length of the velocity vector so I'm gonna create a new attribute float attribute a speed equals the length of the velocity now if I go over here into my attribute spreadsheet you can see a lot of these points have a speed of 0 which is fine if I sort by the speed you can see that our maximum speed is like 31 ish and then it all kind of goes down to nothing so we got 31 that's good so we know if our speed is ranging from 0 to 31 if we fit the speed value from 0 to 31 in between 0 and 1 we can easily apply it to a ramp let's let's create a new input variable I'm going to say float the max equals CHF max lot velocity and I'll hit this little icon again and now we have our max velocity cool so before we use that the next thing I'm going to want to do is fit the speed between zero and whatever this max velocity is so we're going to say float the map equals fit speed from zero to the max which is the input minimum and input maximum and then we're going to fit it to our output minimum and output maximum of 0 and 1 respectively cool now that we have speed fit between a value of 0 and 1 we don't have it fit between a value 0 and 1 yet but if I go here I see speed is the maximum speed is thirty one point five seven nine and five we'll just uh control see that bring it over to max velocity control V it looks like create a paragraph icon there like that cool now we've got our max velocity put in here and so now we know that our speed is ranging from zero to one next we put it into a ramp we'll say float via ramp and we'll set that equal to CH or AM and call it velocity ramp up and the other parameter we have to do is V man so it's going to be using V map to drive the ramp essentially and then if I click this guy over here again it's created a ramp for us awesome now now all we have to do to use that ramp is we just have to multiply it in as well so put down the ramp here and should be good see now we've kind of got a curve here you can see it's gradually getting more intense as we move into higher values so you can really start to shape this over here you know you could give it like a you know I want it to have like sort of a weird shape like that whatever works let's try using some beasts b-splines to get sort of a cool shape here let's go grab this knotch and select a b-spline let's grab this one and select b-spline and this one select b-spline you can see it starts to make like a nice curve and now we can start to add like a little you know just a little character to the edge of our sword slash and let's go back like this like that maybe going that have this kind of taper off here yeah it's looking cool and this is all just sort of happening in the viewport in real time and if you had you v's they would probably be getting stretched out but I mean your texture would sort of be behaving probably hopefully and you know you can kind of just sculpt the shape of this nice deformation effect I don't know what you want to use it for but it's just kind of a fun exercise so let's play it back and see what it looks like let's go over here and hit the play key and yeah it's cool we totally have this like nice sword slashing effect going through the air and we can crank we can kind of crank it up and see what it looks like if we make it go even higher and it gets kind of ridiculous but it looks like some cool slashes you know cool so one more trick that I want to do let's turn off this smooth shaded mode let's put down a normal so that we can kind of get a little bit def a little bit of definition back into our sword sort of normal why that in highlight it and that's looking good there's a little weirdness going on at the edge there I'm going to just crank up this and we don't really want to be affecting the character too much so I'm going to select the sword group and now it's only selecting our sword group if I turn this I don't often kind of see it brings back some of the definition of our sword let's do one more trick we've got like our nice deformation motion blur deformation happen here let's just give it a little bit of a fade off effect let's handle it by using the amount of displacement so we'll say if these depending on how much this point has been displaced let's affect the Alpha of the point so let's go down here and we will put down a say that alpha equals alpha equals um length of our displacement you can see that that's actually kind of backwards our displacement as our displacement increases we actually want the Alpha to decrease so we know that when displacement is zero alpha should be a hundred percent a hundred percent so if we put down a 1 minus length you can see that now it's starting to fade away I don't feel like this is actually fit to the right range so I'm going to create another alpha threshold for us and we'll call it off float float D Max which stands for the max displacement is equal to a channel function alpha map then what I'll do is I'll use a fit function here so we're going to write float fit this to fit the displacement I'm going to take this thing that we created here I'm going to cut it and we're gonna right fit length with the displacement between 0 and D Max and we want to make sure that it fits between 0 and one because alpha values run from zero to one like many things in computers and so now we can go down here and say alpha equals 1 minus fit disp hit this little icon right here and we get a new alpha map value now we can kind of dial in how much our alpha is being cut away by the displacement amount and just for giggles why not make this an option that we can turn on and off so we'll create a new parameter I'm going to go up here into edit parameter interface and I'm gonna put down a toggle so select toggle hit this arrow key puts it over here we're gonna say for the label use alpha question right and then we'll go up to the parm and call it use alpha and then we'll head apply and accept and down here it just created a nice little dot for us I actually want to go back into the parameter interface and put it right above the alpha map and also why not put down a little a little separator so that we can kind of denote that you know our sort of velocity shaping is happening up here and then this is a separ function down here apply accept and you can see it's kind of drop this down a little bit put a little line in there cool so use alpha check box doesn't really do anything what we can do is put an if statement down after this we can say if CH I channel for integer and what we did was we set this if we hover over it we set it to use alpha so CH I use alpha if that is equal to 1 then do this and that broke it because I didn't put another parenthesis to close the whole thing off so there we go now we've got a toggle we're gonna use alpha take it on take it off nice but we can tick it off and we can still move the Alpha Matt that's not cool let's make it so that this alpha checkbox disables our alpha map I'll go back into edit perimeter interface and go to our alpha map and we're gonna say disable one open bracket use alpha equals zero when use alpha is turned off that will make it so that this value is greyed out it apply and except now when I uncheck use alpha I can't do anything nice so it's on we can adjust it it's off or locked out locked out for good all right cool so that's it that's sort of that's the effect and I hope you had fun I hope you learned something cool about dot products and one of the practical uses of dot products or impractical depending on how you're looking at it but yeah thanks for watching and I hope that you guys have an awesome time playing around in Houdini
Info
Channel: Mark Fancher
Views: 12,947
Rating: undefined out of 5
Keywords: Houdini 16.5, Tutorial, Houdini Tutorial, Houdini, Motion, Blur, Moblur, Deformer, Motion Blur, Mograph, Animation, VFX, VEX, 3D
Id: Os67QmeGaak
Channel Id: undefined
Length: 36min 14sec (2174 seconds)
Published: Thu May 31 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.