ComfyUI Fundamentals - Mastering Noise

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay hello and welcome to another comi tutorial uh today we're going to be covering uh what I would call mastering the noise and that is um learning to control um empty latents learning to control um Samplers through input images and um learning the kind of the ins and outs of how the sampling process is affected by what comes into it and through that I'm going to show you how to use noise to kind of add more detail um change kind of the way that your images come out and to really add an extra level of control onto actually making stuff you want to make and might be having trouble actually prompting because um sometimes you prompt stuff and you just can't get it to come get it what comes in your head is not coming out on the image generation and we can change that we can increase the likelihood of it doing what you want by actually doing this kind of stuff and in the process I'm going to show show you how to make um a gradient noise module following along from my modular tutorials I'm going to show you kind of how um generating things using this can kind of affect your images and um we're going to be using a modular workflow in the process so kind of seeing how these things work in in kind of action as it were so first off let's I'll show you how this workflow works um I would normally show you how to build it and I'm going to show you more on the the actual um noise module the building process but um generally you know my videos work out nearly 40 minutes long sometimes so can't really show you we rebuild the whole thing every time okay we've got our prompts here as tech text boxes and we bring them into a loader module and the loaded module just contains a checkpoint which is an sdxl refined model so um we don't need the refiner which many of you um might be confused about we don't really need the refiner if you've got a refined model it's already done for you uh we also have not got sdxl clip texting codes on this because generally they help make better images but they're not really needed um for just doing quick stuff which is what this is uh we are using a comfy roll aspect ratio module sorry node in order to um provide us with resolution providing us with an empty latent as well and providing us with uh sdxl premade resolutions so that we are not creating bad images and we're not having weird artifacts going on it's also got some other cool settings as well okay and that's also feeding out into our bus through these particular nodes here the width and height now for the bus uh first time I'm actually using one of the bus nodes from West in instead of just doing a whole bunch of noodles so instead of rainbows we're now using these bus nodes now first of all uh let's have a look at the um the main module in question we're going to be using to do stuff and show you how to do stuff this is the gradient uh gradient gradient noise module that I'm kind of going to show you how to build uh we're going to have color gradient from comy Roll in here we're going to have Vectra nodes generate noise and uh W suits PE in noise now we could have all kinds of stuff you can have solid color in here you could have W suits gradient you could have um just about anything which outputs images can be used inside this um because all it is is is image sources like generated images or even load images and they're all in here and you blend them together and the output is a mix of a whole bunch of different sources and it just sends out an image which we then upscale to the size of the rest of the workflow and then send out as a laden so that we can replace the laden image uh this can also be used in a separate way we can uh bring information in and blend stuff to it and then send it out so this could actually work postprocess or in the middle of things or before we've actually done anything as the Laten source as well so it's kind of a multi-use kind of thing we run it let's click go and what it'll do is it'll send out whatever is coming out in this preview over here in the bottom right sends it out through here sends it to all the different um all the different uh modules that we have connected to it as you can see over here it's generating a full image using the prompt that we have at the start there's nothing particularly spectacular about this image or anything like that um you'll notice that I'm sending it colors it's not really using those colors at one do noise it's not um not pink not green on one side or the other and you'll see that these ones will in fact be using the colors and the only difference is the doo value is different and that's because um when you're using an image instead of the empty latent that comes in through these things um generally at at one it's only really using the intensity it's using the black and white or the light and dark information and further down as you go down the den noising kind of steps you use more and more color from the original and more and more details so if you go really far down it starts to look more and more like the original image drag that over you see it's turning into clouds at 50 and down here it would be mostly just clouds probably cuz it's still using a fair bit of denoising at 03 um so if we if it ever generates another interesting thing is if you're using different kinds of gradients like if you have color on different see how it's oriented horizontally gradient uh with we're getting some different kind of images we're getting stuff that's Cliff faces and top down views of things okay so it is actually doing an object okay a terrible photo of a of a ship flying okay so as you can see they don't really resemble this top one even though they're pretty close in um denoising levels now let's have a look at this so in order to build this actual module it's very simple let's just uh remove all of the guts of it uh not that and these oh it's gone anyway whatever so as with any module for a modular setup in on the left out on the right that's all it is so all information coming in comes in on the left uh making sure we bring in you know the V the width and the height cuz we're probably we're going to need them to upscale it let's add the upscaler back in so that's image scale someone pointed out to me that's image scale thank you very much um whenever you thank you um I've I was having trouble finding it like the the name is is not up not upscale in the thing so can never find it when I typed upscale width and height that's now plugged in and when we output to this we want to make sure it goes through the upscaler and the reason we do this is uh we're using the width and height from the original loader and that allows us to always output at the right resolution that we want to be outputting to the rest of the workflow um depending on how complex your system is um you might have to mess with this to use maybe um a get a get image size node or something like that um there's quite a few of those around they're not too hard to find all right so let's get back to the guts of the module you're going to need a gradient you don't really need a gradient but for this this example we'll make one make the simplest gradient that we can um comfy roll custom color gradient um width and height obviously we have start color and end color if these are set to custom it will use the X Valu from the bottom um hex values can be found on the web there's websites that will have color in color numbers for these you just have to look up hex color um you can also plug in some nodes that will randomize these which are pretty cool now those must be on custom to use those if they're on custom it's going to come out black by default so it will just give you a black image um I'm going to change these to white and black now and uh gradient distance is the um how far the blur is how far the blur is between the two as you lower it you'll get less and less blur between the two points until you get to nothing and we're going to make it nothing and a preview uh the linear transition is where vertically or horizontally the transition point is within the um gradient as you can see it's at 50 so it's in the middle it was at 70 it' be down here it was it 30 be up further up and now that we have those two images we're just going to run this as the simplest form of gradient module we possibly could where just the gradient um just pluged straight into that and we'll run it and you get to see what this actually does to 1.0 so we're running this as the actual latent instead of the empty one uh we're running this as a just that's what we're sending it just like an image to image process if you use an image loader or something like that and you can see it's having a pretty big effect on this whereas before we had the color and you could see it wasn't barely using any color at all that's because obviously um when you're at the 1.0 d noising uh it uses light and dark more than it uses color information it can be used to make some really cool images though as long as you know that it can do that um you've got more control over it you can tell it to do these things uh if I add I'm going to add a different node to illustrate the point um gradient let's add a radial gradient we'll do the same thing we did before black and then we'll add red distance is done oh it has to be like 0.5 for this cancel the job and then okay so now we've got this so we'll increase this to 15 this one it changes the size of it rather than the um blurring for whatever reason okay now if we go and we just plug this into it all black white dot in the middle and you get to see it do something else I don't even know what it'll do cuz I haven't tested it it's probably be in a tunnel or something or it could be a planet in space really up to the denoising process what it wants to do and because it's really high on the denoise it if it thinks it can do something an it'll it will actually add details to it but um so clearly it uh not exactly following this hard line approach here and that's probably because there's a little bit of smoothing kind of gradient going on let's let's see what it does if I I want to show you a trick here you ever working with grayscale stuff like pein noises or this kind of radial thing uh if you mess with the levels you can actually make it a black black straight black and straight white image as well you just have to raise the values well get them close to each other anyway canel first job uh whoops uh you need to be somewhere in between those uh probably be that's what it will be sometimes you get problems with custom notes trying to use Alpha channels when they're not allowed to use Alpha channels and it breaks things throws errors now whether or not it will do that in this case are you going to render the whole workflow before I get to I'll force it sometimes the order of things gets messed up so I'm just going to jam this in here to force it to actually do these nodes do the nodes I have selected please thank you all right so as you can see I've now removed that blur from around this by changing the so there's another little trick and images to RGB fix the bug that was happening there because of that so if you ever get like a weird eror that's just being thrown when you're trying to use Blends or mix images together um images to RGB can often fix that and it's because one of these other ones has added a channel to your image which it shouldn't and that's really node node Creator's fault doing that um they really need to be careful with what they're outputting and sometimes they include Alpha channels without giving you option to turn it off cancel that and we'll run it with just the Little Dot which would is probably going to change the it does do those but it hasn't really done a whole lot to this and that's because um it really ABS just a full black and white image um it's got enough power with 1.0 to actually Chang the the simple dot into an actual image but the bright point is still situated around this Cent region now if we look at the other ones uh you can see it's generating kind of like astronomy pictures because of that Central dot this just 70 and probably 80 is going to be the same just a little bit extra and it's already throwing um throwing completely different images than you got up here at to one and the reason for that is because when you generate images let's bring this up it really really um this is kind of what it does a couple of steps in from the start of generating and it you see it's really blurred it it's really added a whole bunch of noisiness and odd colors to the image that's kind of how we generate images um it blurs everything completely at 1.0 it it'll just completely mess up your image and this is um 2 out of 20 I can't I don't I'm terrible at math I don't know what the den noising level of that is but if we set this to zero grab it it yeah about there it basically doesn't really use the original this image at all when we run stuff so cancel run stuff and you'll see that um it's like a completely different image it's it's not even using this dot at all in the image and that's that's how we actually get this Den noising stuff to actually make things that aren't being sent to it um which is why when you send image to image with a 1.0 it won't really make it what you think you're making but give it a little bit give it one or two frames of using your actual image and it will drastically change the output of the sampler as well so let's make this more complicated now let's remove this Al we do not need it let's change this to being a yeah we'll make it blurry in the middle we'll give you the blurry one you run this we cancel the job again we're getting a uh simple gradient in the middle and as you can see at the very start there's this solid chunk of black at the bottom of the image here and that's because when you have big solid chunks of color solid chunks of either color or light and dark usually light and dark at um at denoise of one or whatever um it will actually use those like those big chunks of color in order to make those bits stay but it very quickly changes the colors the pixel um RGB values so as you can see it's just created this weird black cut off down the bottom of the image and the rest of it's kind of normal now if we reduce the gradient distance cancel and run it so now we've got more white up the top more black down the bottom and there big chunks of it and we look down here we see the that now we have this kind of interface going on it's not as not as drastic as the original just the binary kind of image you can see how we are actually influencing even at one we're influencing stuff so how can we improve images using this we can't really do a lot to 1.0 there's not much we can do um we can't really send it anything more than a white or dark image to influence something to noising at one but anything below that can be pretty heavily influenced by intense color intense bright and intense dark sections of an image so if we are using that process on these lower ones you can see it's doing it is actually making like this now if you tried to prompt that it would be very difficult to prompt this kind of layout because um stable diffusion abhor big areas of nothingness it wants to add details and whereas if you're using those kind of gradients you can force it to actually do that and in this you can see that it's at 0.7 D noise the big chunks of white and dark it can't use those but it can use the gray bit in in between in order to make features as and it's added some buildings and stuff like that now at 80 it's got more power over what it can do it can change the image even more you can add more RGB change and so it's changed it even more and it's more of this has changed more deeper colors more detail the higher higher it goes up closer to one the more it changes and is able to change the even the dark sections of the image as you can see at 60 D noise with already it's unable to change it really cuz there's just there's not enough room for it to change those RGB values to anything that it can actually make images out of now if we change what we send it we can actually allow allow more for this we can give it some more use so let's grab pein PE noise just makes clouds light and dark clouds um very simple node you don't really need to mess with this stuff uh scale changes how close to the camera the clouds are really uh octaves changes the crumbliness of it from memory uh persistence not exactly sure what it does something I've never really bothered to investigate what the values really do I just use it as what it the default normally all right now we have two things here but we want to use both so what we can do is we can add blends now typically I will use blend mode nodes from was because they have a lot more options than the standard uh image blend that comes with com for your ey I'm going to be using that I'm going to be using just the simplest one which is ADD which is basically the second image the B1 is technically on top and it sets the transparency of that top um layer of the image basically we're just setting the transparency of that and sending it out there and if we cue The Prompt now this is going to make um I know it's not going to make a huge awesome image it's going to make bad images cuz we need to do more to it to make it actually do really good stuff but um this is to show you the effects of having all this kind of gray and little dark and Light patches on the den noising process as you can see it's got enough in here to already start making mountains like really early in the process of making the images um but this is because it's already starting at steps we raise that to one we'll use more of the original okay so it just made a random thing up here and you can see that at seven instead of being this black and white thing it's actually able to make stuff because there's gray and gray let it just kind of make whatever it wants to make as well make a preview so you actually see what it's actually doing over there but as you can see yeah the the more kind of Grays and the more stuff that's in our original image the more it will allow this to actually work even further down and further down whereas if this was this it would be very plain and very empty image so cancel the job and rerun it and then we get to see what we're actually making cuz weot Okay so we've got more dark down the bottom only real thing about this we um since we adding transparency that we reduce this we should get more dark down the bottom and it will still be a little bit cloudy so let's we down to 19 cancel rerun so as you can see now it's kind of a cloudy gradient we're giving it a lot to work with when we do this kind of thing at this point this stuff is not hugely helpful just ignore the outputs there you can build your own testing rigs like this uh whenever you want to do stuff and experiment with stuff I suggest building testing Rigs and testing rigs you could use XY plot to do these kind of things where you have a whole range of values um you know the CFG the D noise all that kind of stuff um I don't generally use XY because my needs are a bit simpler than an XY plot and um I like to kind of work on one value at a time rather than a whole bunch of values so I don't really need the complexity of an XY plot so as you can see we're getting black and white images cuz we're sending it black and white information the further down we go still black and white and still kind of roughly as simple as a little bit of mountains and stuff like that in certain areas that all comes from because we've got a little bit of stuff to work with at that point now if we go over here let's set this at we'll end it at 20 so we're ending it um off end it at 15 and then we'll start it at 10 so we uh five frames like I can't do math I'm terrible at math so I don't know what the den noise would be but it'll give you an idea of what it's doing when we run it if we run this again on here and then we going so that's kind of the stuff that it will generate um when it's got a fair bit of the original image is showing up now unlike an image to image process where you load an image with obvious obvious features and stuff like that because this is kind of a noisy weirdly cloudy thing it'll just make stuff out of it like when you look up at the cloud in the sky it will just make its own things a lot further down than you might expect so this is at 50% and it's still making um obvious features out of it rather than using the original image at all so if you provide stuff this uh you can go really far down the do noise and still get images that don't like look like any the original clouds as well so all right uh color let's have a look at what happens when we add color to this shall we let's change the gradient to uh where's Red Red up top and we'll change the bottom to turquoise why not if we run this uh click cancel still haven't gotten to that one so now we're giving it something completely different than what it would be expecting right red sky Bri blue down the bottom obviously the other one at this kind of denoising level it was able to make features but these are very bright colors um now if we look over at denoise one we'll see that they're actually affecting the image that we're putting up the top and that's because of as I said before the intensity of the image so black and white will really affect D noise of one so will really bright colors like at maximum values like close to 255 um that it'll actually change the thing at do noise but if it's too far down the color kind of value it'll it'll just kind of bomb out and ignore them in the D noise of one but as you can see there's so much of that color in there and so much of that value that it doesn't know what to do with it even though there is this kind of this kind of uh cloudiness in there it doesn't have enough to change the image significantly yeah as you can see um things don't necessarily work as You' expect it's not like um the kind of you would kind of expect that the color would work roughly the same kind of way that black and white would but it doesn't really and I can kind of show you that a little bit if we grab do I have one gray scale can I make something gray all right found it found it swap color mode luminance uh luminance allows us to uh remove the color information but keep the intensity information so this is basically what uh it would be sending that the stuff in here that is kind of the high value stuff um the lighter colors here being used more than darker values here basically is what it's doing so if we uh change this to uh something a little bit more muddy light dark gray and then white gray I guess um run I guess we'll do it okay yep experimenting okay experimenting is weaker so as you can see it is uh using kind of some of the red but it's not using the exact shade that we have here here uh it's using kind of light and dark as well uh it's treating the upper section more as darker than it's treating it as the actual color so up the top it's actually going black um and this is a result of both the prompting and the whole everything else but it's still kind of giv you an idea of what it's actually looking at here and what it's actually using is not exactly what you would think it's using because it's system of what it decides is more important is um a little bit different than when once it starts using less than F Den noise cuz full Den noise it uh it's really just using this and a little bit of color information behind it whereas further down it's using more this than it's using this if we go over [Music] here now obviously you can experiment with this stuff um to your heart's content to see how these things affect images um you can do all kinds of stuff with this uh anything which can add or change colors in here is awesome uh we can use there's one more note I'll show you before I we go to add a uh generate noise so generate noise is a vextra node it creates um colorful static basically RGB black and white and it'll make pixels and it just looks like confetti static so if we generate you see colorful static uh you can change some of the settings the how the noise how much noise there is and all that kind of stuff as well now because everything we use in here generally you're just blending a whole bunch of things together doesn't really matter how you arrange things we go we make sure that we're this can go over here because we're just experimenting with things and we'll grab this into here and uh we want to use this RGB value we want to use too much of it we just want to use enough of it so we're giving it something but not uh all right let's grab a preview as well actually see what we're doing to it there's a bit of tuning in involved when you're setting these things up so all right so we Zoom right in you can see there is actually RGB values in here but they're being overwhelmed by the background um and the reason I add this kind of stuff is um it gives the the um the sampler the ability to change individual pixels um to be kind of significantly different the ones next to it um in the process it's not like depending on the den noise value obvious okay so what the RGB noise really does um kind of re-explaining this cuz I messed it up a little bit but um the RGB noise because it brings in this kind of um these options for us to change colors so it brings in um RGB values and uh because they're like there's a lot of kind of difference between them there's there's um high contrast what it does is when the blurring happens the blur kind of becomes like smudged kind of dotty kind of um what's the best way of showing it actually I might as well if run want a blur I'll just show you let's show you what it's trying to do let's run this at 16 why not and give me a preview thank you someone ask you for you hold down the ALT key and just drag stuff off and it'll copy a new one so in theory this will render it at some point all right here we go so if you look over you can see that it's it's actually still got that RGB color but it's not individual pixels anymore instead it's some like fist size lumps of color um so when we actually this gets pushed to the sampler um what it's getting is these big kind of lumps of color instead of the small pixels but because they're so kind of generic and kind of all over the place um what it does is when you have these big sections of color um as per when you have a gradient what it does is it gives kind of this a little bit of a tint in a certain color when you mix it in certain ways and um that will allow the actual the Samplers to grab onto those little minor changes in RGB values and stuff adding different kind of details that would normally not really work if it was just straight up gradient um which essentially has the effect of adding detail to an image now um the lower you D noise is when you add this kind of noise the more uh that the sharper those details will be so at a certain point if you go so far down in the do noise um the this kind of staticky stuff becomes film grain um so it can be also a way of adding film grain to your image if you add this in with a kind of lowlevel D noise and maybe blend this in in kind of using additive in low levels onto an image you can really uh you can add a full-on film R effect if you're after um you know almost realistic kind of um kind of video kind of stuff I do that a lot so it's one of the things I love doing for horror images is making look like kind of grainy um photo and film and uh you can really make stuff look realistic that would otherwise not really look realistic add this kind of unreality to it that's pretty cool so anyway that's what um it will do when you um actually run this through the sampler okay so I wanted to show you how to use um this gradient module in some different ways and unfortunately I missed it in the middle of that so let's uh get started so in order to actually use uh the gradient module in um more than just the pre kind of effect area where you're working with Samplers um you can actually use it as an after effect as well so um in order to say color grade or um add a certain kind of effect you can use this to add film effect you can add um just you know all kinds of stuff um you can use because basically just you're blending stuff using colors and um you know Source images in into each other in here and because of that all you really do is bring in um you know a source image which does not come from within here instead it comes from another node or something like that it's pretty easy to do and all you really do is you add a rout and what we do is we use a [Music] load load an image um think I've got one in the thing you can just paste it in uh if you're in the workflow and you have a load image node you can copy from um other preview nodes and stuff like that and you can put it in to a load image node if you use this um copy paste clip bace thing just for those who don't know now if we plug this in here uh we're now inputting the image um into the front of the module um if you do this make sure that your module is set up so that your um width and your height um is consistent through the entirety of the module rather than just at the end of it um otherwise you will have stuff coming out odd resolutions and stuff not blending well so just make sure everything in here is the same resolution if you're bringing something into it um because stuff in here it's it's quicker if you're running it at 512 resolution which is what I showed earlier which is this module running at 512 uh it'll render stuff a lot faster um but if you're using this as a post process um you're going to have to do it at the same resolution as anything coming into it um not doing that you get yeah it's is not great but it is slower so be aware of that if you just want to use this to modify an image you don't have to put it out as a um Laten output really just outputting it after here so if we run this through here and we run a let's run a blending this is just to quickly show you rather than to make anything spectacular and run through here and we'll use color so we're just going to change the color of the image using this setup so shift it about 60% towards the blue and the other colors let's just let's put these side by side underneath it and we'll run it hopefully doesn't try to do everything else before it does this section of the workflow I'm op it should just run these noes there we go that's a quick way of just completely changing the color of your image if you didn't like it and just making it different just using Color blending really powerful Little Nerd this image blending mode nde so anyway um thank you for watching more tutorials coming out eventually I'm very very busy so unfortunately um I don't really have the time to devote right now to um making a ton of tutorials unfortunately um I would like to but yeah anyway anyway hope hopefully this helps I'm trying my best to help you out in as much as I can so thank you for watching
Info
Channel: Ferniclestix
Views: 2,347
Rating: undefined out of 5
Keywords: Tutorial, comfyUI, stable diffusion, AI art, Latent Noise, Modular, Nodes
Id: D7iDPXdFz1k
Channel Id: undefined
Length: 42min 16sec (2536 seconds)
Published: Mon Dec 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.