Blackmagic Fusion Tutorial: Expressions Made Easy

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi this is simon from tokyo productions and welcome to another tutorial for black magic fusion and today we're going to be taking another look at expressions and trying to get a little bit further with understanding how they work okay so let's just start off by making a background so shifts baseball background and let's make it a gradient like that and let's copy that come on the C command V let's make this a solid color main color doesn't really matter like that come on C come on V let's make this another color okay so there's my background color my two other backgrounds I want to set the size to hundreds pixels square to 100 by 100 and the same with the other one come to the image tab to do that 100 by 100 and I'm going to merge one of those over my original background and then manage the other one Hoover's the result so I get that that's my first merge that's my second merge so I want to first of all explain something about coordinates in fusion if we come to our merge node here and we look at our center we can see that the default position that's printed at the center is 0.5 on what X and point 5 on Y if we go to 0 on X that puts it over here on the left-hand edge 0 and Y put it down at the bottom left hand corner there now if you're familiar with After Effects you'll know that they use the top left hand corner for zero but fusion uses the bottom left hand corner so now I want to show you what happens if I adjust my background so I'm going to make it square so it renders 1920 1080 I'm going to make it 1080 by 1080 and you'll notice that that stays again locked to that bottom left hand corner because what's the merge is doing is it's calculating these coordinates based on the background image so zero on the background image is always going to be there and if I enter a value of one it moves it across to the right hand side and one on Y moves it up to the top right hand corner I now want to show you something slightly different which is what happens if we use transform so I've got this background selected shift spacebar XF or the 2d transform unless we've also got a center here and it's also using 0.5 and 0.5 as the default position in the center you'll remember that we set our backgrounds to a hundred pixels by a hundred pixels so now I want you to look what happens if I change the x and y position so let's set those both to zero and instead of coming down to the bottom left-hand corner here as it did before it's coming to the bottom left-hand corner of the other square and the reason for that is to transform looks at the coordinates of the input image so if I want to move it one unit over to the left I can just type point 5-1 and you'll see that move that a whole unit across I want to move it down one held unit on Y I can enter minus one after that point five moves it down to that corner there so you notice what I was doing there is I'm using this number field as a calculator so I can literally just reverse that by adding plus one and plus one so we've learned something about these fields which is that we can use them simply for calculations and that's where expressions come in so let's do something a little bit more interesting than that let's add an expression to the Y position so I'm going to select the Y position and I'm going to type equals and this gives us an expression field here just below you'll see what happens we've got an array called point and it's using the existing x value which is 0.5 and it's left me a blank there for y so I could enter a value of 1.5 for Y and it move to the top there but let's do something a little bit more interesting I want to bounce this square up so up and down so I'm going to use the sine function so that's si N and I'm going to use time as the variable so sine open brackets time close brackets and now if we look at that you'll see my boxes bouncing up and down like that now there are two things we want to notice one of which it's not bouncing about the center what is doing is it's bouncing about the zero position so we can fix that by just before that last bracket adding 0.5 so plus 0.5 and now you'll see hopefully that it's bouncing about the center point now let's just talk about time infusion if you're used to After Effects you'll know that time there is measured in seconds in fusion its measured in frames so what you'd expect from the sine function is that it would complete its loop in 360 frames but it's going very much faster than that so why why is that well that's because when we enter the expression here is expecting the value in radians so what we need to do is we need to convert our 360 degrees to radians so if we come over here we can see how to do that if I divide 360 by two times pi I get this value here which is thirty seven point two nine five eight and so if I divide time by that I will be using radians instead of degrees so time divided by fifty seven point two nine five eight and now you'll see that if we come to 90 frames we've completed a quarter of the cycle come to 180 we're back in the center so we're halfway to the cycle 270 we're three-quarters of the way through and at 360 we've completed it so now those 360 degrees are giving us the complete loop because we've converted the results to radians now this is a somewhat cumbersome way of doing it because we're trying to enter everything into this little field here and if we wanted to get a little bit more complicated that's going to be a real fiddle so what we're going to do is we're going to use a different method of entering expressions so I'm going to remove that instead I'm going to right click modify with expression and this gives us a lot more control over it so what it does is it creates a modifier tab so let's move over to that so let's open up those controls you'll notice immediately that R square is move down to the bottom left hand corner and that is because it's being controlled by point out and point out has got nothing in the fields so it's treating that as zero and you remember that zero puts it down there however if we enter point five for X and point five for y that puts it back in the center or you'll notice that there's a value here called point in one and that's a preset to 0.5 and 0.5 so if I come back to my point out tab here we can access those note those values directly by typing p1 X so that's the point one value and if you want Y and you'll see that also returns that default center position okay so let's try entering our sine function into this point expression for y so sine open brackets time close brackets plus p1 Y now I want you to notice what happens when I press play it's moving nice and slowly as if it's using radians so you see 270 we're at the bottom and 360 we're back at the center which is not at all what's happening when we enter the expression here in the main tool so that's a very useful thing to know that's in this dedicated expression modifier window we don't have to worry about radians which makes life a lot simpler okay let's have a look at refining this a little bit I want to be able to control the amplitude and the frequency so let's set up some controls to do that you'll notice I've got some number slots down here and what I can do is I can come over to my conflict tab if I want and I can rename them so I'm going to open up the number controls there and I'm going to type for the first one and for amplitude and in the second one I'll type fre Q for frequency so now if I come back to my controls here you can see I've got these first two slots are called amplitude and frequency and I can use these values in my expression and I can access them by using n 1 n 2 n 3 and so forth just as I could access those by using P 1 and P 2 and so forth so now if I come back to my point out I can affect the time with the frequency value so the frequency was n 2 so I can multiply time by n 2 by typing asterisk into so if we come and adjust our frequency here let's enter a value of 8 let's increase that still further let's try 16 you can see that's bouncing pretty fast ok and we can use our amplitude as well so that N 1 come back to our point out and we can enter that value after the brackets so before the P 1 again asterisk and 1 for our amplitude currently our amplitude is 0 but if we enter the value of 4 you can see we can increase the amplitude of that dance and we've got these very handy controls here but I've got the right names and make it much easier to control the expression and another thing we could do is we could control the decay so it could gradually comes to a halt so to do that I'm going to come over to my config tab I'm going to turn off the number fields that I don't want so I'm going to just end up with four of them come back to my controls you'll see that's reduced the number just makes it easier to look at come back to config number three I'm going to call it decay and this I'm going to call function number four come back to my controls so I wanted to have an expression into the function field so I'm going to type equals and I'm going to type expe for exponential open brackets time divided by n 3 which is my decay value and closed brackets so I'm going to set that decay value to something like 20 and now what I can do is I can use my decay to affect the amplitude so the amplitude which is the height of the balance decreases using this function here and I can control the length of that with the decay remembering that the function is n 4 that's what we want to be using come back to point out so I want to reduce my decay function to reduce the value of the amplitude over time so I'm going to take my N 1 there I'm going to open a bracket before it so N 1 and I'm going to divide that by n 4 which is our exponential function and then closed bracket and if we have a look at that you can see that it's slowing to a halt and we can use our decay control to increase or reduce the length of that so if I Christy decay to 40 it takes longer to settle down but what I'd really like to do is show you something a lot more interesting so I'm going to remove this expression here so right click remove expression so about 0.5 and I want to select my other backgrounds here which is this Center square and selecting that I'm going to type shift spacebar XF to put a transform onto that and I want to have it rotate so I'm going to add an expression to the transform angle so equals and let's just type time then let's add a multiplier time times 2 so it runs a little bit faster and you'll see that that rotates anti-clockwise I actually want you to rotate clockwise so I'm going to invert that by doing - time times 2 and that rotates clockwise like so what I'm going to rename this transform so it's easier to access so I'm going to hit f2 and I'm going to call it a rotator like so you can also rename by right-clicking and selecting rename from the menu there so I'm going to come back to my transform here which is the transform for my foreground let's have a look at the result of those two and what I'd like to do is have my yellow square orbit around my central square as if it's a ferris wheel cabin following the rotation of the center ok so to do that we're going to use our friendly sine function again so I'm going to add the expression back to this transform so right click on the center modifier weird expression and come over to the modifiers tab so the first thing I want to do is I want to access that rotator angle value and store it in n1 so I'm going to select n1 type equals and I'm going to just type a rotator dot angle and you'll see that when I press ENTER that is now giving me the angle from a my rotator here - Hao Tian's 3 so now we can come to our point out here and we can use that in one value for our expression so in the X field I'm going to type cause which is co-signed open brackets and closed brackets and in my Y field I'm going to type sign open brackets then one closed brackets and now if we have a look you can see that that's sort of following along but not quite so what we can do is simply add our p1 x value so plus p1 X and plus p1 Y and now it's rotating around the center it's a little bit close to our original I want it to be much further out so to effect that we can use a multiplier and instead of entering the multiplier into these expressions themselves let's add a new controls that come back to our controls here let's use n2 so let's have a default multiplier of two so now I can come back to my point out and cause n1 asterisk n 2 sine N one asterisk in two and now my number to control is affecting effectively the diameter of the circle so let's have a look at that you can see that's rotating around at a distance based on this n2 value and that of course is just two and a half times the scale of our object as you know if we remember our coordinates lesson from the beginning so if we wanted to another instance of this on the other side I could simply copy that transform so command C command V pipe my background into it and pipe it over the top of everything else and let's look at the result so all we need to do to achieve that is to come to this n1 value which is rotator angle and add 180 degrees so plus 180 and you'll see that moves that over to the other side and now we've got those two 180 degrees out of phase with each other so we could very easily add more instances and simply add hee value to that rotator angle in each case so these are moving like Ferris wheel cars in other words they're they're keeping their own angle of orientation and they're not follow they're not pointing at the center but we could look at one last expression that shows us how we could do that let's just remove this second instance just to avoid confusing everything and let's go back to our transform here and what we're going to do is come back to tools here and we're going to add an expression to the angle let's right-click and modify with expression and this brings up a second modifier here you can see it's called angle let's close down our Center modifier and let's look at the angle so to make life a little bit easier I'm going to rename this transform so f2 to rename it and I'm going to call this follow and then what I can do is I can access rotator and follow much more easily so I want to select my n1 field type equals and what I want to do is I'm going to calculate the distance between follow and rotator so to do that all we need to do is subtract one from the other so I can type rotator dot center dot X minus follow dot center dot X and you can see that gives us a value of minus one point four and that's the X distance between those two objects and I want to do the same thing for y so I'm going to select that command C to copy it I'm going to type equals into the N two field and I'll paste that we just need to change the X's to Y's so just a couple of things to remember about how we access these values Center is capital c en ter so that's the american spelling dot y or x is the case maybe and what that's doing is simply a assessing that center value there so now we can use n1 and n2 to affect the angle of our following box so I'm going to click on the number out here and what I'm going to type is a 10/2 so that's arctangent open brackets n1 comma in two close brackets what we need to do is we need to invert it so minus H and two etc and you'll see that we've got the second box pointing at the first box and there's any one problem here which is something I've ever looked which is that we grabbed our rotator box the yellow box continues to point out or look at the funnel box but it doesn't keep its orbit distance however we can fix that by coming to our follow transform here and coming to our center expression and what we can do is we can link the point one of this to the point one of the rotator and then we'll be just fine so what I'll do is I'll select the X field and type equals and here inside the brackets I'm into type of rotator dot center dot X comma rotator dot center dot Y close brackets and now if we move our rotator the other box and the whole animation follows along with it so I have got to the end of this very long tutorial about expressions and I haven't mentioned to feature that if you're an art effects user you'll probably want to gravitate to first and that's the pick withing equivalent so let me just show you it here I'm going to link height to width of this background so I'm just type equals into the height field and it gives me this little plus sign here and I can drag that to the width so now those two values are locked together now obviously this is a very handy function and it's very easy when the parameters are right next to each other like that when you are trying to link different parameters of different nodes it can get a bit messy so that's why I've haven't made it on it here and to try to show you that it's perfectly easy to simply type the names of the nodes that you want to access and the parameters that you want to control so anyway I hope that's been a useful introduction to expressions and that has given you the incentive to try it out for yourself thanks very much indeed for watching and I hope to see you again another time
Info
Channel: Simon Ubsdell
Views: 27,471
Rating: undefined out of 5
Keywords: blackmagic, fusion, expressions, tutorial, simple, bounce, spring, orbit, look at, point at
Id: MxeiOtY7iPo
Channel Id: undefined
Length: 22min 47sec (1367 seconds)
Published: Tue Apr 18 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.