DaVinci Resolve Fusion: Sine-Cosine Visualiser Tutorial Part One

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi this is Simon obstall and welcome to another tutorial for Blackmagic fusion and today we're going to be taking a look at creating this scene which provides a kind of graphical illustration of how the maths of sine and cosine interact [Music] so there's quite a bit of tricky rigging involved in this project but I hope you'll find it a useful workout for your Fusion expression skills so let's make a start so the first thing I want to do is make a clock face so bring up the 3D Shape tool and let's select Taurus let's have a look at what we've got big fat Taurus really nasty let's set its radius to 0.5 and it's section 2.005 and then let's crank up those base subdivisions let's go for maybe 60 just smooth it out a bit let's come to transform I want to rotate it through 90 degrees on X and then I also want to move it up on y so 0.5 odd y so now its base is sitting on the floor so I've renamed that face and now I want to make a hand to go around the clock face so bring up the 3D Shape tool again let's select cylinder actually I should have joined those so let's merge those cylinder again let's have a radius of 0.005 height of 0.5 and let's come over to transform pivot I want to move the pivot down to the bottom of the cylinder so I'm going to set that to negative 2.5 on Y and then I'm going to set the Y translation to 0.75 so now we've got the hand there and that's rotating around if we rotate it on Z so the next thing we're going to do is we're going to add an expression to the Z in order to create the rotation so right click expression so I'm going to type Open brackets time times 2.5 close brackets negative 90 or minus 90 if you prefer so then our hand starts here and then it goes anti-clockwise at this speed unless you've just chosen this speed because I kind of like it for the purposes of this animation so I also want to set my ends time to 750 frames so next I want to add a new 3D merge tool after this one here and again bring up the 3D shape tool and what I want to do here if we look at the output I want to set this to sphere I want to set that to 0.01 just as a starting point actually let's go from point zero five so it's nice and big for just just for now and so I'm going to put this in the middle of the clock face so let's do that let's come to the translation and set the Y value to 0.5 so then I want to have another ball that follows the movement of the hand around the clock face and to do that I'm going to add a 3D transform I'm going to pipe the center ball out of that and into the transform and then bring that back into the merge like that so I've called that new one rotating ball and what I want to do is apply some Expressions to the X and the Y to link it to the polar rotation of the hand so I'm going to command click the hand so we can see both of them like this so then I'm going to add an expression to the X translation of the rotating ball add an expression and I'm going to pick with that Z rotation off the hand so then we get this value here so now I can edit this so first of all I'm going to type 0.5 times and then cos for cosine Open brackets Open brackets so at the end of this picture value I'm going to type plus 90. I'm going to close the brackets and then I'm going to divide this by Open brackets 180 divided by pi close brackets close brackets so now what is happening to that sphere is that it's moving around in sync with the hand rotation so this 180 over Pi is obviously converting between degrees and radians so then I'm going to copy that expression and I'm going to add an expression to the Y and I'm just going to paste that in there let's look what happens to start off with and that's not exactly what we want so what we need to do here is to change the COS to sine s i n and then we get the perfect rotation of the ball in sync with the hand and we've turned that polar rotation of the hand into Cartesian coordinates for that rotating ball and now this rotating ball is going to be able to drive everything else so we still haven't got a value for Z which we need so to make the whole process of building this a little bit easier I'm actually going to make a dummy object to which I'm going to link these X and y's and then add in a z so again I'm going to use a 3D transform for this and let's select the rotating ball so we can see both of them let's make sure we can see both these translation values add an expression to the transform X and pick the x value of my rotating ball do the same thing for the Y expression click with the Y and then for the Z I'm going to enter an expression which is time over a hundred now strictly speaking this should be time over 144 as you'll probably know but just to make my animation look nice I'm using an arbitrary lower value just so it moves down the Z axis a little bit quicker so as you can see this new transform I've renamed as a driver so now we need to add a few more of these spheres to start creating the the linkage as you know we've got this master ball here this one is a simply going through a 3D transform to create the rotating ball and we're going to say the same with the others so I'm going to add another 3D transform this one I've labeled cos ball so I'm going to pipe the center ball into it pipe this into the 3D merge it's going to go start getting quite messy quite quickly treatment of mind so let's command click the driver so we've got them both open up the driver so this cos ball basically I want to go left to right but I don't want any Z value to it so the left to right is an x value so I'm going to add an expression to the X and then I'm going to pick with the driver's X translation so now you can see it's going left to right like that the only thing we need to do is we need to adjust its y position so it's sitting on the floor so negative 0.5 and now that one's going left to right like that and I also want a sign ball that goes up and down so again let's make a new 3D transform pipe the ball into it I've called that sign ball just go and grab my driver so they're next to each other select them both open up the signboard so we can see so the sign is is a is going to be the vertical axis so we need to add an expression to the Y and then we can pick whip the Y driver value if we link it up you can see it's going up and down this one in the middle here and we just need to move it across on X so 0.5 so that's going up and down like that now just a word about this overall animation so a sine wave really takes place over two units and what I've done you'll notice in my original expression is I've multiplied it by 0.5 so it only takes up half the the height because basically I want it to go from zero to one rather than negative one two one just makes my design a little bit easier but it doesn't meaningfully affect the maths so I want two more balls which track the Z position of the two different waves so let's again make a new 3D transform let's pipe the ball into it let's point that back into the merge I'll keep it tidy at this point but we'll make it tidier later on so I've called that one cos depth so select the driver and the cause depth then the COS depth needs to have the X translation so right click if you add expression and pick whip the X and we also need to add an expression to the Z so an expression and let's pick with the Z value that's time over a hundred and let's come back to the beginning so you'll see that that ball starts to move like this this one here the only thing we need to do is we need to move it down so it sits on the floor so negative 0.5 on Y and hopefully you can now see that that is inscribing the cosine wave along the floor in this z-axis so the final one is the sine depth so again same thing 3D transform again pipe the ball into it and add it to the 3D merge I've renamed that as sine depth select it along with the driver as I say the sign is the vertical so we want to add an expression to the Y add expression and then pick whip the Y value there we also want to add an expression to the Z and pick whip the driver's Z value and now this ball here is you can probably see this one here and it just needs to move over on X to 0.5 and as you might be able to see now it's starting to inscribe the sine wave vertically probably starting to get a little bit confusing but once it's all kind of joined up it'll start to make a lot more sense so now we're finished with these balls I think I might just reduce the size of that Center ball which is after all controlling everything we've got a radius of 0.05 let's maybe go 4.025 and I think that's a little bit more manageable so now what we can do is kind of group all of those just to get them all out of the way I think what I'll do is I'm going to disconnect that merge so they've got their own kind of merge there select all of them and then group them and we can call them balls and then we can merge that over your other merge so the next thing I want to do is to create the bars that connect these different points so I'm going to make a new shape so 3D shape is going to be a cylinder smooth that out of the way let's pipe that into here so let's have a radius of 0.0025 so we're going to start with the depth bars and to do that we need to transform this by rotating it through 90 degrees on X and you can see it's kind of like running down the depth so I've renamed that as depth bar and as before what I'm going to do is I'm going to add a 3D transform because I want two different ones of these so I'm going to pipe the depth bar into the 3D transform and pipe that output into the 3D merge and disconnect the main output so let's first of all think about the COS so obviously we need to have this move left and right so let's again bring in our driver we select both of these so we need to add an expression to the X so add expression to the X and pick whip the driver's x value and so now the bar is moving left and right but next what we're going to do is something quite fun which is to use the custom vertex tool to get it to follow the movement of the COS depth ball so with that transform selected let's add a custom vertex tool now the thing about the custom vertex tool is that in these vertex values we can't access external values directly so we need to plug them into the number values and I'm going to do that using the driver again so let's select the custom vertex tool and the driver with the numbers exposed and then I'm going to use N1 n2n3 for X Y and Z so I'm going to add an expression to number one and pick with the X and expressions the Y and pick wipe the Y an expression to the Z and pick with the Z so now this custom vertex tool is set up in such a way that we can reuse it so let's move the driver out of the way so in this instance let's come back to vertex and we're interested in the depth so what we're going to do is have a conditional for the Z position and it's going to be if Open brackets pz which is the Z position is greater than zero comma then the Z depth which is N3 comma zero close brackets and hopefully now you can see how that works this bar is connected to that cos bar at the back there and is moving along with that cos depth so I've renamed this transform as cos bar depth and let's add another 3D transform partly depth bar add into that let's bring up our driver again so this is going to be the sine depth so what we're interested in is linking the Y so add an expression to the Y translation and pick whip the the drivers y let's copy this custom vertex command C command V pipe the output of our new transform into that and pipe that into the merge and then you can see that we've now got this bar here but it's in the wrong position so we need to move it over on x 0.5 and then we need to add 0.5 to its y position plus 0.5 and now you can see it's connecting with that sine depth ball and all is good so finally we need to link this cos ball to the rotating cos ball I mean you shouldn't link this sign ball to the the rotating wall as well so I'm going to copy that depth bar command C command V Let's pop it into the merge we'll need a 3D transform so 3xf so I've renamed the bar as cos bar so this bar is obviously going to be vertical so let's come back to the bar itself and transform and we just need to cancel out its X rotation so it's going vertically like that then we need to get it to move left and right using V transform so let's select the transform and the driver and then we can pick whip the X position so add an expression to the X and pick whip the X there and you can see it's now going left to right this is good and then we need to use our custom vertex tool so I'm going to copy either one of those paste it and then stick it in here so obviously in this instance we're not interested in the Zed that's why we've got this scaling on Z here so let's reset that Z position to pz and what we are interested in is the p y so again let's enter a conditional here so if Open brackets py is greater than zero comma N2 plus 0.5 comma zero close brackets and I think you can see how that's joined up there so the final one is the bar that connects the sine height to the rotating ball so again let's copy this cos bar command C command V and we want to think about its transform so this one we want to go left and right so in this instance we want to rotate it on Z let's pipe it into our merge so we can see there it is there again we want to add a 3D transform to it through 3xf this time we're interested in the vertical movement of it so let's again call our driver let's open up the translation we want to set an expression on the Y so add an expression to the Y and pick whip the Y value of the driver so now that's going up not enough because we need to add plus 0.5 to that y value now you can see it is connecting to our sine height and then we just need to do the same thing with custom vertex to get it to follow the rotating ball so again let's select the custom vertex make a bit of space here any custom vertex will do command C command V and drop that into there so in this instance I've copied the Y we're not interested in the Y so let's reset that what we do want to to affect is the X so again let's type a conditional for the X so if open records PX this value here is 0.5 if you remember so we want to do PX is less than 0.5 comma so the value we want is as you can see from odd numbers is this translate x value and that's N1 so N1 comma 0.5 close brackets so now that is linking up as well so we've got our entire mechanic working that was a lot of work but hopefully it's kind of given you some good insight into how these things can be made to to link and I think that's the use of the custom vertex tool is is really quite interesting so to get us out of this mess what I'm going to do is group all these bars but at the same time I actually want them to to be in their own merge so I'm going to disconnect all of these things from the merge here use this as the main merge and then group all of those take the driver out of it select all of those and group them and we can call this bars so now we've got our different elements here balls bars driver face hand and so on let's connect the face in the hand let's merge the balls and the bars over the top of that and everything is now and a lot neater so the next thing I want to do is I want to add the particles so I'm going to add a particle emitter and at the same time a particle will renderer and I'm also just going to add a 3D merge over that so we can group these two part sets of particles together actually quite so we'll pipe them in here so we can see so plug that merge into that 3D merge there and let's come to the start so the number of particles I want is 20 our lifespan wants to be 750 if you remember that's our duration here let's come over to style I want to set it to blob let's open up the size controls and let's set that to something like 0.025 and let's come to the region let's leave it at sphere but set the size to zero so now we can use our driver again to set up the translation of the emitter so let's first of all concentrate on the COS which is the floor so select both of these and so now I'm going to pick whip the X obviously so let's add an expression to the x and select this and we also need to add an expression to the Z and pick whip the Z so I don't know if we can now see this yes we can we can see that line being drawn on like so so these are our cause particles so then let's select both the COS particles and the renderer command C command V as you see I've renamed this as sine particles and let's again use our driver to animate it so select the sine particles and the driver sure you can see them both I want to come to the region for the sine particles so let's clear that X offset so remove expression and let's reset it to the default but we do want to add an expression to the Y offset so right click add expression and pick whip the driver's y value so now let's pipe that into that merge there come back to the beginning and see how our y particles are working as you can see we need to move them across on X so X offset is 0.5 and we also need to move it up if I come to the start you can see that it actually should be starting from halfway up the circle so we need to again add 0.5 to that y offset value so plus 0.5 and you can see now if we press play from the beginning that's emanating from that position there which is what it should do and now we've got our entire mechanic set up so I don't know about you but at this point I'm a little bit exhausted and I think it's probably a good time to take a break if there's enough interest I will do a second part in which I'll show you how to do some of the styling that I did in my version but I hope that's been interesting thanks very much indeed for watching see you again another time [Music] foreign [Music] [Music]
Info
Channel: Simon Ubsdell
Views: 2,241
Rating: undefined out of 5
Keywords:
Id: c3VY192Ep-Q
Channel Id: undefined
Length: 22min 49sec (1369 seconds)
Published: Thu Feb 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.