SMOKE SIMULATION in Nuke!! (No Plugins)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good morning good afternoon and good evening to you my dear viewer my name is Julian Cruiser here with nodes arsc scary.com and I have something very cool for you today this is a method that is quite simple but very powerful and it allows us to do simulations inside of nuke all stock plugins and even though the technique is simple we can produce some very complex and dare I say beautiful results so what is the secret sauce that allows us to get away with such magical Fe well let's jump into nuke and take a closer look so the technique that we're using here is a hack you're not supposed to be able to do this in Nuke and that's because what we're doing is creating a feedback loop we are taking the output of a node and then feeding it back in to itself and if you try and do this in the node graph it bounces right back off you can't do it and uh this is because the nuke developers knew that if you were able to do this you would blow up and your computer would blow up and your house would blow up and like it would be terrible or at least that's what they want you to think because actually the real reason is you would have too much power there's so much stuff that we can do with this and all we need is a workaround for this little issue here before we get to that I do want to say that this video was inspired by this other video on YouTube by texture Labs um where they create this awesome smoke simulation effect and in this video here I'm going to show you how to achieve a similar result in Nuke this is an After Effects tutorial um but I don't want your main takeway from this video to be how to make a smoke simulation in Nuke I want you to be inspired to use the power of simulations in general for whatever creative purposes you can think of because there's a lot of possibility here how do we bypass that circular Loop thing well the answer is with a read and a write if we write out a an image sequence into a full folder demo3 and I'll make this an exr sequence because it's uncompressed and it's quickly readable and then we read the same image sequence back in at an offset of minus one frame this is a feedback loop and we're circumventing the node graph by going to the file system uh and making it work like that so what we have right now is not very ful because this is just an empty image sequence that's getting graded with nothing and then passed back to itself nothing's ever going to happen here uh and so we need an initial seed something to start out with to grow into our final simulation and so we can do this by using a switch node we want to say on the first frame I'll hit equal on this which thing here to bring this expression pop up up and I'll say when the frame number is equal to one then we're on the first input and so you can see this is highlighted on the first input and we move to the second frame now we're going to the feedback loop thing here and I'll while while I'm at it I do want to make sure that the frame range this is set to uh I'll do a little expression here root. lastore frame and this is going to make sure that we're always importing um the entire length of the project into this read node but now that we've got that set we'll get back to our seed here on the first frame we want to use our seed and I'll just make a little Roto here make a circle and then put this through our rgba and now we have our seed you can see through the switch on the first frame it's the seed on the second frame it's a read error and this is going to be a problem because nuke will not let you write with a read error present if I go ahead and check create directories and hit render for the Global length here's what happens wow it's rendering so fast no it's broken that's didn't render at all so how do we get past this hurdle well all we need to do for this is just hook the right node up to our Roto make sure that we're rendering all channels not just RGB because we need the alpha and we need other channels in the future and then we'll just hit render and this should go pretty fast because we're just rendering straight Roto with no changes now that we've got something for every frame we're going to have no issues with read errors because there's always going to be something in here even though the plan is for the right to be overwriting the frame that this read is going to be reading it'll all work out it'll all work out so now what well I say we maybe do something a little bit more interesting than grading with no settings uh Let's do let's do a little translate the idea with this kind of effect is to make a small change every frame that adds up up over time so just to demonstrate here let's do a little 5 pixel translate that just looks like this but that's going to be happening every frame so you'll see we just set the setting once no key frames and then um I'm going to reload this and hit render like this and if we wait a minute for it to do its thing there we go and you can see beautiful it's going up all by itself so before we get any further into this um I we could jump straight to the Smoke simulation right now but there's going to be a lot of iteration in this process I want to make a little change and then do it again and then do it again and do it again and uh it turns out there's some pretty simple steps you can take to make your life a whole lot easier while you're doing this and it involves a little bit of scripting which is fun or scary but this isn't scary at all nodes aren't scary scripting isn't scary don't even worry about it what we're going to do is create a new read node um this is going to be reading that same sequence like this and what we're going to do in this read node is create a custom button and this button what we want this button to do is refresh uh our read one render the right one and then also refresh the reload the read to the reason we need to reload is because sometimes nuke will cach some of the files into memory and if you think about it we really need the latest file from the dis because that contains our last simulation frame and it contains very relevant data so if we have stuff stored from you know the last iteration or the last you know who knows what in there it's not going to it's not going to work so we need to reload that every time we render and um we're going to automate that now so all you got to do here is click on this little pencil and then we're going to grab a python script button and this is just three lines of code almost 2 and a half lines of code you'll see but if I hit this little button here this is the uh knob settings and we'll name our button simulate and we'll label our button simulate exclamation point because we are excited about it and then we'll write our code so step one reload our read one so select the uh select our read one like this read one so we're saying convert from the name of the node to the node itself which is maybe a weird concept but this is how we do it and then knob and we will select the reload knob and then we will execute this knob um and the execute is like pushing the button next nuke do execute because it's a little different here uh right one this is how we render a WR node in Python we just execute it like that and then we'll just copy this first line right here paste it down here change this to read 2 now we're reloading this one as well and I can close this and hit simulate and now you can see we've got exactly the same thing that we had a second ago because we didn't change anything so now that we've got our setup ready for doing feedback loop a nuke what can we do with it well let's jump straight into that smoke simulation shall we now I'm just going to pretty much translate over that tutorial that I mentioned at the beginning the texture Labs tutorial because it's so great but there is a lot more stuff that you can do with this setup as we'll get into later anyways what do we notice about smoke it goes up generally so we will uh keep this transform in here pushing it up what else well it tends to diffuse so we're going to use an aod to sort of bump it out remember we want to just make small changes so size of two it'll add up over time and then maybe blur it out a little bit so that it diffuses a little bit what else well um if we just take a look at how this looks right now you can see it's looking interesting but it's lacking a few things one of these is that it stays the same brightness all throughout uh and smoke as it gets more diffuse we tend to lose density and it gets less bright so let's take a little grade node here and we'll just grade down one little step at a time iteratively getting darker as time goes on um of course we can't see it in the preview iteratively getting darker as time goes on if we do this now that's getting closer well what else is missing there's a lot of detail missing for me personally so what I'm going to do is bring in some noise whenever you need whenever you need something to be more realistic it's the answer is always just noise so noise texture how do we integrate this well what we could do is just punch out stencil out some of the noise texture um onto our seed here like this and maybe we don't want to make it 100% we'll do maybe 50 um and if we do this and animate our noise a little bit we'll do a little expression here equal sign to bring that menu up frame / 20 is going to animate our noise like this and if we see how this is looking in the simulation now we can really see how things are starting to get interesting one thing that I don't like about how this looks right now is that the shape stays pretty much the same so let's bring in some Distortion shall we so my favorite Distortion Gizmo available for nuke is X distort or at least one of my favorites and the reason that I like it is because there is some very cool Direction options here um also it's just easy to use you don't have to shuffle stuff into other channels like you do with ID distort but anyways I'll leave a link to this in the description I highly recommend it um but what you can do is just plop in the noise like this into the Distortion map and then the direction sets whether the image will be attracted to the bright spots or to the dark spots or spin around the bright spots which is exactly what we need for this setup here because smoke tends to swirl around and that's the effect that we want to achieve here so what I'm going to do is turn down this blur map that allows us to have more detail and turn down the Distortion amount to maybe six and we can see what this looks like just as a preview on a single frame and let's see maybe a little bit more blur map yeah let's see what this looks like when we simulate it I do just want to say while this is going the beauty of this technique is that it is using the previous rendered frame because there are methods where you can just if you think about this you could achieve the same effect by stacking like a hundred effects or 100 nodes on top of each other with slightly different values and everything and time offsets but it would be insane render time um because it would like go up exponentially but this it's just one at a time and you can use whatever nodes you want and it's pretty fast but anyways this is done now let's see what it looks like now we're getting somewhere check that out that is pretty cool so that is pretty much the smoke effect there's some more stuff that you can do to make this interesting of course you can add different noise here you can merge two sets of noise on top of each other adding it together make this one bigger adjust the seed by adding something to the offset and and maybe turning down the gain um this will make some bigger ripples in the uh in the smoke and yeah there it is you can see we've already in just a short time achieved a pretty cool effect and there's all kinds of stuff you can do to augment this I mean you can render multiple different layers of it uh at different detail levels like large details and small details and then composite them on top of each other and that makes a more Rich uh sort of result but there's so much more that you can do with this like for example you don't have to have your seed be a roto and you don't have to have your seed just be there for the first frame either all I did was pull an HSV tool key on this little coaster and I used it as an emission Source uh or the seed basically for the simulation and there's some extra Tom Foolery that's going on in here to give the the smoke inertia and I might do a video on that if you guys are interested um it's interesting there's velocity Fields taking advantage of all the different channels in Nuke but that's for another video but you can see like look at how well that works and there's even more stuff that you can do with this the potential is unlimited for example you don't have to have the uh you don't have to have just a black and white image all of this is like Distortion effects you can put a color image in here I vaporized myself it was easy um and it's all using similar sort of techniques you don't even like simulation smoke simulation kind of effects are only one of the potential things you can make fractals with this this was a super simple setup this is just three transforms in the shape of this taking the input image and arranging it into a triangle and then boom you have this which is crazy complex and beautiful and it was super easy um and like I meent I don't know if I mentioned this earlier but you have blink script like you can use Blink script as the intermediate effect and that opens up so many possibilities like anything you can do in a programmed simulation you can do inside of nuke now you could probably do a fluid simulation that's like physically accurate if you wanted to um earlier today I did a implementation of conways game of Life inside of nuke here's that and it was pretty simple to do like I I just see a lot of possibility in this so with all that being said I know this is less of a stepbystep kind of tutorial but I was really just hoping to get across this General technique that you can apply to so many different situations if you're interested in any specific tutorials for any of the demos you're seeing here feel free to leave a comment and if there's enough demand I'll make another video If you make anything with this technique I would love to see it so please leave a comment or send me an email and uh I'd love to check it out thank you very much for watching this video and I hope you learned something from it even if you didn't I hope you had a good time watching my name is Julian Cruiser here with nodes aren't scary.com and I will see you in the next one
Info
Channel: Nodes Aren't Scary
Views: 4,616
Rating: undefined out of 5
Keywords:
Id: v3UJoQryuRg
Channel Id: undefined
Length: 16min 18sec (978 seconds)
Published: Sat Oct 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.