HDRIs Just Got Better

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
you know one of the first tutorials everybody always looks up is how do i set up an hdri so i get realistic lighting and reflections and all that and that's well and good but um of course hdri's have a major issue which is the fact that this thing looks like a massive sphere on the environment meaning it doesn't look like our sphere is actually sitting on anything so today i'm going to propose a solution that kind of takes our hdri and projects it so that we actually have a floor and the nice thing about this is the light's still coming from the same direction we have the shadow catcher in some sense or really the environment is the shadow catcher and this is just kind of like a nicer way to work because we can actually uh see this thing on the ground plane it works with reflections and all that so let me teach you exactly how to do this so new blender file by the way i should mention there's a super complicated but technically way more accurate way of doing this we're not going to do it because it uses a bunch of nodes we're going to keep it simple so this is the effective not perfect but a simple solution so first of all let's set up our scene as if we were setting up an hdri so i'm getting rid of the light and changing to cycles these are just things you do whenever you set up an hdri consider this the crash course what you do is you go to shading you go to the world tab since we want to affect the world let's actually see that with rendered view and if we were to add in a environment uh texture node and connect that to the color um really just like you'd import in an hdri normally all you have to do is pick an hdri and then you're pretty much good to go uh right this is the basic setup where you get your light coming from i guess the sun direction over here and everything works the way you would expect but again we have this issue where this thing's like a massive sphere again on the environment shader makes sense but it doesn't have a ground plane so here is the solution first thing we are going to do is we are going to add in a sphere and then ideally we want this to have you know more geometry is better we don't want to overdo it but something like 100 by 100 is plenty a point is a sphere has a pull on the top and bottom and this makes some weird stuff for our projection so the smaller the pole is or the more geometry we have the better um so take your sphere make it like a bit bigger doesn't have to be massive ideally just hide it and go closer to your cube and unhide it so now we're inside the sphere um which which is dark it's again scary but once we are inside the sphere we are going to go to the object um material settings so we're going to give our sphero material create a material and for this we are going to make a image texture so not an environment texture but an image texture of the same hdri so that should be loaded in right here um so currently we kind of have the same setup where our cube is inside a sphere and that sphere has this hdri projected um the nice thing about doing a sphere and this is why we did it is if we go into edit mode we can actually take the bottom hemisphere in other words everything that is the floor and flatten it or project project it up to the ground plane uh to do this we need to select the bottom hemisphere quick way to do this is you select the middle like edge loop right click mark c and then if you go into face mode and click l while hovering over here it's going to select this area so that's a nice trick i'm going to go to 3d cursor so i can scale this downwards so now this is scaling like inwards towards the 3d cursor and of course we want to scale this exactly by zero so that now we have this ground plane projected correctly so inside the camera view and i guess we should make our sphere a bit bigger so our camera is actually inside of here now you can see we've kind of created an environment where we can bring our cube up and um even though the lighting and the shadows don't work yet and we'll figure out how to do that in a second you can see we put it in this environment now one quick trick that will make everything much more easy to navigate and much more realistic in some sense is in your view in other words this is the camera but for only you know the viewport before you actually you know go into your camera take your focal length and set it to something smaller like 20. uh this is what's going to let you kind of navigate around like this is a globe right so you can pick your focal length here you don't want to get crazy with it okay so again move it up and i'm going to pick a focal length of 20 or so okay one thing you are going to notice i guess two things really is first of all if we disable the sphere you're going to see that we're kind of looking at a different direction and second of all the lighting changes we don't want either of those things to happen so starting off with the direction thing what we can do is first of all look at the direction so we have a path going in here and all we have to do is take our sphere and then rotate it so it's matching roughly doesn't need to be perfect the same direction of course it's not going to look exactly the same because we didn't align it perfectly and we have a weird focal length but this is just a way to get the sun direction roughly in the right uh direction and stuff like that so again we just rotated the sphere itself um finally here you're going to notice again the lighting's a bit different it's much brighter when we don't have the sphere and of course that's the case because uh when we have this kind of dome casing the lighting is coming from here and the environment kind of can't enter because you know there's a hard exterior shell to fix this we're going to select our sphere go to the um cycles properties object properties whatever you want to call it uh go to visibility and we are going to disable shadow in other words now the light is kind of seeping through our a dome is a good way to think about it so before the light couldn't enter um and now it can so you can see this is before shadow and after shadow and now we we kind of have the full setup but it would be nice if we have a shadow you could either do that with a shadow catcher by adding in a plane although i find that's not a very elegant solution what we want is to turn our dome at least the floor of it into a shadow catcher itself and here is how you would do that well first thing you might think is let's add in something like a diffuse bsdf or really any kind of bsdf and while that does give us a shadow because now there's proper lighting interactions you're going to see that it makes the whole thing look weird again this is because now it's uh using this as lighting information and there's a whole bunch of weird stuff going on so somehow uh we want this diffuse bsdf because it gives us the shadow but only on the floor not everywhere else okay in other words what we want to do is we want to do a mix shader we are going to mix this bsdf with the version without the bsdf okay so on one hand we have bsdf and on the other hand we don't so somehow we want both but just preserving the shadow um a quick way to make a mask between these two that kind of isolates the ground plane is we are going to use texture coordinates and i realize uh this part is going to be slightly harder than the rest of the tutorial but just follow along and just put the nodes where they belong and you will be good to go um texture coordinates we are going to look at object coordinates which gives us the coordinates of this dome one thing we can do with this is use a vector math node to get the length of these vectors again uh don't worry about what these mean if you're not like a node wizard you just wanted a ground hdri just follow the steps and it will work and this outputs the length of the object coordinates which kind of already makes a nice radial mask or spherical mask from the center just to make this bit nicer we are going to use map range so this gradient works for us first thing we're going to do is we are going to invert the output so you can see right now this is sort of going to do what we want when we set this as the factor if i can actually make that connection set that as the factor you can see it kind of does what we want and by the way sometimes you just have to update the shadow you just like enable disable enable and that will make it look more correct um this kind of gives us what we want in fact they might be uh backwards yeah this kind of gives us what we want where the floor has shadow in other words it has the diffuse bsdf and everything else doesn't but um because the floor has diffused vsdf it's actually going to get brighter because of lighting changes and stuff like that so we don't want this gradient to be so expansive because anywhere where this is white we are technically changing what the ground looks like uh so what i recommend is taking the input just bringing it down just so it's like exactly what you need you don't want to overdo it or under do it or whatever we do that and then we can also soften uh this gradient by doing that and also switching over to smoother step which just changes the interpolation type and this just smooths stuff out uh quite a bit and we can make that smoothing more or less intense and you can see that you can kind of see the boundary here so the softer we make it the better so right now we have a setup that's pretty much seamless you could work on this map range to get slightly better results but um the nice thing about this is again we're getting the lighting we are getting the lighting from the hdri because the light is going through the shell um but we're using the shell as not only what we can see but it's also a shadow catcher we have the ground projection we can pick the um focal length and stuff like that and one thing that i guess i haven't mentioned that's actually very nice about the setup is because we only disabled shadow not any of these diffuser glossies if instead i was to add in a object that's kind of reflective so i'm going to make a mirror ball sphere make a material make it metallic and less rough because of the way we've set this up shade smooth because of the way we've set this up it's actually going to reflect even though the light is coming from the hdri it's going to reflect uh the dome which is perfect you can see that the shadow that's being cast on here it is in the reflection and that makes everything look super nice so even if you do not match your hdri like projected sphere with the environment it's still going to look pretty good so again reflections from the dome and you can disable that by messing with these but lighting from the original thing and this is just a nice way to visualize your models if not render them like i showed you how to do you could quickly swap out the hdri by first of all swapping out the one that you have here and second of all swapping out the one you have in the world tab and very quickly you could get different results let me just show you how you do that hdris let's do a indoor one and ideally so you can see the lighting changed but the reflection hasn't um ideally you pick hd rise with a very far away horizon line uh just so that we don't get any stretching on the bottom but in general you can see this does exactly what we want it to do it reacts to lighting situations make sure you update your um shadow thing reacts to lighting situations and reflections and all that and again what i was talking about before is this kind of distortion we're getting over here that is minimized when the horizon line of the hdri is far away um but any model you want to put in here a car or whatever whatever it's going to work it's going to look realistic by virtue of this whole setup so let's just go into rendered view go to our camera again if you are looking at your camera and you're seeing wow everything's starting to look super flat unlike when we were in the viewport even when i move around right everything's looking super flat um go to your camera properties focal length bring that down again so this one's for your camera and also one thing i should mention i feel like i feel like i'm just adding more and more on but this one's pretty cool um by the way before i do that i use 4k hdrise you can see this one's 2k and there's not a lot of resolution on the floor especially since we projected it the original one was 4k uh the thing is if you enable depth of field and let's say we you know depth of field uh put our focal plane on the sphere uh make it a shallower depth of field like way shallower uh you can see that depth of field works with this as well because the hdri in some sense the background is actually uh geometry based right um so we can actually get a blurry background but have the floor in focus et cetera so anyways i think that's kind of the essence of what i wanted to talk about with this ground projection again i just want to reiterate there is a way let's unhide this there is a way to do everything this whole kind of setup in the world shader but it involves a lot of math and not only do i not understand it but there's a good chance that you will not understand it um if you didn't even already know how to do this no no offense it's just a thing anyways i hope you learned something in this tutorial this ground plane projection is great for you know any kind of realistic thing you want to do and uh yeah one file for let's say this scene is going to be available on patreon if you just want to play around with this patreon is a great way to get blend files for any project that i make you can also get exclusive tutorials um that i do not upload on either youtube channel this or cg matter discord access behind the scenes stuff like that but generally i want to say thank you to all i think now it's 560 keeps going up um all 560 patrons who thought it was worth it and wanted to support both channels i highly appreciate it and to all people listening now who want to do that as well thank you trying to provide um unique and uh novel you know creative ideas nearly every single day with blunder but now you know you know what a way to finish now we know how to do the ground plane projection and uh yeah i hope you enjoyed and that is the show
Info
Channel: Default Cube
Views: 168,347
Rating: 4.9446983 out of 5
Keywords: blender, tutorial, hdri, ground projection, background, environment, 2.92, 2.91, 2.8, cycles, eevee, cg, cgi, 3d, animated, vfx, shadowcatcher
Id: RsAUfQlZH_w
Channel Id: undefined
Length: 13min 11sec (791 seconds)
Published: Wed Nov 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.