Blender VFX Masking Tutorial: Sky Replacement.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello i'm kenan prophet welcome to another blender branch tutorial in this tutorial we're going to be doing some fun visual effect sky replacement we're going to be going over some basic masking some luminance key masking and of course a whole lot of compositing could to create this final image you see here so it's going to be pretty fun and let's jump right into it so with the new scene open in blender i'm going to go ahead and clear my scene and clear the rotation of my camera by pressing alt our alt G and then G Z and v to move that camera about v blender units up staring directly at the center of the grid perfect and now we're just going to going to go up here to this top right corner or top left corner and select motion tracking tab and in here we're going to open our footage it's not the greatest footage at all by any means just pretty basic gets a job done of showing how quickly and easily it is to replace the sky with any Schoff you want to say you know have a person walk up a hill and a short film or something and overlook a city that's what this is for it's a lot of fun and really easy first things first I'm going to go ahead and hit prefetch and that Katia's in all these frames here and you can also go ahead and hit set scene frames to lock in a timeline to be the same amount of our video I'm going to we don't need all that extra I'm going to go ahead and actually end it at about frame to 45 and yeah that's good okay so we're going to use two-point motion tracking in order for our background image to match the movement of our video so really all that's needed are two tracks so I've purposefully shot this or my wife purposefully shot this for me because I'm the one in the video and i perfectly shot it with two visible sort of points here i have a light here and a powerline pole here and i want to track those so the way we do this is just hold down control or inside of motion tracking and left-click that just throws in a track there and if we just underneath track right here hit track forward you can see it track that whole thing perfectly and I always watch this preview over here on the right hand side and scrub through my entire footage to make sure that it didn't get off of that light in a dramatic way and I stayed pretty much locked to it so that's great so I'll go ahead and jump back to frame 1 and try to find a point on this telephone pole that I can track so maybe right here we're sort of juts on to an L I scale down a touch we'll see if we can track that it might get off o stayed on it's pretty impressive and ya stayed on that pretty well the entire time so that's great so that's all that's needed for our tracking purposes so now all that's left is to select one of these tracks and underneath solve if we go to loop solve if we go to geometry we want to link empty to track we'll do the same for this one link empty to track you can see up here where we have our default scene we have two empties linked to our camera as a constraint that's going to come in very handy for our background image before we get out of motion tracking what I'm going to do or the motion tracking tab I'm going to change it from tracking to mask and I'll just like new mask and name this ground and we're just going to very quickly create a rough mask of this ground and it's going to hate help later with our overall mask that we create for our for our video channel to be placed in front of our background image I didn't explain that very well but it'll make sense later for now what we need to do is just hold down ctrl and left click and just sort of click along the top this horizon here it doesn't have to be perfect because it's not a perfect mask by any means you can make it perfect if you want to take the time for that but that would defeat the purpose of me showing you what we're going to do later on so there we go we have a pretty quick and dirty mask if we press a to select everything and then hold down shift and right-click that track and now press ctrl P so what we just did is parent our entire mask to that track and that's going to be useful because now if we scrub through our footage you can see our mask stays perfectly tracked to this little point right here it gets above the horizon or the ground right here so we don't want that so I'll just go ahead and modify this a bit OOP just by clicking and dragging these points with my left mouse now if we scrub through our footage you don't want your mask to go up above that line in any way I think that's pretty good this might be a little too close for comfort we can always adjust this later mostly what the reason we're doing this is we don't want to have to worry about any of our ground disappearing when we essentially key out the sky and that'll just help for later on okay so now that we've done all that I'll go ahead and jump back to frame 1 and we can go back to our default panel and if I press 7 for top view and five for orthographic mode I'm going to go ahead and press H to hide my camera and what we need to do is if you notice here I'm going to look through our camera by pressing 0 bring up that side panel and I'm just going to check background image select the stop drop down menu add image chain views to change the views to camera and your footage that we have should be in that drop down menu right there and now if you can see what we did our empties are linked to where we did those two motion tracks so what we want to do is place an image behind our little hill here so first things first we want to add a bone to stretch these two points together so that might sound kind of strange but it's really it'll make sense so I need my cursor to be at the center of this empties the way I do that is to press shift s cursor to shift s cursor to selected and then shift a add armature single bone so now this bone starting point is at the dead center of that empty if we just tab into edit mode and position the other end of this bone I'll go z wireframe just put at the dead center of that other empty all right about there perfect so now I'll press tab for object mode and with its bone selected hold down shift and right click that empty and press ctrl P and set parent to objects so we're parenting the bone to the empty and now with the bone selected I'm going to change it from object mode to put is mode select this other empty hold down shift and select the bone and now we're going to press control shift C and then this menu comes up this is a constraint menu we're going to add constraint tracking stretch to so now that tells this bone to stretch to this empty right here so it's parented to this empty and it's going to stretch to that one and you can see it does just that if we look through our camera that bone is now stretching its ever so slight but it stretches in proportion to our footage so that's useful for what comes next so I'm going to press 7 for top view and then I'll just tab out of edit mode or I'm sorry pose mode and just select everything and I'm going to press shift a add mesh and images as planes if you don't have that right there underneath your mesh it's very easy you just go to your user preferences and underneath add-ons type images you should see this add-on import images as planes you'll want to make sure that's selected so with that done I'm gonna press shift a mesh import images as planes and go to wherever you have your background image that you would like whether its mountains or a city I'm going to use a city I just got this image off of CG textures comm if you'd like to use that I'll place the link in the description of this video and just hit import so this is a very useful add-on because it means we don't have to do any image texture and we just can import that image as a plane so I can go right down here to texture mode and there we have our image on a plane extremely useful so now what we have to do is just sort of line up this city in a way that it would make sense so you can kind of use you want to use frame 1 really as a guide you might have to rotate those buildings a touch just so they look like they're standing straight up and down in proportion to our ground probably scale it up a good bit and yeah somewhere around there so now this is the fun part with that image selected if we hold down shift and right-click that bone and press ctrl P we have our parent gene when you come up and set parent to bone so that was the reason why we had this bone stretched to this empty because now this image is parented to the bone and the bone is sort of working in direct proportion to the way our video was shot so now if we drag through our footage you can see that image moves wherever the bone moves it stretches wherever the bone stretches left right up and down and that's what really sells the fact that this is you know a real city behind not what we actually shot but we have a problem here you can see this image dips way beneath our camera so that's easy you can just scale with just the image selected you can scale or you can just drag it up and you'll want to make sure that it doesn't go over the top or the bottom we can always adjust that later once we get into compositing but I think I might just have to scale it up some more just to touch you move down this is the fun part you just want to make sure that image fills your entire frame basically or any part of your frame that will have buildings in the background instead of sky or grass I think you get the picture okay so that's good so now we jump back to frame 1 and what I'm going to do is go over to materials panel and with this image selected I'm going to change you from diffuse to emission so that has a nice emission material and I'll go ahead and underneath the render settings hit transparent just to make things a little bit faster and I'll select render so now we've rendered a very boring image of our city and it doesn't look so great but it will if we just go to compositing instead of default check use nodes backdrop and I'm going to spread these apart give us some room press shift a and add in a movie clip node and underneath this we should have our drop down footage by press ctrl shift and s I'm sorry just ctrl shift and click then we have our viewer node and as always you want to add in a scale node change it from relative to render size and this is where we get some fancy work going here I'm going to change this bottom left corner to the timeline so we kind of make some adjustments as needed and um let's see yeah first things first we want to get rid of this here sky so the way we do that we're going to use a luminance key node so I shift a go to Matt and underneath keen luminance key drop that in and we want to invert the black and whites so I'm going to press shift a add in an invert node drop that in and you want to make sure that the Matt is plugged into the color of the invert instead of the image and so there we go now we have a mask created black and white mask pretty quickly created but we want to modify it so essentially what we have here everything that's white we're keeping everything that's black is going to be keyed out so that's how we're going to get our city in the background so we want to modify it to make what we want to keep as white as possible and what we don't want to keep as black as possible so I'm going to press shifting add in a mix node drop that in change it to add and now shift a and add in a mask node and in this drop-down menu we have our ground mask that we created earlier in motion tracking and plug that in to that mix node so now these this mask is being created to help out like I said create the parts we want white to be extra white so that just enables us to not even have to worry about that ground it's automatically masked out now we want to select clamp so that those are blended together and yeah that'll make a bigger a difference later on so now I the values right here with this luminance key this is what we are going to play with to sort of clamp down on what's you know black and white so if I change the high values to about only eight now everything in the sky is black and the low values this sort of clamps in on our white mask now the tricky part you can see that created a pretty good mask pretty quickly and easily the tricky part however is when I walk into the frame so when we throw a person in there that's when it gets pretty tricky so yeah you can see now we have clouds all over again so we have to clamp down on these turning down those high values this is where you know the fun part comes in where you just have to play around it's not horrible if some of those clouds are left in kind of adds to a hazy foggy effect okay so that's a pretty good mask for now we'll definitely play around with it more but so how do we get color back into our scene we have a nice black and white mask but we need color so the way you do that is to set the alpha and then add the color so essentially what you want to be invisible and what you want to be color so we can do that by pressing shift a and set alpha node so I'm just searching for that cuz I'm lazy and I'm going to plug in what we've created into alpha so this mask we're saying everything all these black values we want to be alpha and we're going to take the image output of our movie clip after the scale node and plug it into the image of that cell I'll set alpha node so data there we have our color filled in and you can see the blue edges and the scraggly marks everything doesn't look so great and that's what we're going to spend the most time really modifying most likely and if you scrub through your footage you can see the problems honestly that when when we shot this footage it was my face is pretty overexposed because there's late sunlight you want to do this sort of effect on cloudy days not on days when you have harsh sunlight like I had because you're gonna have problems like that where someone's face is overexposed and it starts to disappear now I'm I just wanted to get this show you how to do this effect so you know I'm not too worried about that for this purpose but just for for your sake when you're out shooting your footage you really want to use a cloudy day when it's overcast it'll just help you a lot okay so that's enough that we can start to see the effect we have going if we search for an alpha over node so alpha over node plug it in between our background vendor layer and take the set alpha output of that and plug it into the bottom or I'm sorry the top of that alpha over node and select convert pre multiply I might have it backwards plug it into the bottom and now take the output of that plug it into the viewer and data there you have our city behind our person but you can see our problem here it rose above the ground and oh good so I'm going to go to top view over here in our default I'll go to orthographic mode as well and I just want to scale this up and I think the rotation we did was a little too much based off of that render so I'm going to rotate it a little to the right and hit render as too much to the right it's a little better a little more rotation yeah there we go that looks pretty good okay great so now we have the city in the background and you can make whatever adjustments you want maybe if there's a certain part of that image you would rather be in a certain area just drag it around in your 3d viewport it's all up to you how you want that looking so now it's just a matter of tweaking our mask to blend these two images together so I'm going to go back to or I'm in compositing I'm going to scape that render and just focus on this mask here so we have our color in the background so we can adjust this luminance key you can zoom your background image by pressing alt V and zoom out by pressing V I'll tip there so if we let's just see what happens if we increase these high values we get more of our image coming back into the scene that's not all bad if you want some of those clouds in because it sort of blends together anyway as background scene I think I'll just clamp up this low value somewhere around here that's not terrible I'm pretty happy with that you can go ahead and let's see hopefully this node setup isn't confusing here spread that I'll just so you can see what's going on a little better so you can go ahead and after this luminance key press shift a and add in ad spill or I'm sorry I dilate or Road node so I'm going to just go drop that in after that luminance ki and what that does is sort of clamps down on that blue line and helps to erode it so if we set the mode to feather and if you've used any sort of keen software you know how feathering works just increase that number and sort of feathers those edges blurs them essentially I did a little too much in my hair so I'm just going to tweak the feather maybe and also this high-value turn it up ever so slightly it's always the fun part of keen is someone's face starts to disappear it's all fun and games until someone's faced are students of here all right according that's kind of late in the day so I kinda need another cup of coffee or something all right so you get the idea you know it's tweaking these numbers and lesson learned shoot on an overcast day when you're doing this kind of thing it'll help you a lot if I just take down that distance to one yeah that'll be good all right now another way to further help blend these two images together what we can do is after our render layer press shift a and add in a mix node drop that in and we're going to take the output of our image after the scale and drop it into that mix node and take the factor way down not to zero but a little bit above and what that does is mixes our original footage with our background image and yeah it makes our background image hazy err and not as prominent but that's kind of a good thing especially for this kind of shots in the background you know some fog some haziness and it helps blend these together and sell it as if you know right there in the same scene it also helps to get rid of any outlining and edge issues you might have with your footage so there we go and now another thing we're going to do is after our movie clip do some color adjustments and what I want to do you can do make whatever color adjustments you would like but I'm going to go to color and hue/saturation value drop that in and I'm going to actually desaturate my original video a bit so I'm going to go a value point seven five so it's pretty desaturated the reason being my background image I chose an image that was pretty desaturated so I'm trying to kind of match those so that's good and now what I'm going to do for my background image is the exact opposite drop in a hue saturation but I'm going to turn up the saturation a bit to about 0.5 that's trying to match the saturation levels of the background image and the foreground image now what we want to do is after after everything our entire node set up here after our alpha over node press shift a color and add in a color balance node and this will further help to mix these two images together if I boost the whites a little bit to make it brighter and change the light values to kind of a warm orangey red color and then we're going to change this is just some really basic color balancing here we're going to change our dark values to something slightly blue and this is you know you might be pirate recognizer from short films and sci-fi things is really common especially for sci-fi type of shots to have this sort of color grading and that don't look quite right turn the lights down a bit might boost the mids I might go to my original video and take the saturation up to 0.8 and turn the value up that's a bad idea leave the value normal okay and you can see now our image is pretty well blended together I might throw in a color balance note after our background image and try to sort of play with the colors to get it to match our foreground our foregrounds looking a little bit warmer than the background I'm going to try to adjust that accordingly add some contrast by taking down the darks and boosting the lights and now one final thing I'm going to try to increase yeah we can increase that feather there did too that's good alrighty and I think just for smiles I'm going to move my background image so I'm in my viewport over here on the right bottom my side move that over just a touch hit render see what that looks like I want that tall building in there yeah like that so I'll escape that render and the final thing I want to do for mine is add a very simple vignette so I'm going to press shift a go to distort lens Distortion press the distort value to 1 again they look real fine and a math node wherever that is I'm just going to search for it change it from add to less than and you want it to be less than 1 or take the lens distortion value plug it into the bottom of that math node and change the value of the top to 0 I always forget how to do that I don't know why and then we're going to add in a blur node Oh hello blur node change it to fast Gaussian and we'll go value about 50 for each of these and a size of three I like my vignettes to be pretty soft and now we just need a mix node where'd you go and set that to multiply and take the output of our color corrected image into the top of that multiply node and there you go we have a vignette that we can adjust the factor of that helps with the overall subtle effect of Zoning in on our man overlooking a city so there you have it all that's left then if this were a video for you if you're going I mean if you're making a video out of this is to take the output of your entire node setup plug it into your composite node and render your animation and that's it pretty simple tutorial don't let the node setup scare you it's all pretty easy we just have our movie clip and we have a luminance key mixed with a mask that we created in the motion tracking tab and we have some fancy erode feathering going on here on top of our luminance key you want to make sure you invert your luminance key to make that nice black and white mask and like I said mix it with your other mask if you've created any other masks and then you just have the output of our set alpha node plugged into an alpha over node on the bottom and the top of that alpha over node has a nice background image of a city here and I'm not sure what city that is if you know or if you live there please let me know inform me in the comments I'm sure someone well I just found it on CD textures comp that'll look cool alright and that's it just some fancy color correction and you are done so pretty cool result I was pretty happy with it and a lot of fun sky replacement it can be extremely useful for creating professional quality visual effects in your short film or your scene so I hope it was a lot of fun and hope it was useful and look forward to the next blender branch tutorial thank you for watching
Info
Channel: Kenan Proffitt
Views: 78,145
Rating: undefined out of 5
Keywords: Visual Effects (Film Company Role Or Service), Blender (Software), Tutorial (Media Genre), Computer Animation (Industry), Sky, After, Kenan Proffitt, BlenderBranch, Blender Branch Tutorial, BlenderBranchTutorial, BlenderSkyReplacement, Sky Replacement in Blender, KenanProffitt
Id: oBBv4Plk0cw
Channel Id: undefined
Length: 29min 14sec (1754 seconds)
Published: Fri May 01 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.