Depth, mist passes and depth of field in Blender, Nuke, Natron and Fusion. #b3d

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey blender bob here today wearing a portable blue screen today we're going to talk about it's been like 10 times i've been trying to record this today we're going to talk about depth of field we're going to talk about the death pass and the mispass and completely at the end of the clip i'm going to talk about some stuff that i forgot to mention in my previous clip about finding a job in vfx so just check it out you know important information so let's start right away so let's start with something very simple it's going to get more and more complicated as we go so in the camera here i can go in the settings i can turn on the depth of field i am in cycles right now and you can see the background became blurry and the focus is on this one now there are two ways you can do this you can either choose a distance manually here so if i put 50 meters it goes all the way to the back or you can use this little thing here and choose which object you want to focus on now i click on this one but it doesn't work it goes in front and that's because blender uses the origin of the object as a focus point not the geometry itself so all i need to do is to set the origin at the center of the mass and i will get the focus point at the right place you can adjust the amount of blur that you want if you want a big depth of field or a small one to do that you go back to your camera settings and you change the f-stop smaller number shallower depth of field i strongly suggest that you take a look at my lens clip if you haven't done it already the link is in the description and right there it will give you more information about the depth of field how it works the three criteria that can influence it and all the stuff so go check it out okay so i will turn off the depth of field and now i'll go here and i will turn on the z and the mist actually we don't need the mist right now but i'm rendering it because later we're going to talk about the mist but for now we just need the z-depth okay i'm going to do a render pass in the compositor it looks like it's all white and there's no information but if i scroll around with the mouse look at the values at the bottom you can see that everything is over 1 41 and i got this like 10 billion million here so it's all there it's just whiter than white and that's the way it's supposed to be actually what i can do is to create an exposure node so that we can see the result so exposure will just connect the depth to it here and reduce the value now we can better see what's going on everything that's in front is darker and the more you go to the back the wider it is but you should never never modify the z depth pass you should not play with contrast and values and exposure and stuff like this because it will screw up the results okay so i got rid of it and now i'll create a defocus node so this is how we're going to control the blurriness of the image so the image goes into image well that makes sense and then the depth goes into z [Music] welcome to conspiracy theories i'm alex bob now let me tell you why there's a little z at the bottom i will tell you it's all because of steve jobs yes steve just by the way he's not even dead he's living on a private island in hawaii with marine monroe elvis and hitler no steve jobs remember in 2000 he had this campaign thing different and he was putting little microchips everywhere and he put one into town rosendale's head yeah and tom rosendale by the way his real name is kevin smith you know like the actor that always wears the exact same shirt and i have a theory about this too but let's go back by the way he wasn't born in amsterdam no no no the guy was born on a potato farm in idaho now steve jobs put a chip inside his head to think different and that's why they came up with the right click select that made no sense at all and also they decided to put the z up but you know at the beginning of the computer graphics you had pong and you had two little lines and one bouncing big beam beam you only had two axises because it was 2d you had the y-axis and you had the x-axis and later when the computer graphics got better they added the z to z-dab and that's why there's a little z at the bottom and that's how it is and that's my theory and don't tell me about descartes who decided how to create the coordinate system in 16 000 whatever like i wasn't even playing video games and these are this is my theory so only my arguments are good and yours are bad okay you got it [Music] i'm done now the blender folks are probably thinking we invited this guy at beacon 2022 is completely insane don't worry i will behave i will turn on the use z buffer and suddenly i get my magic exactly what i wanted i can change the value of the f-stop if i want a larger or smarter depth of field that works but i do have some issues if i look at the edges of the first ball here you can see this is like sharp and it's supposed to be blurry it doesn't work where you have a mix of blurry and sharp in the background the threshold setting is supposed to fix that but i haven't been able to make it work but even worse the big problem here is that i cannot change the focus point because it takes the camera information here and that's how it was rendered if i want to change it to this sphere instead i have to re-render the image i cannot just change the amount here it's not going to work that's kind of a show stopper for me because it works well if you're doing the entire project in blender from a to z and you're you know the only person doing it but what if it was rendered by another studio or by someone else and then you need to bring it you don't know what they use for the lens you cannot change it you cannot modify it if it's rendered in natron nuke resolve whatever it won't work the same way so not very good for working in an entire industry so it's just good for the blender ecosystem now the funny thing here is that if you're in texture preview and you preview your depth of field you actually get a better result on the edges okay maybe it's me maybe i'm doing it wrong i don't know you tell me in the comments now let's take this death pass and let's try it in other software to see how it's going to work now we are in natron the nuke wannabe so if i input an image in neutron you can decide if you have a multi-layer exr which layer you want to output i could choose the z-depth or i could decide the mist or whatever i want in our case we want the composite rgba if you use a layer contact node you can see everything that is part of this exr and you can see that the mist and the z depth are red that's because it's a single grayscale channel and it's always in the red channel the zd focus node expects the z depth to come from another file for some reason so what i had to do was to create a shuffle node and in there i just said in the red channel i want the z depth okay let me go back and recreate the zd focus note because i want to show you what happens when you just create it so i will connect my z depth and my source press one to see it and you see i got colors here what is green means it's going to be in focus what is blue means going to be out of focus in the back so you can turn it on and off the preview like this and you see if i play with the focal plane i can decide where i want my focus to be let me turn off the preview color because that's a little bit annoying and i'll put some blur there let's say i don't know 10 by 10 and here we go i added some blur to the image but it looks like it's only in the back because neutron has a weird way of dealing with the the focus you have a different setting for the front focus and the background so you see if i turn this one on everything that's red means it's not going to be in focus and you can play with it and you can adjust it i don't really see what it does let me turn off the preview color because it's a little bit annoying so here we go i can adjust the blur that i want in the front of the object for the edges we have similar issues that we had in the blender but we have the refined slider here that we can adjust to fix it okay so natron pass the test no problems now fusion has a very weird way of dealing with exrs if you drag an image in there you don't see anything if you try to look at it because you need to go to channel and tell it manually which channel is watch i would have to go red it's going to be this one here and my viewer combined red and then same thing for the green same thing for the red and same thing for the alpha and same thing for the z depth i mean seriously what were they thinking now what if i rendered this into multiple layers and on top of this you had the aovs i would have the diffuse the glossiness the transparency the normals the position passed you know the whole shebang how can i deal with this with such a limited range of channels maybe it's me maybe i'm an idiot maybe i don't know how to use the software you're gonna tell me in the comments i know you will so plan b is to use a script if you installed it that will split this image into all the layers separately so you just run that thing here it's gonna pop up this window here and you go run and close or run and nothing happens why it's because i dragged and dropped my image in there and that doesn't work for some weird reason so what i need to do instead is to create a loader node this is kind of a read node if you want and this will bring my image in the scene and you can see that if i go into the settings it has already set up the first channels automatically still not good enough for me now if i run the script again you can see that everything has been separated into different nodes which is completely useless because if i need to update the version i would have to do it one by one so i will give blackmagic one out of ten for the handling of exr files shameful okay let's keep going i added a little color correct note to get the image a little bit brighter i had some color space issues and i didn't want to deal with them all right the blur node so this is the best setting i've been able to get to get this in focus so i've played with it a lot uh there's not much control that you can do and you get some issues on the on the edges here they're very sharp there's nothing to fix it so not working very well even in the back there are some issues here oh you have to make sure that you're using the z channel also that you really plugged it at the right place when you do this right here all right now uh you have a sample button where you can just drag and bring it to the object that you want in focus so if i drop it here you can see now this object is in focus which is great all right all right fusion folks calm down calm down i know that there's a plug-in that apparently does a much better job than the default stuff i didn't buy it just for the sake of doing a test because i don't use it anyway but if you have it if you want to try it all the files will be available the link is in the description so you can try it and tell me in the comments how it worked when you bring a multi-layer exr in nuke you need to tell it which layer you want to use so you use a shuffle node and there you can pick which channel you want in this case the view layer combined is the one that i want next i create my z defocus node in it i will tell it which layer i want to use as the z channel so i don't need to do a shuffle like i did in neutron let's take a look at the results i will select this i press one and bang it works and you see i got a little gizmo here focal point i just need to place it where i want it here you go look how fast it is it's crazy fast bang bang bang it's really really cool all the edges are perfect default settings everything works great look at this beautiful bokeh you have in the back it's really really nice i was going to say just like natron but it's actually natron ukapi nuke you can also have a color preview here so if i go into setup here you see the exact same thing red and blue are blurry red in front and you see green is very very thin here so i can change the depth of field here how wide i want it right now it's at one meter and i can change it to anything i want so five and you see now i got a five meter depth of field this is in meters and this is how i tested it i created a bunch of cubes and i calculated the distance from the camera to these cubes so you can see that if i drag the focus point on top of the cube here i get the same distance i had in blender same thing if i bring it all the way to the back i get something about 25 meters which is the same if you look at the metadata of the image that were filmed by the camera you can get a lot of information so you can get which kind of camera it was the size of the sensor and sometimes you even get the lens information which kind of lens it was and the focal distance you can see on the image in the metadata where the focus was made and you could take this value and bring it directly into nuke and you would get the proper depth of feel what's unfortunate in nuke is that the thickness of the depth of field is decided by a setting called size and it has nothing to do with the aperture like in reality so you make the size setting bigger you get more blur i love that blender uses the aperture you have a maximum also to decide how much blur you want the maximum blur like if you put it too much it looks ridiculous so you can adjust this too there's another feature here you can see the focal point you have the x and y coordinate on screen of this focal point so you could track a 2d object in your scene and copy these parameters into there and the focus would track the object in the image everything is real scale here different ways to calculate the depth of field in nuke you want to use direct if you use blender this will give you the best results you can also choose the shape of the bokeh do you want a disk or do you want something with a bladed aperture so you will have like a hexagon or pentagon octagon whatever you want tons of settings like this you have something similar also in blender and you also have an image if you want a specific image for your bokeh then you can put it right here okay so nuke nailed it no problems at all but you know that's a simple scene it's just a bunch of spheres let's try it with a scene that's a little bit more complicated let's try this scene here it's a little island i did for a clip i'm working on for a friend of mine and you can see there's a lot of details here very tiny leaves this is a worst case scenario for doing the depth of field in compositing the plans come from islandscapes that i bought on the blender market and the plants are absolutely fabulous it is spectacular this is the image i've been working with this is a version with a depth of field rendered in cycles and for this one i went to the extreme so this is quite a challenge so same setup as before i create the defocus node i will change the aperture to four and i get this well it looks okay so let's zoom in to see how it looks like now if you zoom in and you see all these little squares here everywhere that's because you're on preview so it's a fast way to render it if you remove it then you will see the real result so we get some a little bit of ghosting here there's some some artifacts here some stuff don't oops what's going on here so yeah it's not perfect let's see on this side here now it's a total mess we don't know what's going on i tried to play with the threshold back and forth more or less and i just couldn't fix it unfortunately i will spare you the 20 minutes i fiddled with that thing trying to get it to work there are so many settings here and at the end this is the best i could get i mean look at this shape here just what is that and here's a big blurry mess it doesn't work at all here it's just absolutely horrible it's unusable resolve didn't do much better artifacts everywhere just not a good result there are so few settings in resolve to do the adjustments that it's really hard to get something that works very well okay so let's try in nukes see what it does i don't see anything because while i'm not looking at the zd focus node i'm an idiot so let's select it and press one look at this look at the plants and foreground completely blurry it works so well well that's a little bit too extreme let's reduce it a little bit more it's just perfect it just works and i can decide where i want my focus right here look at this look at this it works no artifacts it's all good if i change the focus to plant in the back look at the plants in front they get blurry but doesn't affect the background it's mind-blowing okay now we're going to push it even more we're going to try with the same scene at night because i want to see how it's going to react with the bouquet so what i'm doing this time is to create a lot of little spheres everywhere and they have an emission shader with random colors the idea is to simulate lights all over the scenes some are behind the trees some are in the middle of the trees some are in front of the trees so i want to see how the depth of field will react with these light sources this is the shader for all the little lights it's very simple random in the factor and then you create a ramp and you connect it into the emission change the value of the emission and that's it so this is what i got it's not exactly the result i was expecting i was hoping to see more of the branches passing in front of the bokeh but it didn't really happen the way i expected it not much better on the neutron side i do get a little bit of the effect but it's not that good here i get a white dot in the center so this one is just cut right there by the tree trunk it's not that good and they all look kind of boxy it's kind of similar in resolve i got here a little bit of the effect i wanted for let's move around the image maybe i will find something better oh you see now this is what i was expecting something like this it happened in a few places but you can see also that's kind of a square effect that happens in the bokeh so if i play with it a little bit more maybe i can see more or less of this square effect anyway it's not that good yeah here you can feel the cross effect and the nuke guess what this is what i wanted this is exactly what i was expecting and you see this one consider plans well looks like there's no anti-aliasing here that's because the z-depth doesn't have anti-aliasing so the only thing you can do about this is to render like in 4k and do the exact same thing and then you will see the difference you get smaller pixels therefore it looks better and you can also reduce it back to 2k i've played with the settings even more and now i get the blurry effect in the back here so you can see the bokeh going through the plants it's really really nice of course if i go back to this area here you will see that i don't have enough resolution so i can see all these dots so again render in 4k and bring it down to 2k okay so now let's talk about the missed pass in order to create a miss pass the first thing you need to do is to turn on the layer mist of course then you will go into the camera and you will set the settings to mist so you can see the distance where the mist is going to go from what to what so you turn this on here and you will see a line that will appear here with two dots at the end third step is to go into the world settings and then you can adjust the beginning and the end of your mist so if you go here you have the setting here missed this will appear only if you turn it on if it's if you don't see it it's because you didn't turn it on the render layer so this is from where i want it i want it from here because this is the first thing i see in from the camera so it's this plan here and the second one is to decide how far i want it so i can reduce here the amount so i could put it to the last tree i can put it anywhere i want i decided to put it a little bit behind the island because after this it's just water i don't really care i strongly believe that the mistpas should be set as a per camera basis because you may have multiple cameras in your scene and if you set the mist from one angle doesn't mean it's going to work from the other angle now i do my render and in the viewport shading i put it to miss so i will see the mispass this is what the miss pass is going to look like it already looks like mist that's why it's called mist because it's designed to make mist and now i can play with the start and the depth and i can adjust it the way i want it if we take a closer look you will see that i get some issues here look carefully you see i got all these points here what is going on it's very noisy and if i look at the plants in front and the foreground you will see i get issues also on the edges of this plant this is because i get a transparency map on these objects just to make sure i flooded a plane with one of the plans that was giving you a problem and you can clearly see on the edges it doesn't work well i rendered a similar setup in maya with arnold and i don't have this issue so it's a blender bob not blender bob a blender bug and i already sent a bug report the way to use it in comp is very easy you're going to create a mix node and in it you're going to plug the color do your beauty pass and you're going to use an rgb for the color of your mist i will make it a little bit bluish just to make it more you know colder and then you use the mist pass and you plug it in the factor and here you go you get mist in your scene you can use a curved node and you're going to put it on the mist right here and if you play with the curve here you can adjust the amount of mist that you have in your scene the grainy effect that you have here is because of the transparency bug that i just reported until they fix that bug the only thing you can do is to add a blur node and try to blur it a little bit but you know it's not the best one thing that's important to know is that when something is in the mist it becomes also a little bit blurry because the light gets diffused you can clearly see it here look at the edge of her legs compared to her purse the purse is sharper but the legs are completely blurry and that's why you always need to do the missed past first and then you do the defocus you could also use the z-depth for the mist if you want to there's nothing stopping you from doing it you would need to create an exposure node because if you just look at the z-depth as is you will see that it's completely white so there's no details you don't see everything so you just connect it to the exposure node and if you reduce the exposure you will be able to get something similar to the mist but you can see the background is completely black maybe that's not what we want so what one is a white background i will just create a mix node just put it right after and i will click on clamp i need this to be on the second one so now i get a white background if i want to make some adjustments i can do like i did before i can create a curved node so i will just move this away and create my curve node curve curve curve here and just play with the curve so i adjust the amount of mist that i want and now i'm just going to move some stuff around make it a little bit cleaner and what i need to do now instead of having the mist connected to the factor i'm just going to connect what i just did and see the result and i get my mist here that looks like crap that's because of the bug i just reported the only temporary solution that i could see is to create a blur node right after the rgb curve and just blur the z-dip a little bit so blur i'll put it here put let's say five and five and so it's a little bit better but you know i mean there's nothing we can do right now they really need to fix that bug and as i mentioned before after this you need to add your defocus so you need to do it after you do the fog because you want to blur the fog with it so i will create my defocus node i will connect the z depth on it and use the z buffer and that's it i adjust the f-stop and i'm in business so the depth pass and the mispass are very similar by the way you should always use exr full if you do this because you will get more control you will get a better result now the depth pass is used to create the depth of field the other one is to create a missed atmosphere but you can also use the myth pass to create the depth of field it's still going to work this will not work in blender because it uses a distance that baked in in the z buffer but in nuke you can use the mist instead and you can instead of direct you go to depth and then you can use it and you can change the focal point and it's going to work the settings are going to be a little bit different but it's still going to work like the focal plane is like a very tiny numbers it doesn't work in meters like it's supposed to work and you can see here i got this glow around the plant and that's probably because the mist pass is anti-aliased and the z-depth is not and there's a reason why it's not it's to avoid these artifacts okay so now we've been dealing with the depth right but what if we want to do it vertically you know like smoke on the ground or something like this this is called well a wide death but in blender it would be a z that but now it becomes completely confusing so let's try it a vertical depth or gradient all right how can we do this well some software like renderman they already have it in the in the aovs you just click it it's going to do it for you but in this case we're going to have to do it manually and this is how okay now i'm in maya why because i want to show you how it's done in maya because i'm trying to do the same thing in blender and i'm having a hard time so on my shader i want to create a ramp and this drama well i'm going to make it as a projection it's a planar projection and in this projection here i can see my ramp all right so now you see i got this little green thing here hold on let me catch it here so i got this little thing and that's my projection box and this is where the image is mapped so it goes from zero to one you can see it fits this square here and if i scale this projection box it's gonna scale with it so now i need to adjust the box and i need to adjust the ramp place it wherever i want it and i get my y depth it's a cheat but it works let me show you the same thing with the texture instead maybe it's easier to understand so this is the projection if i do it on a plane you can clearly see how easy it is to do a projection in maya and you have many other kinds of projections you have cylindrical projections tri-planar projections spherical projections and they all use a gizmo like this that you can use to really orient your textures properly and it's very very nice and i wish we had something like this in blender no to developers want it please so i thought i will do the same thing in blender i will create a ram then i will create my mapping node and my texture coordinates i will plug it into the effect and then i will create an object it's going to be a plane that i will use for my reference projection whatever and then i will just use it as an object in the shader right then i will create a new render layer and i will assign the shader as a material override now the big problem with this is that we're using a shadow override on everything so that means we're going to lose the displacement maps and we're going to lose the transparencies and it may work in some situations but most of the time probably not going to work well it's hard to see anything with a black and white image i'm going to put a ramp instead so now i got this why is it like this in diagonal i played with it but i was going nowhere and it's really long to render all these plans so i thought you know what i'm just gonna create a plane in the background it's gonna be much faster this way can anybody explain to me in the comments how this thing works to use an object as a coordinate for textures because i just don't get it i i scale it's in diagonal so if i rotate this well then i get something all right so this is what i want but why is it like this i just don't get it i don't know how it works so i will go back to my black and white ram that i had before now don't get me wrong i'm not complaining about blender i just don't understand how it works why you select an object like a plane and you want to use it as a projection for the coordinates and it just doesn't react the way you want it i i don't understand how it works if you know please tell me i would be glad to learn about it you see back in maya i had my ramp and i just added a little bit of noise in it and i got this really nice pattern i could even animate it and make something cool so this is my maya wide depth so i had to mess around in blender to try to get my ramp in the right orientation and i played with it until i get something that's kind of decent i added some noise also and well this is what i got it's not as cool but it's better than nothing it's the exact same setup to compete in blender and you can mix both the y and the z together to get a really cool effect okay so this is the part where you're gonna hate me this is the original image it took 5 minutes 12 seconds to render this one has a pretty good depth of field on it and it took 5 minutes 11 seconds this one with a very heavy depth of feel took 5 minutes 29 seconds so it only took an extra 20 seconds out of a 5 minute render to get the real proper depth of field so why would you want to use the z-depth then well there's a reason for it first of all you don't get any artifacts this is the same thing with motion vectors if you can render with real motion blur do it because motion vectors it's a cheat and you will get artifacts and doesn't work all the time most of the time actually you will get problems with it so you get a proper depth of field but in some situations for example right now we're working on a movie and part of the story is on a bridge at night and of course it didn't build the entire set of the bridge to just put a section they just created a section of the bridge and we do the set extension in 3d now because it's at night we have a shallow depth of field and it's much easier to just adjust it in comb because it's fast and it's interactive and you can see the result right away if we do it in 3d we try something we send it to compositing they will say well it's too blurry send it back we re-render it's not blurry enough and what about if you have a situation where you have somebody like an actor walking towards the camera the focus is on this guy but the depth of field will change in the back so this is easier to set up and come so you can really adjust it you can keyframe it you can change the focal distance as you as you do your compositing now about my previous clip i did about finding a job in the vfx industry there are a few things i forgot to tell you when you make your demo reel you need to give a description of what you did in the shot especially if you have many people who worked on it so you need to mention well i did the animation for this i modeled this part this and that all right i didn't do it in my memorial because i'm not trying to find a job it's just a demo for potential clients to show what the senior staff can do at the office all right another thing never steal someone else's job okay never ever do this because it's very tempting sometimes to see some cool stuff and just pretend yeah i did this there's no way to check actually there is a way to check it's called google images don't do that it's bad it's really bad one time i had a guy who came for an interview and he showed me stuff that i did myself and i told him about this and said no no that's not true because this company did this and i was there and you weren't there well i was also freelancing so yeah the guy didn't get the job okay don't do this never steal someone else's job alright bye
Info
Channel: Blender Bob
Views: 12,938
Rating: undefined out of 5
Keywords:
Id: 4NI6yeVM4TM
Channel Id: undefined
Length: 29min 43sec (1783 seconds)
Published: Sun Aug 28 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.