Green Screen with Blender (VFX Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this tutorial i will show you how to do green screening in blender so i'll show you how to key out the background and then you can replace it with images colors or videos all right now before we get started with the tutorial i want to let you know that i do have a free green screen blender file setup on my gumroad and patreon so i'll have the links in the video description if you'd like to download it so i will show you how to set this all up and i'll show you what everything does but if you'd like to have a blender file start up where all of the compositing nodes are already there and you can download this on my gumroad and patreon and also if you'd like to help support me and this channel you can throw a dollar or two into the tip box before you purchase on gumroad that's a great way to help support me and this channel so i also wanted to give you some advice on how to film your green screen shots so that your green screening can be more successful and look better so my first tip is to make sure you don't have anything green in the scene except for the green screen and i did want to let you know that you don't actually need to use green you can really use any color the color just has to be consistent green does work pretty well but as long as that color isn't in the rest of your shot then you can use really any color for green screening my second tip is to try to remove wrinkles and folds so if you can you want your green screen to be pretty flat now a few folds here and there are okay but you do want your green screen to be pretty flat because if the folds and wrinkles are really big then that can cause darker areas and darker shadows and you want the color of your green screen to be as consistent as possible and my third tip is to make sure you have pretty even lighting so spending some time setting up your lights is really helpful because again you want the green color to be as consistent as possible i was filming this next to a window and so there was a lot of daylight coming in and that was really helpful but i also turned on a bunch of lights and i also brought in some more lights just to light up the room and using daylight can be really helpful because daylight is pretty bright now if you have direct sunlight shining on the green screen that may not work so well because then there might be strong shadows but i was inside and so there wasn't any direct light there was just a bunch of light coming from the window and i also had some different lights around the room alright my fourth tip is to use a high frame rate so if your camera has a setting to use a higher frame rate then i would definitely do that and why this is so important is to eliminate blurring because when a character or a hand or something is moving along the green screen there can be some blur and when there's blur when you're trying to key that out you can kind of see the blur and so that can cause problems and it won't look quite as realistic but if your camera is filming in a higher frame rate then there's going to be less of that blurring alright my fifth tip is to make sure all of the characters and objects and props stay in front of the green screen because if you're filming your scene and there isn't the green screen behind something then that's going to cause issues now there are ways to fix this you could mask out the object or the character and you could like rotoscope around it but you're going to have to do that for each frame you're going to have to mask around the character and it's just a lot harder and takes a lot more time so while you're filming your green screenshot make sure everything stays in front of the green screen and my last tip my sixth tip is to make sure that your subject isn't casting a shadow on the green screen so you can see in this shot there was a small shadow because there was some light in front of me and so i was casting a small shadow on the green screen it wasn't that bad though so it didn't really affect the green screen but if there's a strong dark shadow behind the character or the subject then that can cause problems as well so try to light your character from lots of different angles to eliminate shadows alright so now you can go ahead and film your green screenshot and if for some reason you don't want to film your own green screen shots but you still want to follow along with the tutorial then you can look for some green screen footage online there is some footage i found on pixabay so it's this footage right here i found some different free videos that you could use so if you'd like to use those instead i will have the link in the description so you can use those to follow along with the tutorial if for some reason you don't want to film your own green screenshot and also if you'd like to purchase a green screen then i will have some amazon links in the video description to some green screens and those are affiliate links as an amazon associate i earn from qualifying purchases so if you purchase something through the links that will help me out but with no extra cost to you alright so just open up a new seen in blender and let's get started so the first thing that i'm going to do is i'm going to use blender's video editor to convert the videos to frames now you don't actually have to do this you can do this with just a video but i would definitely recommend converting your videos to frames because i found that if you just use the raw video it can sometimes cause glitches and problems so i will be converting my video to frames so in blender you can just click on file and then you can click on new and then we want to open up a video editing layout so then right down here in the sequencer i'm going to press shift a and let's open up the movie clip alright so here is my video so i'm just going to click on this and then click on add movie strip so what you need to do is just edit the video to just the part that you want to use now i've already done that so i just need to set the end frame now so i'm going to click on the end frame and i'm going to drag this out till it's at the very last frame and if you need to cut your video and audio strips just press a to make sure they're selected and then you can press k to cut the strip and then you can move to the end of your video where you want it to end and you can press k again that's the shortcut key for cutting a strip and then you can just select these strips and press x to delete them and then delete the other strips and also some things to make sure of is that you're using the same resolution as your video so you can change the resolution right up here and then also make sure the frame rate is the same frame rate as your video so once you've edited your video just make sure you have the start frame and the end frame at the correct spot and so we now need to convert these to an image sequence so to do that i'm going to scroll down here so on the file format i want to set this to png so it's going to export it to png images and then you can click on this button right here to set an output i'm going to click on this button right here to make a new folder and i'm going to call this folder frames and then i'm going to go inside this folder and i'll just click on accept then i'm also going to click on a file and i will save this blender file and i'm going to call this video editing dot blender now click on save as so then just press ctrl s to save and then you can click on render and you can render out the animation and it's going to render out all the frames to pictures alright so once the frames have rendered you can just close that blender file and we're going to open up a new blender file and then i'm going to go over to the compositing tab and then to use blender's compositing nodes you're going to click on this button right here to use the nodes and then you will see the render layers and the composite now i don't want to use the render layer so i'm going to click on this and i'll press x to delete it so we now want to add in the video that we converted to frames so i'm going to press shift a and i'm going to search for an image and let's just drop the image right here and then just click on the open button to open up the frames and then just locate to the folder and you're going to go inside the folder with all the frames then you can press a to select everything and then click on open image and then it should already do it on default but if it doesn't make sure that it sets the amount of frames that you have so in this animation i have 690 you can also just turn the frame amount up to a really big number and then it will just use as many frames as it has and then make sure the start frame is set to one and then we don't want any offset and then also right down here on the end frame just make sure this is the same so i'm going to set the end frame to 690 because that's how long my video was and then some other really important things is to go over to the output properties and make sure that you're using the same resolution as your video and you can also change the frame rate to the frame rate of your video and that way when you play the animation it'll be the correct time and then one other important thing if you go to the render properties i'm going to scroll down here and i'm going to open up the color management now on default blender has the view transform set to filmic but i want to change this back to standard now why it's set to filmic on default is because when you're rendering out a 3d rendered image it can help to make the lighting look a bit more realistic but it will also change the color correction a little bit and it will make the video look a bit more grayed out so i'm going to change it back to standard and that way it won't change any of the colors on this image so now we're going to set up the compositing nodes so let's press shift a and i'm going to search for a keying node so we're going to use the keying node to make the green transparent now before we get too far into the tutorial let's also save this blender file so i'm going to click on file and we will click on save as and again i'll save this in a folder with all of my files as green screen.blend and i'll click on save as now i'm also going to be using the nodewrangler add-on to preview different nodes so if you don't have that enabled you can click on edit and then open up the preferences and then over there on the add-ons tab you can search for the node wrangler and just check mark the node wrangler add-on so once you have that enabled you can hold down the control and shift key and then select different nodes and it's going to allow you to preview the node in the background so let's control shift and select the keying node and then also i want to plug the image up to the compositing so it'll actually composite that so now what i want to do is i want to take this image and i want to put the image into the key now this background is a little bit too big so i'm going to press v and that will zoom the background out you can also press alt v to zoom the background in and then you can also hold down the alt key and click and hold with your middle mouse wheel and then move around the background so now we need to set a color for the key node to make transparent so right here if i make this a little bit bigger you can see this says key color so i'm going to click on this color right here and you could just change this to a green color but it's better if we use the eyedropper instead so i'm going to control shift and select this image here to preview it so the viewer is going to go into the image and i can now click on this key color and i'm going to click on the eyedropper so i now want to select the most common green color in this whole image so probably about here so i'm just going to click on that and then i can control shift and select the keying node and now you can see that it's starting to look transparent now we still need to do some things to fix this because you can definitely see there's still some problems here and you can see that little blue stuff there this is pretty transparent but there's still some issues around here so we still need to tweak this a little bit so one thing that can really help is if you take this key color and make it darker that's actually going to help to get rid of a lot of that so i can just take this key color and i can turn it down and you can see that it's actually getting rid of a lot of that so now it's becoming a bit more subtle and so i want to be able to see it a bit better so what i'm going to do is press shift a and i'm going to search for an alpha over node let's click on the alpha over node and we're going to drop it right in here between the keying and the viewer and then also i can plug the image up to the composite and then i want to take this image and i actually want to put it into the bottom one so now this color here this is going to be behind the image so wherever it's transparent you'll be able to see this color so you could keep this white if you want to you could also change it to a different color i think turning it to white looks pretty good and so now you can kind of see those imperfections a lot better so right down here you can see there's some problems and kind of right over here now another thing i found that really helps is to make the color slightly more blue so if you click on this color here click on the key color you can change it and you can make it a little bit more towards the blue and you can see when i do that it's getting rid of even more of the green screen and you can also just kind of adjust the color if you need to so you can make it slightly more saturated or slightly less saturated and just kind of see what works alright so it's looking pretty good we still have a few things that we need to edit but i'll get back to that later so now what i want to do is i want to get rid of all this stuff over here because you can see these bookshelves over here i was just using those bookshelves to hold up the green screen but we need to get rid of that so that it's transparent so to do that we're going to create a mask and then we're going to put the mask into the garbage mat so to create the mask i need to click on the plus here and then i'm going to go down to vfx and then i'm going to open up the masking workspace and then we just want to use the masking right here so i can actually get rid of these other things just by clicking right here and dragging up just to hide those alright so now we want to open up our image so let's click on open and then again just go inside the folder with all the frames i'm going to press a to select everything and then i'll click on open clip so i can now press the space bar to play or i can click on the play button right here and it's going to play that video so now i just need to create a mask and i'm just going to mask around myself so i'm going to click on new here and it's going to add a new mask and then to place the mask i'm going to hold down the ctrl key and then i will click that is going to add a little dot right there and then i can control click and i can continue to hold down the control key and click and i'm going to make this mask around me so i'm going to go all the way down here and then i'm going to go all the way back and i'll just place the last dot right there and blender will automatically fill this right here now something that's really important is to make sure that i don't go out of the mask so just play through the animation and make sure none of the character or the props or anything go through the mask because everything outside of the mask is automatically going to be turned into a transparency so that is good let's press ctrl s again to save this blender file and then let's go back over to the compositing tab so we now just need to add that mask data into the garbage mat so i'm going to press shift a and i'm gonna search for a mask let's click on the mask and drop it down here so i can now just take this and i can plug this into the garbage mat now we need to set the mask so to set the mask you can click right here and then click on the mask that we created and then you might need to move a frame just so that it updates now you can see that it's actually doing the opposite of what we want so it's masking me out but not everything else so an easy way to fix this is to just press shift a and search for an invert node and you can just drop the invert node right in here and that way it's going to flip the colors of the mask if you ctrl shift and select the mask you can see here's the mask data so there's white and black but then if you ctrl shift and select the invert it's going to flip that data so now this is white and that is black so now if i ctrl shift and select the alpha over you can see that the book shelves are gone and it's just me in the center all right so now let's finish setting this up and then we'll also do a few things just to make this look a little bit nicer so if i control shift and select the keying node you can see that here is our image and there's a transparency in the background if i control shift and select this a second time that is going to show us the matte and so basically this is a mask to tell us where we want to be able to see it and then where we want it to be transparent so i actually want to use this in the factor of the alpha over so let's control shift and select the alpha over so i'm going to take this matte data and i'm going to plug this into the factor that way it's going to use this data to tell it where it's going to be transparent now it needs to be sharpened up a little bit because if i ctrl shift and then select this a couple of times you can see there's some problems here you can see it's like a little bit gray right there so to fix this i'm going to ctrl shift and select the alpha over and then i'll press shift a and i'm going to search for a color ramp node so let's click on the color ramp and then i want to drop the color ramp in between the matte and the factor so just drop it right there and i can just bring it up so if i control shift and then select the color ramp we can preview it now to make it sharper i can click on these tabs and i can drag them closer together so if i drag this closer together now you can see there's not any glitches there and it looks more sharper so this is basically making the mask more contrasty and then also on the black tab here i can click on this and i can drag this over and you can see it's going to make that more sharp as well so i can control shift and select this and you can now see that looks a lot better and you can continue to play around with these you don't want to make them too sharp but you can definitely make them a lot sharper now if you look on the edges you can see the edges look a bit sharp and so there are a few things we can do to make those edges look less sharp so the first thing we can do is we can turn up the pre-blur so let's turn up this pre-blur amount and if you turn it up really high you can start to really see what it's doing so it's basically blurring all those edges now that is way too high so i'm going to use a much smaller pre-blur at just about two more maybe three and that is going to make those edges quite a bit smoother and the other thing you can do is you can use the post blur so if i start to turn the post blur up now it's going to blur even more but you can see that's again too strong so i want to turn this post blur down maybe to just like a two you can now see that those edges look much better and then you also might need to go back to the color ramp and just play around with this because now that it's been a bit blurred i might just want to change this and bring the black back a little bit and then i also don't want to use this image here as the final image what i want to do instead is i want to use this image here so the original image so i'm going to take this image and i'm going to put it into this image right here and replace that and then this image right here i don't want this so i can remove that that way it's going to use the original image instead of this image that has been keyed out now when you zoom in here you can see that there is kind of a little bit of green on the edge and so there's a super easy way to get rid of that green color what i'm going to do is press shift a and i'm going to search for a hue correct node so we want to drop this hue correct node in between the image and the alpha over so we're going to drop that in there and so basically this will edit this image so we're going to edit the image before it goes into the final alpha over so now we can do is we can turn the green values down so if you click on this tab on the hue correct you can drag it down and i'm also going to drag this down and you can see as i start to turn it down the green color is becoming less saturated so it's basically taking these colors and it's making it less saturated and i find that also turning the blue values down a little bit can help too so you can see here it is before and there's a little bit of green on the edges and then there it is after so it does help to get rid of that green on the edges and then right here i'm going to take this image and i'm going to make it fully black and then i also want to take this alpha and i want to turn this alpha to zero so if you click on the rgb just make sure all these are zero and then also make sure the alpha is set to zero as well that way it's going to render it with the transparent background so if i press f12 to render this you can see now it has a transparent background so what we're going to do is render out all the frames to images with a transparent background and then in blender's video editor we can add things underneath it so to do that you're going to go right over here to the output properties and then again just make sure that you have the correct resolution and the correct frame rate so then right down here on the output make sure the file format is set to png because jpegs don't support alpha channels so they don't have any transparency so make sure you render these out to the png format now the other really important thing is to make sure you're using the red green blue and alpha so the alpha stands for transparency so if you just render it with the rgb then it's not actually going to render out to transparent and so in the background it'll just look black so if you render it out to rgba that's going to store the alpha transparency in the images and let's also click on this button right here to set an output for our images and then just locate to the folder where you have all your project files i'm going to click on this plus right here to make a new folder and i'm going to call this folder transparent frames and then i'm going to go inside that folder and i can just click on accept so let's just press ctrl s again and then i'm going to press ctrl f12 that will render the animation or you can also click right here on render and then click on render animation and this is going to render out all the frames to images alright so the rendered frames have finished and so i've now opened up the video editing file that we started with at the starting of the tutorial so i now just need to add in those frames with the alpha channel so i'm going to press shift a and i'm going to go right down here and add the image slash sequence and then we're just going to locate to the transparent frames and i'm going to press a to select everything and then i can click on add image strip so now if you play through this you can see that we have the same video but everything else in the background is transparent so now we can do is we can add in videos underneath this video because this video now has an alpha channel so i can just select these rendered frames and i'm going to press g to grab to move this and then i can press y and that'll bring it up on the y-axis i'll just bring it up like that and then click to place that so we now have this section right here that we can add in footage so you can add whatever you want you could add a video you could add a picture you could also press shift a and you could just go to color you could add a color here you can really add whatever you want now if i play through this you can see that you're not actually able to see the color going through and that is because i need to click on the transparent frames and over on the compositing right here i want to change the blend type from cross to alpha over that is going to tell the frames to use the alpha transparency so i can now just click on this color right here and i can change this to whatever color i want and you can see that it's going to be in the background i'm going to delete this though because i want to add in a video so i'm going to press shift a and i'm going to go to movie and then i will be using this waterfall video right here this is a free video that i found on pixabay link is in the description if you'd like to use it so i'm just going to add that movie strip and then i will select the waterfall strip and i'll press g to grab and i'll just move this to the starting so now if i play through this you can see that the video is moving in the background so now i'll show you how to fade out the background like i did at the starting of the video so what i want to do is i want to select the original video and i'll press g to grab i'll bring it up on the y-axis and i want to bring it up to the very top that way i can see it on the very top so i now just want to fade out this video so to do that you're just going to move your blue line to where you want it to start to fade out then just make sure that this original video is selected then over here on the compositing i can animate the opacity value and the opacity is going to make it more transparent so i'm going to hover my mouse over the opacity and i'm going to press i and that is going to insert a keyframe you can see it's now yellow because it has a keyframe and i'm now just going to move to where i want it to be transparent so right about here then i can turn the opacity all the way to a value of 0 and then again hover your mouse over this value and you can press i that is going to insert a keyframe and you can now see that right here we have that animation right there so now if you play through this you can see that it's becoming transparent and then also make sure that the waterfall video is underneath this so that when it fades out you'll see the waterfall in the background and then if you want to change the background image then you can just fade out the waterfall image or you can fade the waterfall image to a different image so let's now export this to a final video so right here i'm going to click on this to set an output and i will put the final rendered video in the folder with all my files and i will click on accept and then for the file format here i want this to be rendered out as a final video so i'm going to change this to ffmpeg video and then i'll just show you a few settings that i like to change so on the end coding here i like the container to be set to mpeg4 and then also on the video i use a video codec of 8.264 and i just leave this at medium quality and good and if you have any audio you can change the audio codec so on default it's set to no audio i like to use the aac audio codec so just press ctrl s again to save and then you can click on render and render the animation and it'll render out the final animation you can also press ctrl f12 that's the shortcut key to render out the final animation and that is the tutorial so that is how you do green screening in blender so i hope you enjoyed this tutorial and i hope it was helpful and thank you for watching and again you can download my free green screen blender file setup on my gumroad store and my patreon i'll have the links in the description so thanks for watching and i hope to see you in a future tutorial
Info
Channel: Ryan King Art
Views: 38,100
Rating: undefined out of 5
Keywords: Ryan King Art, Blender Tutorial, Blender, Ryan King, Tutorial, green screen, blender, VFX, green screening, green, visual effects, tutorial, blender vfx
Id: KBBkgoDPnZE
Channel Id: undefined
Length: 23min 26sec (1406 seconds)
Published: Sat Jan 22 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.