Composite CGI Around Real Object - Blender VFX Tutorial (FULL)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
here's what we're after today we want to have a CG object go around a real object in our video I'll be working entirely in blender focusing on different compositing techniques to get our ring around the pot and leaves as well as adding in the reflections and shadows for the complete look let's begin here's an overview of this video and what we'll cover first the obvious steps film your footage and solve your 3d camera there are plenty of tutorials on how to do this now it's time to recreate our real world scene in 3d this means matching the geometry lighting and textures for the geometry of this shot I'm going to recreate the Box in pot since those elements will closely interact with the CG objects I'm going to add and for the actual plant leaves I warp some plain objects roughly into place this doesn't have to be perfect and you'll see why later play through the shot to make sure that everything tracks well and that your objects don't slip out of alignment for small tweaks in alignment I sometimes cheat by animating the objects position or shape keys over the course of the shot for lighting I created a 360-degree HDR eye with my raikou theta V this is how I was able to get accurate reflections in my CG object otherwise add lights into your scene to match the light intensity color and shadow quality correctly for textures I use the simple B SDF shader for both the box and pop just adjust the color and roughness settings and that should get you close enough for our needs I then use this picture I took of the top of the plant for the leaf texture finally add in your cg object of choice I added these rings okay now let's talk about how to set this all up for rendering using the cycles render engine if we hit render as is we get this which isn't what we're after we don't want our cg leaves pot or box to be there but we do want to keep the shadows and reflections and the Rings should go behind the pot and leaves so how do we extract and control these different elements well we can control the visibility of these different elements within three areas in blender cycles object visibility collection visibility and view layers visibility known as render passes these three levels of control objects collections and view layers get pretty complicated so I made an infographic which you can find linked in the description it should help you understand how objects collections and view layers work together to give you control over different visibility options and cycles so let's start to use these three levels of control to break up our scene we are going to take our current view layer and name it main objects as will use it to isolate the ring objects within this view layer we want individual control over our rings our pot and our box and leaves will place them all in their own collections to do so select one or more objects press M hit new collection so I end up with four collections one for my scene camera and any lights one for my main ring objects one for my pot and one for my box and leaves now if we right-click a collection and go to view layer we can set the visibility of the collection in all the objects that are inside it this setting is specific to the current view layer that we are in we can set this differently for different view layers you'll see in my infographic there is a section about collection visibility settings the important setting that will help us today is hold out let's set the pot collection to hold out and we'll see that this does exactly what we want the holdout setting takes all the objects in a collection and causes them to mask or paint out any other objects that fall behind them from the cameras perspective so when our ring goes behind the CG pot it doesn't show up but it still shows up in front perfect we'll set our box / leaf collection to indirect only this will allow us to see the reflections of these objects in our ring but not the objects themselves make sure your background is set to transparent and if we hit render we have the ring object that goes behind our pot and shows the reflections of our leaves and box main object view layer completed let's create another view layer and name it shadow we want to extract just the shadows cast by our ring onto our leaves pot and box so let's change some object visibility settings to do this so we'll set our leaves and box to be shadow catchers and we'll also uncheck shadow for all of them so that these objects don't cast any shadows but only touch them an object with shadow catcher enabled will still show up in other objects reflections so just to show you since we enabled the leaves to be a shadow catcher if we switch back to our main object view layer we'll see that the leaves are still set to shadow catcher here which is okay since the shadow catchers still show up in reflections changing object visibility settings in one view layer we'll change it in every other view layer as well finally back in the shadow view layer we'll create a duplicate of our pot collection turn off the original collection and for these duplicated objects we'll set them to be shadow catchers as well if we switch back to our main object view layer will see that this pot shadow collection shows up here as well this is because all view layers share the same collections so we'll simply disable it in the main object view layer finally we'll set the ring collection to be indirect only now shadows are done we have just the shadows cast by our Rings shadow view layer completed now we'll create our third and final view layer and name it glossy slash diffuse we'll turn off that pot shadow collection we made in this view layer we want to extract any light information that the ring casts on to our pot so how do we extract this light information well hold with me as I explain an important concept first you see our pot is neither totally smooth nor totally rough this goes for almost all objects in the real world when we set up the texture we set the roughness at 0.15 meaning it's still on the smooth side but has a small amount of roughness blender has a way of defining rough surfaces they are labeled diffuse surfaces blender also has a way to define smooth reflective surfaces they are labeled with glossy surfaces so our pot here is both a diffuse surface and a glossy surface some people might say it has both a diffuse component and a glassy component so in our scene the light rays that show our ring in the pot surface are those that leave the light source bounce off our ring off the pot and then into the camera for us to see them light rays are labeled by the type of surf they bounce off last before hitting the camera since our pot is both a diffuse surface and a glassy surface blender separately labels some light rays as diffuse and some as glossy we want to include both in our composite for maximum realism remember blender allows us to extract this light information using render passes this being the third level of controlling what we see in our scene so for this view layer we will go to render passes tab and enable the diffuse indirect pass and the glossy indirect pass now why did we choose the indirect option instead of direct well these particular light rays bounce more than once in our scene so they get the label indirect hence diffuse indirect and glossy indirect in blender 2.8 and above we can view what these passes look like right in our viewport by going into rendered view hitting this drop-down arrow and selecting our desired pass so here we can see what the glossy indirect pass looks like we only want the ring to show in the reflections so we'll set the ring collection to indirect only we'll also notice the base of our pot is reflecting into the top part we don't want this since in our real-world footage this light information would already be visible and we don't want to duplicate it so I'll go into the object visibility settings for this pot base and deselect glossy this will prevent the pot base from showing in the glossy surfaces of other objects now we can also switch to the diffuse indirect pass to see what that looks like you can see there's a lot of light information here and if we left this out we might sacrifice some realism in our composite same thing here our pot base is bouncing some light onto our main pot which is light information that is already captured in our footage so for the pot base object again in the object visibility settings will disable diffuse which will prevent the pot base from showing in any other objects diffuse surfaces then will completely disable our box and leaf collection as we do not want their contribution in this layer finally in our render passes tab we're going to enable the color for the diffuse I'll explain why later glassy / diffuse view layer completed so we have all our view layers set up to review we have the main object view layer with just the default combined and z pass / it we have the shadow view layer also with the default passes then we have the glossy / diffuse view layer which we also included the diffuse interact diffuse color and glossy indirect render passes it's compositing tie let's hit render image this will render out all our view layers so we can use them in our compositor don't worry about the final image this spits out now we'll head over to our compositor tab to start combining these different elements together make sure use nodes and backdrop are on I'm going to delete everything here to show you how you'd start from scratch create a composite output in viewer output node we'll add an image input node and bring in the image sequence for our background footage hold ctrl + Shift + click to view a node let's scale the background to match the render size next let's add a render layers node you should know that render layer and view layer essentially mean the same thing you'll see we can use this drop-down menu to select our different view layers based on the view layer selected we have different output connections representing the render passes we enabled let's start by compositing in some shadows select the shadows view layer now some people would just alpha over the shadows but this doesn't really give you control over them when trying to change the color or brightness notice how this curves doesn't really change the shadow at all so instead I'll add a color mix node set to multiply drop the Alpha in the factor slot set the top color to white and bottom color to black this will give us a fully black and white image let's add a color ramp to adjust the range of black and white we want Lincoln and RGB curves to add any needed color brightness or darkness to the shadows and then we'll add a color mix node set to multiply and multiply our background image by the shadows output feel free to go back and adjust the look more to your liking boom shadow is done now let's composite in the glossy / diffuse information we'll duplicate our render layers node select the glossy / diffuse view layer we made how do we composite these different render passes into our scene well blender cycles has this master equation which tells us how to reconstruct an image if we render out all the passes you'll see in this equation that most of the time we are simply adding the light passes together that is using a color mix node set to add only with color passes do we multiply the previous nodes then all this is added together again to get the final combined pass and remember this combined pass is what is output by default so when we choose a specific render pass we're just breaking out a specific ingredient of that combined pass like I've said in the previous video add and multiply nodes are the main ones we'll use when compositing you'll also commonly use in alpha over node when compositing in a combined pass like our main object which has a clear alpha channel since we were going to use an add node for both the glossy and diffuse passes it doesn't really matter which order we add them in 1 plus 2 equals 2 plus 1 that sort of deal starting with diffuse well at a color mix node set to multiply to multiply our diffuse indirect with our diffuse color the diffuse color essentially provides important color information about the pot and we're multiplying them because that's what the equation says to do then we'll add this into our overall composite for the reflections will simply add them into our image with the same add note note we didn't export the glossy color pass since it's just all white and wouldn't change the composite finally we'll add our main CG ring on top of everything duplicate our render layers node and select the main object view layer here we'll use a simple alpha over node to put this on top now how do we get those dang leaves to show in front of the ring correctly our 3d pot we modeled serve to mask out the ring properly around the pot now we could model in place 3d leaves to match exactly to our footage and do the same masking technique but this is far more work than we want remember my lazy leaves we created those just for reflections and to catch shadows so instead of a time-consuming 3d masking approach for our leaves we're going to solve this using a 2d mask I filmed the plant against the white wall exactly for this purpose so let's go into the mask tab to create a rough mask just around the leaves animate it roughly over the course of the shot and we can name this mask leaf mask there are plenty of masking tutorials hence why I'm blowing through this back in the compositor we'll duplicate our footage and scale node we can bring in the mask node and in the drop-down menu select our leaf mask you'll see this is essentially a black and white sequence with white where my mask is to separate just the leaves from the background I found that a luma matte or luma key works best luminance Keys create masks based on differences in brightness or luminance in your image so we'll create a luminance key node and play with the settings till we have the leaves or wall isolated only focusing on the area near the leaves we'll see that the mask output for this has the leaves black in the wall white meaning only the wall is selected so we'll add an invert node to switch this finally we can use the mask we created add a color mix node set to multiply and multiply the luma key output by the leaf mask output this will cut out the luma key to our mask shape finally I added a dilate and blur node to tighten up and soften the edges from here you'll see there is a mask output which we will now use let's add a set alpha node plug our new mask into the alpha input and put our original footage into the image input the result you'll see is just our leaves and a little bit of the pot now we'll take this result add an alpha over node put our previous composite in the top input and the leaves on the bottom input enable that convert pre Malta will now see that the leaves are covering the ring but in some places where they shouldn't be here you can see it more obviously on this frame the leaves are in fact on top of everything so we need to figure out a way to tell blender where this 2d mask is in 3d space to do this we are going to use Z depth compositing in blender one of the render passes created by default is the Z pass or depth pass we can take a look at this pass by creating another render layer node choose our main object view layer and connect a normalize node to the depth output this Z Pass is a black and white representation of how far different objects are from the camera closer objects are near to black and farther ones go towards white Zita the compositing takes advantage of this distance information in order to composite things at specific distances in our scene so keep tracking with me here I'm going to take this depth pass and add a color ramp node if I move the sliders close together I can create a dividing line at a specific distance away from the camera if I move these sliders left or right I can essentially select the distance at which this divide takes place I can also add a gamma node and change the value to do this more easily now if I have this mask from our leaves and I have the z-depth mask I created I can combine the two by using a color mix node set to multiply when I multiply the two anywhere that is black in either of them representing the value zero stays black in the output anything times zero is zero so where our ring shows black in our Z depth mask since it's closer to the camera it makes the leaf mask black this is perfect since we don't want the leaves to show over that part of the ring now we can take this result and use this to update the alpha input of the set alpha node finally we want to make sure that these leaves have the shadows we created on top of them so we can take the shadows we composited before and multiply the output on top of the leaves then this all still pipes right into that final alpha over node where we can see our final result so what we've just done is composited a single frame of our video we can go back into our main blender view select a different place on the timeline and hit a render image again to make sure our composited holds up at different points in our video once you're ready to render the entire animation in the compositor make sure you plug in your final result to the composite node select an output file type of PNG and hit render animation add some final color grading afterwards and there you go a final product you did it good work you can download the blender project file over on my patreon and the free cheat sheet is over there as well all linked in the description you're not gonna want to miss the next tutorial so thanks for watching subscribing and I'll see you next time [Music]
Info
Channel: InLightVFX
Views: 141,213
Rating: undefined out of 5
Keywords:
Id: fnAGtXMkRMY
Channel Id: undefined
Length: 17min 29sec (1049 seconds)
Published: Fri May 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.