Creating Seamless Loops in Nuke Automatically - Create a Looping Gizmo - In Depth Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] hey guys how's it going this is Indy and today we're going to take a look at how to do seamless Loops for any kind of element or any other video footage that you might have inside of nuke now to do that kind of a cross dissolved Loop it might be easy to do it in a layer based software like after effects or Premiere but for new actually it's not that complicated now there's multiple ways of going about it so I'm just going to show you the way that I know in the way that I usually use so the reason why anything doesn't Loop obviously is when you have your element like in our case we have this smoke element you can see that the first frame is like that and then the last frame is like that now in order to make the smoke just keep going forever and to make it seamless there needs to be some sort of a blending happening and before I go in and explain the different node setups that I'm doing in order to do this I'm just going to quickly demonstrate what the process is in this little layer based example with After Effects here so you have an understanding of what we're doing so imagine your smoke clip that you have here is this clip here and that is that long now if you wanted to make some sort of a cross dissolved Loop for something like this the way to go about in a layer based software is essentially you'll be duplicating your existing footage one time and then in order to dissolve first you're going to decide how many frames you want to do the dissolve over so let's say if I say I want to dissolve over two seconds so currently we're at zero seconds and I'm gonna go until two second Mark right there and then I'm going to chop the layer in half so I'm going to split the layer at that point and now the way to Loop something would be to take the first half of the split and put it all the way at the end so that split part is now at the very end and you take the second half of the layer and you push it to the front like so and because we made the split right there we know that once this runs out there and then it connects back up here now we've made a perfect split but the issue with this is obviously the fact that our base layer is still here so we need to make some sort of a dissolve or opacity animation so technically what we would be doing is setting a keyframe for example for opacity for the bottom base layer to be zero at the beginning because the first and the last for the base layer are different the frames are different so we want the first and last keyframes for the base layer to be zero and then we're just going to go forward to Second Mark somewhere around there and then we're gonna set this back to 100 percent and the same thing we're going to do here so we're going to go back to Second mark which will be at three seconds and then we're going to do the same and set this back to 100 so essentially this is starting at zero and ending at zero and has a hundred percent opacity here now we're going to do the exact same thing for the other two splits that we did so this split is now actually going to start at 100 opacity and when the base layer goes up to 100 this one drops at zero and continues to stay at zero for the other other side of the split so this split stays at zero percent but then towards the end it reaches 100 percent so that would be the fastest quickest way to do a cross dissolvement obviously we can't do it with opacities because at one point when you reach the halfway point between the two you actually end up having the problem where the darkness of the overall the brightness of the overall element actually drops a little so that's why cross dissolves are a better way where one of the footage is actually dissolving into the next one now in order to do something like this inside of nuke what we're going to need is first a time offset node which we're gonna put here and then we're going to make a second copy of it and place it here now we need to do the dissolve between the two so we're going to need a dissolve and then finally we are going to need to connect the dissolve the zero input will go to the left side time offset the one input will go back to the original frame and the two input which is hidden on the side will connect over here now just to make things simple because sometimes your elements might come in without having proper frame ranges set up we're just going to set up a frame range in the beginning and once we're done doing all our dissolve animations we're just going to do another frame range so we output a nice clean frame range so in our case this one is set to one 501 that's the frame range for the smoke so you set it to one you set this to five zero one and you do the same here now in order to actually do the same thing that we just took a look at in the layer based example in order to do this here there's the quickest way to understand this is let's first decide how many frames we want to dissolve over so let's say since this is 500 frames long we just wanted to dissolve it over a duration of 150 frames for example so in this one what we're going to do is take 150 and then do a minus operation and then add the last frame that we need the last frame of our footage or our elements so in our case that is 501 and in the other time offset we're going to do the exact same thing but the other way around so we're going to take our duration and then minus it from our input point so in our case the input point is one so I'm just going to set it to one however what I'm going to do is actually set this to plus one because if I don't do that the very first frame and the last frame of the loop will have the exact same frames and you want them to be different and now in order to see that visually there's a quick tip where you can actually go in and create a text node in Nuke and then if you type in the description square bracket frame and close bracket you actually end up seeing the frame number of your scene the frame that is being rendered after all of these operations are being done so before we do anything else now we can actually go in and key our dissolves so the way to key that would be on the very first frame we're going to set this to a value of zero meaning take this time offset here and this time offset just like the example we saw before is the one that does this half first it actually sends sets the the back half of the clip so we're going to set that to zero now we're going to move forward the amount that we need in duration that we set our duration to which was 150 so I'm just going to go to 150. and set this to one so at this point once it reaches frame 150 we we are saying that switch the dissolve input to the one input which is in our case again our base layer remember how our base layer went from 0 to 100 over the duration so that's essentially what we're doing here now we're going to keep it to one just like how we kept our base layer to the same full opacity all the way till here so we're going to put a second keyframe towards the end but 150 frames minus the end so in our case that will be 500 minus 150 which will be 349. and we're going to set that to one and at the very end we're going to go and switch the input to the second input which is this one which is basically us creating this clip right here by pushing our existing clip that way so now that we're done if we now end up previewing our overall final output if we look at the frame number here you can see that the first frame is actually frame number 352. and if you go to the last frame you'll see it's actually frame number 351. so after it reaches frame 351 it will jump back to the very first frame which will be actually the frame number 352 and then it'll keep going until it does a little dissolve so you can see the dissolve happening here where both the numbers are on top of each other and then it actually dissolves into the original then continues then starts dissolving again to the end clip so that would be the quickest way of doing this now if I were to just preview this foreign and now that you can see once we're done previewing if you just focus on the actual element itself you can see that it nicely Fades and cross dissolves onto itself and creates a very seamless Loop that now you can use for any kind of element that you want to do set up in your scene and you just want the element to keep going forever this is the quickest and fastest way to do that however there's actually even faster way of doing this so if you're someone who wants a little bit of automation so that you can just keep doing this quickly without having to go in and set up some math in the time offsets where you have to do the actual math of the duration minus the end frames and the duration minus the start frame and then setting up some keyframes on the dissolve key if you don't want to do that you can just make a little group or a gizmo which will help automate this entire process so now I'm just going to show this exact same process but how to automate that so in order to do that I have created a little set up already so if I move my smoke over here this is the exact same setup that you saw before text node is just disabled for viewing purposes but if I double click the no op node the no op node is essentially an empty node with nothing inside of it so if I create one you can see that there's nothing in it and then you can always go in and right click and manage user knobs and you can create new knobs based on that so if I click on ADD if I click on Integer I can just type for example frame in as the name of the knob and then create a label for it and that way I can create little integer knobs I can also create buttons where I can write my custom script so I can write a button called execute for example and call the label execute and then in here I can go in and type my python script so I've already done that and I'm just going to quickly run you guys through what exactly the script is but once you create those two knobs so I've created the first knob called frame in this is going to be the first frame of my range and then frame out is going to be the last frame of the range and then the blending duration is going to be the actual duration itself now what's happening under the execute button I'm going to show you by right clicking manage user knob so you can see these are the knobs that I have and if I click on the execute button and click on edit you can see the little script that I've written now obviously there's many faster better more efficient ways of writing this exact same script but I wrote it in a more descriptive format so that it's easier for you guys to understand so if you're going to follow along and write your own scripts you can understand how to do so so you can see at the top here we have a variable that we're creating called No op node and the command to that is nuke dot this node which means the node on which this script is being executed so in our case that will be the no op node then we're defining the frame range node because we have two frame ranges one at the start and one at the end so we're just calling them input frame range node which is frame range one then output frame range node call frame range 2 then work defining time offset before node which will be the node on the left we have just renamed it time offset before and we have renamed this node time offset after so we're calling and assigning those two nodes to these variables and then at the very end we're assigning the dissolved node by calling it dissolve node equals nuke dot to node and then assigning the dissolved note there after that we're gonna assign some variables for the actual knobs themselves so in our no op node you can see we have created our own custom parameter frame in and frame out so that's what this is being defined here we're saying frame in is the no up nodes frame in knob and this is the value that whatever value it gets assigned in here that the user inputs then for frame out is the same thing and for duration which is this blending duration variable that we created we're just setting that here calling it duration setting it to be the blending duration knob and then the value after that we are doing a frame offset variable now this is where we're actually doing the math so the value that we had put into our time offset before node we are writing it down as the duration meaning the length of the blend that the user wants the duration minus the frame out meaning the end point of our overall frame range so in our case the end point is 501 so this value will be 1 5 100 minus 501. same thing with the frame offset after we're defining this variable and we're calling it duration minus the in frame in number and then that plus one that we just discussed we do that because that way the first and the last frame of the range are not identical so for that we just use duration which again the user has specified as 100 minus frame in the first frame of your range which is one so 100 minus 1 which will be 99 and then we're just doing plus one so that again like I said the frames are different on the first and the last frame of our final input now that we're defined the math here all we're doing is just going in and setting in some values so in this entire chunk we're just setting in some values and again like I said there's faster easier ways to set this very quickly using Loops but I'm just writing it all down so it's much more easier to understand what's happening so inside of this we're setting input frame range node which if you remember was the node right here which was our frame range one node so we're saying please set the first frame value to the value that was provided by the user in the frame in knob of the new OP so if the user set this to one then go inside and inside the frame range node so if I just quickly close all of this to show you and in here you can see that there are two options the frame the first frame and the last frame if you want it ever want to know the value of any knob inside of nuke if you hover your mouse over it you'll see that you'll see the actual name of what that knob is called so this one is called first frame and this one is called last frame so we're simply defining the command where we're telling nuke to pick up the value from whatever value set in our frame in knob on the no op and go and set that to this and then take whatever values in the frame out and then set that here and then we're doing the exact same operation on the second frame range as well so if I go back manage and then execute click on edit that's essentially what we're doing in this paragraph we're just going in and setting the first and last frame values after that we're just doing the same thing but for the time offset node so we're saying go to the time offset before node that we had defined up here earlier and then find the parameter called time underscore offset which is the time offset knob that is in there and then set the value to frame offset before that is where we just did the math right here and then we're doing the exact same thing for the time offset after node so just go in and take the value that we just did in the math right here and assign it here set that value now after that just a little bit of quick change that happens here in the dissolve because for the dissolve we want to actually put in keyframes so every time the user clicks execute we want to set up some keyframes so before we actually set keyframes what if the user constantly wants to change this value what if they're blending duration of 100 wasn't good enough and they want to set it to 200 and if they click execute you want to First remove any keyframes that were already set onto the dissolve so for that we're just doing a quick command called nuke dot animation and then we're naming the node that we are setting it on which is dissolve one and twitch and we're setting it to clear so that will just clear any animation and it will set that knob to be keyable after that we're just setting dissolved node.which to be set dot set animated this one is optional if you remove it it will still work because the dissolved that which command that we set here with the nuke dot animation it automatically clears all the animation and sets that knob to be cable so if we remove this it'll be the same but we have added it just in case so it is clear to understand we're just setting the which slider on the dissolved node to be animatable so we're setting it to turn on animation after that we're just setting it at different values so we're saying dissolve nodes which slider set value at and then we're defining first of all the actual value that we want to put and then after the comma we're defining what frame you would want to set this onto so the first value we want to obviously set it to the very first frame which was our frame in variable that we had set up here then for the next one we want to set the value of 1 because we want our dissolve to go from 0 to 1 to the next keyframe if you remember we set this one to zero then we set it to 1 at the end of our duration then we continue at a value of one towards the n and at the very last frame we change it to two so essentially we're doing the exact same thing however in this keyframe you might remember that our value was actually negative and what I mean by that if if you go to the math right here frame offset before our duration is 100 but the frame out is actually 501. so 100 minus 501 will actually be 400 minus 401 which is negative and this actually helps push the entire clip towards the left side enabling us to do the actual looping but in our case since in this case we're actually setting keyframes we want it to go to frame 401 so we don't really care about the negative sign before and as a result of that in the frame description right here we're actually using the math function ABS or absolute whenever you write ABS or absolute and then in the brackets you put whatever value it ignores the negative sign and it makes it an absolute positive value so if we're doing abs bracket minus 401 it's actually going to change to 401 so that's what we're doing there and then at the very end we're setting the final set value at the frame out which is our final frame so with that said all we have to do is now hook into any other video that we want so for example in our case I have this little flyover video and I want this flyover to just keep animating and looping so that I can use that as an element so if I double click here and I see first of all I have to check the frame range so this one goes from frame 1 to frame 529 so now I don't have to tweak or change any of this I can just go into my new OP and set the frame out to 529 and then I can decide how much duration we want for the blending we're just going to keep it 200 and then click execute and the moment we click execute you can see that the different keyframes has already been assigned and we don't really have to worry about anything else other than just previewing the final output and it should start looping automatically so this is the first keyframe and if I go to the very end you'll see that that's the similar keyframe towards the end and we know that our overall shot has now looped and as you can see that this video is now cross dissolving and seamlessly playing from the start to the end so this is the quickest and easiest way to do a cross dissolve seamless Loop inside of nuke there are much more advanced ways of doing this exact same thing using something like Chronos where you're actually morphing the video from one to the other depending on whatever is the end frame you actually try to morph that into the first frame using tools like Chronos but obviously they're slightly higher in terms of the complexity of setup and also that they're slower to process so this one usually works for most elements that are very abstract like smoke or water or fire so if you ever wanted to package this entire thing into a group you could do that too just select all the nodes that you wanted to be a part of so I'm just going to deselect all of these and then also delete the text node because we don't want that one and I'm just going to also delete disconnect the viewer and then just select all of these and then go to edit click on node and then click on group and then Ctrl G or collapse to group and the moment you do that it's going to ask you please choose one of the following nodes to use as the group's output meaning what is the final output node in our case that is the frame range two so we're just going to select that and click ok and a group is created just like that so if you wanted to name this you can name it Loop simple and then now you're seeing that we're missing our actual buttons and knobs so in order to bring them out we're just going to click on manage user nodes and instead of adding new ones we're just going to pick the ones that are existing on the inside of our group so we can just open up the no op and then open up the user section and select all of these click OK and click done and our Loop simple node is ready to go now you can see that there are two inputs to it so if you double click and click on this s icon at the top right you can see that's because there are two inputs one connected into the frame range and one connecting the no op they don't really care about the no op input so we're going to disconnect it and we're going to disconnect the frame range one delete input 2 and connect input 1 to the frame range and that should be it once we close and we come out you can see now there's only one input I'm just going to go in and quickly change the color to this so I know that it is a custom made knob that I just created and just like that we have our little Gizmo ready to go anytime we find any kind of footage you just need to know what the input and output frame range is and then simply input that into our tool one one one two and don't think that you have to use the existing frame range if this footage for example is a thousand frames long and I don't really need it to be a thousand frames long I only care about the first 200 frames you could just go in and put your frame out to 200. and then just set the blending duration to let's say something like 50. now obviously this will be a little bit too apparent because 50 frames is not enough time to cross dissolve between two things without the eye actually noticing it so I'm still going to click execute and our setup is done you can see our frame range is automatically set to 200 here so I'm just going to set it to 200 and click and you can see that our video starts dissolving from one to the next so with that said I hope you enjoyed this quick little tutorial about how to create seamless Loops inside of nuke if you'd like to use the same note that I created for this tutorial feel free to jump into our Discord server where we have a ton of amazing artists that share their work daily and have a section in there called useful links where you can find all the tools and utilities that I create for free to use in any of your projects so I hope to see you guys there and if you'd like to know anything else about nuke or if you have any new specific tutorials that you'd like to see feel free to leave a comment down below and a like and a share does also go a long way so thank you for watching this video and I'll see you guys in the next one relax foreign
Info
Channel: IndyStry
Views: 3,132
Rating: undefined out of 5
Keywords: indystry, indystry films, nuke, the foundry, foundry nuke, nuke tutorial, nuke tips and tricks, nuke learning, nuke tutorial in hindi, nuke tutorial 2023, nuke in depth learning, nuke compositing, compositing tutorial, create seamless loops, seamless loops in after effects, nuke python tutorial, nuke create seamless loops, seamless video loop, loop video seamlessly, video loop, nuke gizmo tutorial, nuke create a gizmo
Id: nAMG7ZceLoE
Channel Id: undefined
Length: 28min 40sec (1720 seconds)
Published: Tue Jun 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.