Z-Depth in Blender 3d: How to use it to composite 2d elements

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys it's brad from light architect in this video i'm going to be sharing a little quick tip on how you can use a z-pass effectively to composite some 2d stock elements into your 3d scene and integrate them into the geometry of your shot now before we get started i should mention that this is actually my second favorite way of integrating 2d stock elements into the scene the best way to do this in my opinion is to actually import the stock element as a 2d card in your scene and place it very specifically in the geometry and that technique i've covered in another video i'll put a link to that in the description below however this technique of just exporting and compositing a stock element with a z-pass allows you to export your image and composite after the fact with a little bit more control over how you can tweak the element in the post-production process anyways guys let's get started here we are inside a blender this is just a little sample scene that i've set up here for the sake of this tutorial i've used some city builder 3d add-on war zone assets here and we're just going to be placing some fire in this destroyed building here and integrating it with the building geometry itself in the compositing process so super simple scene setup here i've used an hdri to light the scene and then rendering out just 20 samples and rendering in cycles now before you render out a frame of your scene you want to make sure that you're actually exporting your z depth data path so to export this path just go to your view layer properties and now we can just click to include the z depth path here and now that we have enabled that we can just go to render and render image and let's get into our compositing process alright guys so this is the render we're going to be working with here i'll go ahead and close our render preview and we'll go to the compositing tab and get started here and i've done a very simple node setup here to get started make sure you select the use nodes option and then all i've done here is i've just added a colored background where the alpha channel is so very simple node setup here now let's add some fire to this building and integrate it into the 3d geometry so first thing i'm going to do is add our fire element so i'll go ahead and press shift a and i'm going to use a movie clip where our stock footage element is saved i'll go ahead and open it here and i just have some fire elements here i'm going to use this big fire 3 element go ahead and open this and i'll go ahead and just view our element here really quick so this is what we have is we're going to composite into our render so to do that what i'm going to do is i'm just going to press shift a we'll add a color mix node add this right after our alpha over where our background is and we'll connect the stock element into the bottom input of our mix node and if your stock element has an alpha channel which mine does to get rid of this black background we can just click on alpha and now as you can see here the alpha channel is working correctly and if your stock element doesn't have a alpha channel for example if it has a black background then you're just going to want to change the blend mode to screen but anyways this is looking pretty good now what we want to do before we use the z-pass is actually just position our stock element right where we want it to be so i want our stock element kind of inside of our building here and maybe coming out through the right windows here so to adjust it i'll just press shift a i'll add a distort transform add this right after our stock element and i'll just start messing with the x and y values to position it over where we want it i want to bring down the scale a little bit as well maybe 0.75 make sure it's not too big maybe 0.8 and we just want to position it generally where we want it to be so this is a good start for the position of our element we can adjust it later as well however you can see that the fire is not very well integrated into our actual cg environment here so now it's time to use that z path to tell blender where we want this fire to show up within the 3d geometry of our scene so i'll just go ahead and go ahead and bring down our background levels a bit so it's not too bright there but let's go ahead and use our z depth pass here and we're going to use it to drive the factor of our mix node and tell blender where we want this fire to be so i'll go ahead and show you guys what the z-pass is first so add another output viewer node and if we just connect our depth path which is our z pass to our viewer you'll notice that we just have a white image here and that's because the z depth pass contains values past one which are read as white so to fix this what we need to do is we need to normalize the values so that they're only between zero and one and there's a specific node for that called normalize so i'll go ahead and press shift a i'll search for it here normalize grab it and then add it right before our viewer node where the depth passes and this is what our depth pass data is actually looking like so you can see how this could be useful essentially we're going to use the white and black parts to drive a matte for the mix factor input so before we actually add it to our factor input here i'm actually going to adjust it with a color ramp so i'll press shift a i'll go here to converter color ramp then i'll add it right before our viewer node and now what we can do is we can slowly start bringing down our black levels and bringing up our white levels and what we want to do is use the black portions of the z-pass to hide where our fire is going to be so right now this should be about right white could be a little bit brighter since we want the fire to be where the white data is so bring this down a little bit and we can very clearly you know place where we want this fire so something like this is pretty good essentially where the white values and the black values connect that's where our fire is going to be uh integrated into the 3d scene so i think this should be about right we can adjust the color ramp a bit later but now we can do is we can connect this color ramp image output to the factor of our mixed node where we are overlaying our stock element and now i can go ahead and delete this other viewer node and let's see what we get right off the bat you can see that the fire is actually being integrated into the geometry a bit better now it's not very bright that's because the white values aren't bright enough so i'll just bring the white part of the color ramp over a bit make sure everything comes through just fine and now you can see that the fire actually looks like it's inside of the building here and now we can do some more standard things such as you know add some perhaps some glare to our fire make it a little bit brighter perhaps you know duplicate this perhaps add some color correction on the fire as well i'm also going to adjust our the placement of it as well and you can see here that we're using the depth of our geometry to hide where the fire is being overlaid so it's not perfect right now we may have to do some cleanup on the edges here but you can see if we do a before and after without the actual z-pass integrated here's before just kind of slapped on our cg environment and then once we add the z-depth to it everything is integrated into the shot quite a bit better so that's how you can use a z-pass to integrate stock elements into your cg renders just for fun i might add some more fire in this right building here so i will repeat this process just uh duplicate our fire element here along with the data correlated with it i'll duplicate our mix node add this to the bottom input of this mix node and i'll reposition the fire so that it's kind of where we want it to be here on this right element something like this bring up the scale a little bit to 0.8 maybe even one this could be pretty interesting and now let's use the z-pass on this building so i'll grab the z-pass from the normalize node here i'll add another color ramp i'll go to converter color ramp add this right here grab the z depth after we've normalized it with this node plug it in here and we'll add a viewer node so we can adjust our z-pass data effectively and we'll just do the same thing here bring up the dark values again we're just trying to find the sweet spot where we want to put that fire element probably something like this is about right remember the black values are our mask so this should be about right now we'll go ahead and delete our viewer node connect our z-pass after the color ramp to the factor input and now you can see this fire is much better integrated into our environment as well and obviously there are more things we could do to clean this up and make it look better but this is just one way you can use the data of your 3d scene to integrate your 2d elements into your footage anyways guys that's it for this video i hope it was helpful feel free to leave a comment if you have any questions or suggestions in the comment section below let us know what you'd like to see next on the channel lots more visual effects videos tutorials and short films coming very soon i really appreciate all the support i'll see you next time you
Info
Channel: LightArchitect
Views: 19,915
Rating: undefined out of 5
Keywords: using 2d stock footage in blender tutorial, importing atmospheres in blender 3d, how to add atmosphere in blender, how to add clouds in blender 2.9, blender 3d clouds tutorial, blender 3d compositing tutorial, how to make cities in blender 3d, cities in blender, citybuilder3d addon tutorial, cyberpunk city in blender, lazy tutorials, khaos add-on, blender and after effects, vfx in blender, blender add-ons, film, how to use a z pass in blender, z depth in blender tutorial
Id: AVVEOrQDNgg
Channel Id: undefined
Length: 8min 43sec (523 seconds)
Published: Fri May 27 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.