SDXL Compositing Blending Tutorial in ComfyUI

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone we're gonna do a little experiment today I'm going to show you a little bit about pasting and masking and how easy it is to blend additional objects and composite them on top of each other to make a pretty amazing scene especially with stxl it's a little hard to get in painting to work properly and so I found that this is a very consistent way to get exactly the type of scene that you're looking for so I built a very initial scene here has the basic components that you normally would have you have your checkpoint you have your empty latent image starts you off a sampler you have I'm using the mile high Styler which is great for styling your prompts as well as having the prompts together but you can use just the regular text prompts as well and additionally the normal encoding as well as the decoder and your preview and you can see I set up a little scene here very basic it's an environmental type shot right kind of an empty small kind of background no real action going on we're going to add elements to it and blend them together and you'll see exactly how easy this thing is so first things first there's a couple extra packages you are definitely going to get uh to be able to have a very efficient flow I definitely recommend getting the node nesting package and also the impact package as well nesting basically lets you group things together so it kind of cleans your your workspace and then the impact one introduces other items like the preview Bridge which lets you kind of stream your images into other areas of your workflow and there's a whole bunch of other features too so just for starters with that nesting package I'm going to clean a few things up here just to clean it make it a lot simpler for someone to just kind of group these guys together here just so you can go Nest them uh you can call it whatever you want so I'm going to just call it the foreign you can see you can group some together and I'm going to just collapse that just to again clean it up here so it's over here to the side and um and then additionally right as a preview image you can see there's no output here so we're going to actually replace this with that preview bridge I was talking about so I'm searching here and I search for bridge I see preview bridge I don't need that anymore I got rid of it and if I just read render since I used a fixed uh seed here I don't have to actually go through and re-render the whole scene but you can see here on the right hand side you now can continue the pathway down as much as you want and so uh just thinking kind of off the cuff of what we want to generate here uh I might want to have a uh kind of a dumpster let's call it a dumpster that's on fire right that's going to be kind of exciting here so we're going to I'm going to just just make sure everything is unlocked which it is great I'm just going to copy all of my sort of rendering components here and I am going to just paste them over here sometimes you'll by the way you'll see as you start to drag things around it may disappear or your kind of your screen becomes blank and if you just hit you know refresh your screen control r that browser most of all those items will come back and so here in this case right we said we're going to do a dumpster far now we don't need the resolution obviously to be as big because we want it to be a little quicker in terms of the rendering so we're just going to make a 10.4 by 1024 and um you know you can vary the seed if you want I just pick random seeds again keeping it fixed and as you're going along you can obviously make your scenes more detailed by including a larger number of steps but for this quick example we're going to keep them low and right everything is still kind of hooked up the way it should be so you don't even have to do much in terms of changing things up yeah and this time we're going to do a dumpster uh caught on fire and we're going to do a wide angle shot okay so we're just going to do another preview Bridge that's going to be my go-to now to preview stuff because I think it's it's pretty easy to use and let's see if we can render you can see it's starting to render stuff out here and here we go awesome now one thing I did notice right so this is during the daytime this during the night time obviously it's good to have a similar type of scene so you might want to say here uh nighttime just so that you get all the kind of uh similar type of environmental effects so when you start to blend it doesn't have any sort of issues good good shadow effects Etc um and so you can see here right so we have our dumpster here it's on fire and we're going to be pasting that directly into this scene now the question is well so how do we bring and cut this and paste this in here this is where cutting and pasting by mask is really really helpful so first things first I'm going to take my image here pull down yeah it's usually not here in the preview I actually have to search for it but I'm going to be cutting out of this area right and the uh image is obviously automatically selected you'll see it's looking for a mask there is by the way a different package that you can get sometimes that actually has the masking automatically converted but in this case you could see this normal cut by mask is not so you can see mask is green you can see the mask here is looking for an image so you're going to have to convert this over but basically just drag it down turn it into an image and then drag the rubble resulting image into that mask see you've connected it completely don't have to change any settings and now this is completely cut out uh at the same time we're going to be obviously like we said we're going to be pasting by mask so we're going to bring this guy down I'm going to search I'm going to search for paste this by mask and so here's here's the interesting settings that we're going to take a look at here so first of all your image base is kind of like your background right so that's the scene here so it's connected properly the image to paste is the thing we've cut out so in this case it's going to be this though we haven't masked it yet and we're going to get to that in a second but we're just going to connect it up and so the result of the cut by mask we're going to bring over here and we're going to put it over there now let's just quickly mess this guy out just so we have that so in that impact package that we talked about uh one of the great options in the preview bridge is the Sam detector I highly highly recommended because you don't have to mask all the little details here you can in fact just click a couple of different areas here and detect and it should grab most of it you may have to add a couple of items here just to get a couple of the details and detect again all right great this is good yeah I'm gonna grab one more little piece here as well um you can see this is really great now you can definitely clean this up if you save it you can see all right it gets a lot of it but there's some extra areas I want to just add as well so I'm going to actually go into the open mask Editor to kind of finish the cleanup increase my little Zoom here do a little bit of touch up here around what else I want to bring in right let's say I want to bring a little bit of that fire here over at the top awesome and I'll save it okay great so now I've cut it I have my cut done I'm ready to paste it I've already hooked it up and the last place is well where do you want to put this right so we're going to come up to our scene here you can obviously create additional preview Bridges to have the kind of background scene by itself but I actually like to just paint directly onto it and continue to use it and you know repeat this process over and over again so in this case I want my dumpster fire to be kind of in this area here so I'm going to open my mask Editor to kind of tell where I want my dumpster fire to be and I just kind of want it over here right and we're going to have some options to say like how we want to fit it so it doesn't have to be perfect uh it does not have to perfectly match also the size you'll see I'm going to put that there okay great now here's a mask but we didn't tell our paste by mask where we're going to be masking and putting it that's what this last node here is this mask and you can see right so we're going to take our mask now here before I do it this is green this is a mass type this is again looking for an image so we have to convert it over just like we did the last time so we're going to click that and turn it in NASA image and take that resulting image and put it right there and then finally here we go so the pace by mask this is the end result of our pasting that's what we're going to just take a quick peek at so we're going to turn that into a preview Bridge oops you can't really see it let me zoom out here one more time there it is great uh okay so here's our preview Bridge right and we're going to just simply increase the size here and we are should be all set now one thing you'll notice I'm going to render good shape now you can see look our our uh result is here it looks great the one thing that you don't see is let's say the sizing isn't right right like you're like hey I uh you know compared to my my little picture here it's a little smaller it's maybe not connected so there's a few different options here you can do to keep this together uh one is fill fit Source size Etc I typically like to use fill or fit and so if I re-render here you'll see kind of sized it up a little bit different this is all based on uh how you set up your mask so let's say I wanted it to actually be a little further in the distance more kind of in the background all I have to do now is just edit my mask and just tell where I want to put this thing I want to put it here in the back and then just re-render and there it is you see how quick that is because it doesn't have to rerun into the whole scene yet we're just simply kind of cut cutting and pasting and putting things where we want so this is all great now of course you don't see Shadows of course you don't see in the reflections yet because you're literally compositing your images on top and now the last stage after we do this multiple multiple times is to kind of blend it all together and when you blend it and re-render it that's when it says Ah there's a fire here it should be casting a red glow and a reflection and a shadow etc etc so we're going to get to that we're going to do one more cut and paste here just again to show you how easy this thing is you're going to copy this guy here and we'll paste them down here okay great and our final scene item here right so let's look at our picture here uh so let's say I want um a person standing here right maybe uh uh you know someone holding a newspaper or or something of that nature just to to give it the the rest of the scene here so we'll just say here uh kind of a um ragged person ragged man holding newspaper um shabby clothes wide angle shot I typically do wide angle shot a lot because that will make sure that we get the whole person sometimes you may want a close-up in fact you know that's an option too you can have my close-up in the front of the scene that's also an option but for this case we're just going to do a wide angle shot here we're going to grab our little output here and let's do our Bridge again and let's uh do a quick render okay okay great uh again light uh nighttime and daytime right again you may want to keep it uh you know similar so we're going to say night shot like shine uh I will say highlights let's say uh it's free my reflections all right great now you see it has the right reflection so everything's going to be great now similar to last time right we remember what we did we have to cut and then we have to paste and obviously we need to mask you know kind of both the item we're cutting out as well as where we're pasting it so we're going to start actually this time in Reverse again this is great because the order doesn't necessarily matter in this case I'm going to start by masking things up one thing I'm going to use the Sam detector you'll see that it contains the same dots as last time you can just clear those out and you can just detect and that's pretty good actually it gets everything in some Darkness here we're going to actually clean it up again with our masker right some extra areas here you want it to be as kind of clean as possible does not have to be picture perfect but you know it could be close you can see there's a little bit of highlight around here and you may want to touch up here but that's good enough and then here so where do we want to put this guy so he's he's pretty kind of out in front you don't see his legs Etc so we are going to actually draw on our already pasted picture right again this is a continue to to work this thing out we're going to put them kind of here out in the front and now this is great but we now have to connect it together so we're going to once again we're going to cut this guy out so we're going to search for cutting and this is great we're going to mask again the mask has the wrong type so we're going to convert that to an image and bring the mask in all right so we've got the cut part done and we're going to create a new paste by mask so we're going to drag this guy right here okay this is the source scene so that's image to base this is our cutscene so this is our image to paste and then the location remember is the mask so we're going to take this again we have to convert it over to an image and bring that over to our mask here and we'll look at our size here in a second and so we're going to bring this down and let's bring this over to our Bridge our preview Bridge you can see that right and there you go okay and we're going to go in here again to see it's not really Blended in here but you have them and it's actually pretty decent in terms of where he's located I'm going to play the settings to see how it looks I think that's a little better if I fit them it's obviously he's floating that's not going to make much sense uh if I use the source size obviously right it's in the Mast area that's not going to make much sense so I think our best option is this uh I think it was the fill yeah it was the bill there we're going to do that by the way I'm instead of having to hit Q prompt every time there's a cool little shortcut you hit Ctrl enter it will automatically re-render the space but of course be aware that it's going to re-render any case Samplers or any you know kind of open gen as you're doing it uh okay so we've got our two scenes here but you can see right there's not so much uh in terms of the effects going on here and so the last piece is now I want to blend it together so as we're continuing the scene right let's zoom out here you can see you're just having render render render you've got lots of different little scene elements that you're rendering all you do now is you're going to bring this guy over uh this is the full scene and we're going to now we're going to first encode and then we're going to decode so first encoding the whole scene we're basically going to turn this scene back into a kind of a digital latent space over and then now we're going to use this is going to be our source for rendering stuff so we're going to Layton here we're going to bring it into a sampler we need a new uh uh kind of milestyler here in this guy as well so we're going to bring him down here right what's what's the prompt The Prompt you'll see is going to describe this whole scene together and that's going to kind of bring it all together so we'll do that in a second um let's see here so we need our model which we're just going to snag this guy over here we're going to grab our conditioning right our positive and our negative rate and then finally going to bring the uh latent together here so this is going to go into here and then this is going to be our resulting image right now I'm going to just preview here just we can take a look at our final image now one thing to keep in mind is a final piece as we're doing the final renter first of all let's describe the scene so now it's not just simply a background it's a you know slum alley yeah good time with lights but we also have our kind of main Kai so a ragged and with newspaper and there's a dumpster on fire and [Music] um it slums Ellie at night time with street lights background oh yeah um you could style it of course as we're talking about and do all that kind of stuff as well I'm just gonna have a little seed here doesn't matter and we're also going to do fix just so it doesn't keep repeating and repeating and we're going to now keep this low right so we only want to do it maybe 20 steps is fine sometimes they'll say 30. do not want to necessarily go too high up um yeah as you're doing your final renders because it will over kind of bake the scene and here the denoise right we don't want to completely shift our entire scene we just want to make it very small so we're going to do like point two five and we can see how that looks right sometimes it's 0.3.2.15 depending on how that looks and then we will render and there we go you see it actually Blends his hair he's part of the scene you have the fire you have some Shadow here obviously you can play with it more if you want it to be a little bit more Blended right and that's it
Info
Channel: Grockster
Views: 3,142
Rating: undefined out of 5
Keywords:
Id: kbPM4YnZOoA
Channel Id: undefined
Length: 18min 44sec (1124 seconds)
Published: Thu Sep 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.