How to use the Z-Channel in Resolve & Fusion

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I want to take this simple 3d scene and using some fusion compositing magic transform it into this now to get this final render one thing I'm using is the Z Channel and some tools that depend on Z or depth information so I want to take this tutorial to introduce what the Z Channel is how you can use it for 2d post-processing and how you can use effects like depth of field and fork effects and using this D Channel this works both in DaVinci Resolve and in fusion standalone today I'm in fusion standalone you can do the same thing and resolve as well so let's jump right in [Music] to get started if you want to follow along all you need is a simple 3d scene even a simple 3d text is more than enough to to see the effect if you want to use the same scene that I'm using I'm providing the download links and you can download this as well together with my final result and play along with it in this scene let me just show you what I have set up so I have here a simple 3d model I haven't created this myself this is coming from Shahid Abdullah and he provided this model for free on his website and you can download it as well I'm providing the link for that as well in the description and then this house I'm putting over a grass plane like this I'm just placing it a little bit doesn't matter just to make it a bit wobbly and so here I have the house over the grass playing then I'm using this hgri map here and typically you use these maps for lighting reference and lighting in in 3d tools also in Fusion here I'm actually just using it as a simple background and that's all I needed for this is also freely available and part of my download package and you can use it in this case what I am doing is I'm just putting it onto a sphere so here I just have a simple sphere so that means that my map is just projected onto a sphere and my scene is the sphere is relatively big and my scene is inside the sphere so if I look into this I have here my little 3d scene living inside a big sphere with the background then I have some lights a little bit of ambient light and is let me turn on the light right click 3d options shadows shadows turns out on lights as well so lights and shadows or no none so I have a bit of ambient light so that nothing is completely black and I have a spotlight which I put like on the sphere like in the direction where the Sun is on the HDRI map so on my photograph I have the Sun I put the spotlight in the same place so I get the shadow that looks like it is coming from the Sun you know I have my shadow and my scene and I have a camera as well at me here it is 3d camera and the camera moves a little bit like like this it moves around the house rendering it and that's already my simple 3d scene now again you can do the same you can do text effects you can do other things as long as you have something in 3d even some cubes or so you should be fine but I thought for a tutorial this looks a bit more fancy so let's use this so this is already my simple scene setup now let's talk about depth information I'm going into my renderer node here first and turn the z channel on so Z is for depth and what this channel now does is pixel by pixel on my output Vendrell it gives me an information how far this pixel or this object that the camera is capturing how far this is away from the camera so if my camera is here and captures the house and the ground plane and the background then the distance from the camera lens to the house or to the background pixel by pixel that is the information that is captured in the Z Channel now that I have turned it on in the renderer you can see that down here at the screen I see now the value so it's minus 13 here if I go towards here the house it's minus 5 if I go to the foreground here it's it's minus 3 so wherever I hover with the mouse so this is just an additional channel just like a color Channel but instead of color it's giving me distance from the camera to wherever I'm pointing it I can also visualize this let me just put this on to the left viewer for now and now that I have this turned on I can use here I have the additional Z channel here in the channel selection I can turn it on and all I see is blank white that is because the viewport doesn't display values by default which are out of range so by default color values go from 0 to 1 this is now minus something so if I want to see it I can right click go to options here and say show full color range and what this does is it normalizes the display to whatever color range the channel is giving me so in the example here if my disc if my range goes from minus 30 into something minus 3.5 then it makes the the largest values or minus 3.5 it makes that completely white and the lowest value negative in this case of - 13 - 14 this will be completely black and in between I have a grayscale picture so now I have a picture that shows me depth information in the scene and this of course changes depending on my camera position so if I go out and back you see that the grass here is gray and you have here this part is a bit grayer than the front of the house and so on so how can I can I use this now first of all you can use it for example in emerg let's say I want to add some smoke behind the house for example just as an example I add a merge node here and let me just bring in some smoke that I rendered before you can use stock effects or whatever use the particle effects inside fusion this is actually from from the template library doesn't matter I bring this into the viewer here and let me go for a few scenes now I'm not tracking this and so on I'm not putting this really into 3d I'm just doing this on one frame in 2d to demonstrate let me bring this a bit up and let's say this is supposed to be the chimney or something behind the house now the smoke is in front if I now go into the depth merge in the normal merge node here on the second tab I can enable depth merge and here I have foreground Z offset and I can use this as a slider to move the smoke forward and backwards now I actually know where I have to put it because if I check here my house or if I check the Z value underneath I see the top of my house is somewhere at minus 44.7 so you can now see if you go to minus four point let's go to minus 4.5 yeah you see it's already getting behind here and now I can really slide this back and based on the Z value it will go it will move to the background so that's a simple trick how you can after having a 3d scene rendered you can still use depth information to mask things out or to add elements even more common than adding elements is using effects for post-processing like blur and there's a depth blur tool which uses the Z Channel to blur dependent on the depth of the image let me do that instead let me remove this year that was just a quick example I go control spacebar for the menu and enter depth and there is the depth blower and if I check here is a blur channel this channel I can select which channel is being used for the blur so this channel is basically used like a mask wherever this channels from white to gray but I can adjust here the in which area of of this channel the blur should take place so let me exaggerate this a bit move the blur size up to 210 so get a strong blow and there's this scale here this is scaling my depth Channel sometimes it's difficult to use these sliders because of the the range of the Z values so it can be anything it depends on your 3d scene it can go from 0 to minus 0.5 or it can go to minus 1000 it really depends on on your geometry but here let me just put it to one so that it's in line with the values we see on the screen so now it's not being scaled and I can use a focal point where the depth blur should be minimal or where it shouldn't be blue it and I just let me just pick that let's say this corner here should be completely in focus now this is the Z depth of of this corner here and now I have my blue very strong blue and it starts practically immediately now if I want some some depth of field if I don't want everything brought out I can increase this a little bit and just you see what is happening if I adjust this so for example like this almost the whole house is in focus but the complete background is blurred out or if I go even further if I go beyond like 12 or so then the background is completely sharp and I have no effect at all so if I go maybe I want some of the house being blurred like like this and then of course the effect should probably not be that strong but maybe more like one or two or so if you want a subtle effect maybe like this you can still see the effect so I see that the end of the house is being blurred out and here the end of my plane here is now being blurred together with the background so that looks a bit smoother as well so you can do something like this and of course you can animate these parameters so if you my camera is moving so maybe my plane of focus should move as well so one thing what I could do for example I can take the depth value at different frames over the whole timeline and animate it let's say I animate here the focal point sample it here and then maybe a few frames later sample it here and again some frames later you get the idea template where I think it should be in focus and at the end I just sampled on the front something like this you can animate it in different ways you can use expressions and tie it to the camera and whatever you like but for a simple example this should should do it so this is how it looks like now now one little warning for this kind of 2d depth effects sometimes you can have issues at the edges especially if they're sharp jumps and z-depth so let me illustrate what I mean if I go back here and zoom in on my house and let's say let's exaggerate a bit again and this time okay so I have enough depth of field so that my house is completely in focus but my background is out of focus and at the edge I see some problem so my house is focused but in the blurring of the background you see that actually pixels from the house are being used to blur the background and that's just the problem with the 2d blur so when these pixels are being blurred the blur radius well I mean blurring just means averaging pixels all around right so in the average now pixels from the house will come in so that's why I don't get I still get the clean edge from the house but I see something muddy behind which is not very good in this extreme example now of course if you don't want to use 2d tools you can do real accumulation effects in 3d and can get real depth of field out of 3d let me just show it to you for comparison so let me go to the renderer directly here and now instead of the z-depth I can enable the accumulation effects here and depth of field is on and in the camera I have so I have my amount of blur and in the camera have my focal plane so with a counter setting I already get quite a lot of blue and my focal plane is 4.9 so that's somewhere here so the setting the handling is kind of similar you can decide how much depth law you want and you can decide where the point of focus is for your camera the difference is now it's really being generated in in 3d so now we don't have these edge artifacts but we have here we have a sharp edge so we don't have these problems now because it's generated from 3d but the problem is the way these accumulation effects are being generated so basically to get this the focus you get the camera like from multiple images being taken with slight variance and then they're being blurred and images that are in focus that on the focal plane of the camera they they overlap and are sharp and things that are behind or before they get averaged out so you have again a blur effect but from from 3d the problem with this is it's taking quite a lot of computational power if you want to do this on a good quality level so yes you can do it and sometimes it may be worth it but frequently the 2d post-processing is just much more efficient now let me remove this again and as a second tool that uses depth information I want to use the forked wheel now let me just after the renderer add this to a fork fork now there are three fork tools the third one the first one is the one I want to use now this uses the depth information from the Z Channel there's one which works in 3d inside the 3d geometry and there's one which uses world pass position coordinates so this doesn't use the depth but use a different render pass so for here I just want to use the very simple fork tool and I have the near plane and far plane this just says from where to where do I want the let me set this sample is just sampled the near plane somewhere in the foreground and sample the fog plane somewhere in the background and I should turn it on and there you see what's happening so I have a fork which is completely dense in the background and then goes gradually to the front very simple effect very effective of course you can change the color you can change the opacity maybe you want something like this by default it says that fox should be a bit bluish which sounds about right to me but yeah so let me just show you just with this setting show you how it looks like and this is the fork windra okay so I used the Z channel to control the depth blur I used it for the fog effect I can actually use it to control pretty much any effect I want because I can use the Z channel as a mask and then use this mask for whatever if I want to select only a foreground only a background only the mid-ground for any kind of effect infusion I can do this with the Z Channel let me show you how this works so I go back to my renderer where the Z channel is coming out and now I am I have the Z general still on the left and I'm selecting it with a channel boolean now what I want to do is I want to first copy it into the Alpha channel then do some color correction on the Alpha Channel to get it into the typical range of masks like from 0 to 1 rather than these Z values and then I can use this mask so with the channel boolean I connect the renderer and here I copy my Z channel into the Alpha so in the channel boolean where is here there is the z-buffer it says for ground but I think it should work let's see let me select the channel boolean and take the Alpha Channel a for alpha so I'm now in the Alpha channel here and now you see by the values at the bottom of the screen you see that now the Alpha channel is exactly the same as the Z Channel now the range of -5 minus 13 so this is the wrong range so let me fix this with the simple brightness and contrast I add the brightness and contrast and here I want to manipulate the Alpha Channel I can turn the others off so only the Alpha Channel and my again my lowest range is here on the background sphere is minus 12 minus 13 my highest range is in the foreground minus 3.7 so if I just enter this for low and high then this means that for the low I set my black point to the lowest value and for high my white point to the to the highest so the regular color range from 0 to 1 is being mapped to to these values so if I put minus let's say minus 12 or minus 13 for the background here for low and for high minus 3.5 for what I had in the foreground and let me put this into the viewer now I have my Alpha Channel remapped - basically the 0 to 1 range with which is in the in the visible range and with this with this low and high I basically get now sliders which determined black and white or well what is for want what is background so if I bring the low up you see that I'm the background gets gets darker and darker and gets black and I have no a slider here where I can move from foreground and include more and more of the background and the other way around with the high slider I decide where the right point is which is at the moment in the foreground and if I bring it further back then I get solid white I get a line of solid white which moves further into into the background and my area between foreground and background the the [Music] semi-transparent area of the the alpha channel here gets gets shorter so let me bring that back to the foreground and now I can use this like any other mask let me just use a color corrector to demonstrate I just add a color corrector to my renderer and put this here in the view let me turn on color and I put the brightness and contrast on the left just so we see what's happening let me connect this note of the mask input of the color corrector so I use this to mask the color corrector and now let's say I want to brighten up the foreground I can just increase the the gamma here and you see let me just do it very visible so you see I'm lighting up the scene but only in the far gone the background stays untouched and I can again go back here and you know control how far for how far back I want to go and have a very good control like this so you can select the foreground with this if I invert the mask then I can select the background with this with a bit of subtraction I can come up with something that you know select the mid-ground or select some stripe that goes forth and back so you can really have have some depth control and simply mask like this okay this was it for the Z Channel there's more that you can do with this and with other render passes and the next topic I want to tackle on this will be ambient occlusion where you can create nice shadows in in 2d and this will be a nice topic for next week thanks for watching see you then [Music] [Music]
Info
Channel: VFXstudy
Views: 26,627
Rating: undefined out of 5
Keywords: Resolve 16, DaVinci Resolve, Blackmagic fusion, Z-Depth, depth blur, depth of field, fog, motion graphics, VFXstudy, Fusion, Fusion Studio, blackmagicdesign, Fusion 16, blackmagic, tutorial, training
Id: qvZ6I4QeHKU
Channel Id: undefined
Length: 22min 54sec (1374 seconds)
Published: Sun May 19 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.