Godot Lighting HQ - GI Probes & Global Illumination - Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
greetings and welcome to be indeed dot beers my name is Alan thorne I've been a game developer for the past 20 years and loved helping people learn how to make games in this movie I'm going to show you how to use the GI probe system right here in the Godot engine this is a great system for creating high quality lighting results for your 3d scenes now the Godot engine has two different lighting systems and you need to use one of them and make a choice we have the light baking system we have a tutorial covering that that's a great option if you want to choose good-looking lighting that works on a range of different hardware from really old hardware to new hardware but in this tutorial we're going to be looking at a very high quality system called the GI probe system global illumination system and this is for creating lighting that works on high-end hardware console style hardware desktop hardware it's not really going to work well on older hardware but it does achieve really great results with complete reflections and diffuse into reflections in short the GI probe system that we'll see in this tutorial is the option you want to choose for creating the highest quality lighting result here in the Godot engine in this tutorial I'm going to show you step by step how to start from practically nothing and how to build up a scene that's going to work well here using the GI probe system [Music] so let's get started in this tutorial creating lighting using the GI probe system as mentioned this system is for creating some of the best quality lighting that the Godot engine can offer but it's performance intensive now to demonstrate this system I'm going to begin here with a Cornell box scene you can download this project file from the link included in the video description it's pretty much an empty Godot scene that I've already gone ahead and configured here we have pretty much a box inside a box now each of the walls and the ceilings and the floor of this box have different color materials so for example here we've got a blue floor a green back wall the wet set the red side wall here these are all based on the theme that runs through the Cornell box now the Cornell box was developed in Cornell University where they were exploring lighting systems in computer graphics in this scene here you can see that we have a prop this cube at the centre of this room and as you see when we're going to build up the lighting inside this scene you'll see the different reactions we get from the surfaces in this scene so I'm going to be setting up the GI prep system to illuminate this scene that we have right here now this scene has the default lighting applied and you can see inside the hierarchy panel here inside the scene tab we have pretty much just a few meshes and that is basically it now the really strange thing about this scene is that it comes with a sky for an exterior environment and actually we can see all of these objects if you take a look at the scene we have no lights at all so actually everything should be completely black but that's not what's happening the reason for that is because Godot has applied some default lighting to this scene so actually even when you create a completely new and empty 3d scene lighting is already taking effect if you want to get the most control of your lighting we need to find out how to access these settings so you can change them now to do that we're going to create a new environment object I'm going to move to the scene tab here right-click on the scene root and choose add child node to display this child node section and I'm going to be adding all world environment I'm going to select that object from the list and then choose the create button here to add that to the scene now by default the world environment object is pretty much devoid of any information if we take a look at the inspector here and we expand the environment tab you can see it says empty but we can just click on the drop down here choose new environment and bang straight away the moment that I add a new environment take a look at what happens inside the scene everything turns completely black now the reason everything turns black is because this environment note that we have just added is completely overwriting the default information that Godot was applying to our scene all that default lighting gone it's been replaced by this world environment node and now we have complete control over the environment lighting in the scene perfect I'm going to expand the environment node here and just expand the ambient color field I want to make sure that the ambient color is set to black notice if I set that to white we have complete white permeating the scene and illuminating everything we have this bright white light shining in every direction illuminating everything and it looks terrible absolutely terrible so I'm going to drag the slider back down to black to completely subtract all ambient lighting from the scene I want to have the direct and indirect illumination controlled entirely by the lights in this example so I'm going to remove all of that data you want to make sure that is set to black now the next thing I want to do is to add a light into the scene well that's pretty simple I'm gonna go back to the scene tab right click on the root object choose add child node and I'm going to be adding a light we have a direction we have a choice here of directional lights Omni light or spotlight I'm going to be choosing the Omni light which effectively casts illumination in all directions so it begins from this center point here and cast light outward for a particular distance so I'm just going to position the light and I'm gonna position it maybe just about here like so now in some instances you might think well that's all we have to do but you would be wrong you can't just drop a light into the scene and expect the illumination to look good lighting in computer graphics simply doesn't work that way and we can see a clear example of that right here in the viewport I have dropped this point light or this Omni light into the scene and we're getting some illumination you can see that on the cube here we've got some lighting coming from the Omni light lighting up that cube perfect but notice that this side of the cube the lucky side facing away from this light and actually if I rotate my view around to take a look at these two sides they're facing away from that Omni light and they are completely black now lighting in the real world doesn't work like that it first of all is cast on the light it hits a surface let's say this wall here and bounces off of that surface and hits the backside of this cube so what that really means is that this back side of the cube shouldn't be completely black there should be some bounced lighting on that cube that's known as indirect illumination now there's the reason that this is happening is because by default these lights will only calculate direct illumination and that's it the GI probe system that we're going to be adding will calculate the indirect or the bounced lighting for us automatically so I'm going to be adding the GI probe system now before I go ahead and I do that I want to select all of the meshes in the seam so I'm going to be selecting the Cornell box object here that's the environment object I'm going to move to the geometry instance tab this is a mesh object I want to make sure that I activate the use in baked lighting checkbox I wanna make sure that's ticked on if that's not switched on this object is not going to be affected by the GI probe system I'm going to do the same thing for our cube object here I'm going to make sure used in Bank lighting that switched on as well so both the prop and the environment have that option activated and that means that when we add the GI probe system they're going to be affected now to add a GI probe object again is really straightforward you just move to the scene route here you right-click and choose add child node and I'm going to search for GI probe and select that option and choose create now as I add the GI probe object it appears as an enormous cube basically and I want to make sure that this cube surrounds my environment this should represent the entirety of the region in our level that we want to be affected by the GI probe system now in this case I have these handles these red handles that I can click and drag on to resize the GI probe to fit the environment now sometimes these kind of get tangled up with these arrows here so if you want to tweak the size you can also move over here to the extents setting to begin to change some of these values so I'm going to just use the settings here in the inspector so I might set that up around about there and do a similar thing for the y axis I'm going to use the translate tool the move tool here with the W key to kind of bring the probe further up into the center of the level so that as I tweak the Y parameter here in the inspector it's going to Center in on that level so maybe somewhere around there and kind of center that object up I want to make sure the environment is completely contained within the boundaries here I'm going to do the same thing for the z-axis and maybe something kind of like this so that's looking pretty good we've now got this cube assigned and centered around the scene I'm gonna zoom in just a little bit to the scene here you can see the kind of the subdivisions of this grid here and we'll see in just a second how that works now in positioning this object I want to move to the top here to the button in the viewport that says baked GI probe before you go ahead and click that button make sure that you save your scene I can tell that my scene isn't saved simply by moving over to the name of the scene here you'll see the little asterisks here to indicate that it's not saved just press ctrl s or command s to save that scene and then choose the baek ji i probe button now in doing that you can see that some really important changes have been made but they're kind of hard to see because we've got this grid in the way here now you might think that you could actually just hide the GI Pro by deactivating it here but you're going to deactivate the results inside the viewport instead you want to choose view and gizmos and then move down to GI probe and you can deactivate the visibility of the probe here inside the scene so that I can't in fact see the probe now when I take a look at the probe here inside the scene you can begin to see and you can see here that suddenly the face here that was initially black in fact I can deactivate it to show you the before and after you can see that although this was completely black by reactivating this now we're actually getting lighting here gonna move to the other side and you'll see a very similar thing where we previously had black we no longer have black because it's calculating that indirect illumination that's pretty good but still there's this kind of weird banding shape here that we're going to adjust in just a moment now the next thing is that this is an interior scene so we have some optimizations that we can apply to the GI probe to optimize for that if I move over here to the inspector panel I'm going to activate the interior option you can see that in doing that it's conserving more energy as its bouncing around the scene and the intensity of the lighting for this interior scene increases in addition to this I want to move over here to this setting here you want to make sure that both the bias this setting the bio setting is 1 or greater if you go below the value of 1 you're going to get some strange artifacting on your lights you can see here even I've got some strange artifacting on the side of this cube here that I kind of want to get rid of and I'm going to be using that by tweaking the normal bias I'm going to set that to 1.2 and in changing that to 1.2 see how the quality of my light for this interior scene has radically improved so if you get some of that banding or that artifacting on your scene you want to make sure that you tweak the normal bias so you can see here already straight away we've got this illumination in the scene we've got Bounce lighting hitting this green wall it's bouncing from that green wall and you can see that it's tinting part of the surface of this a green shade it's matching the color of that wall we've got a similar thing going on here the light bouncing off the red wall and hitting that cube really similar thing going on now we can also increase the energy and the propagation these two settings can increase the brightness or the intensity of the light inside this volume I'm pretty happy with how this is looking I could maybe go ahead slightly further and just bump up the brightness just a little bit and you can see the effect that is having I'm just going to rebake my GI probe very often you won't need to do that unless you really radically change some settings that we'll see in just a moment now you can see that not only do I have these diffuse into reflections of different colors bouncing off but if you look at the walls here of this environment you can see that it's also giving us reflections we have these really shiny surfaces and we can see the reflections in this now you can try to improve the quality of the reflections and your illumination by increasing the subdivisions of the cube if I go back to take a look at my GI probe cube here inside the scene you can see that I can change the subdivision settings for example 2 2 5 6 and then choose bake that's increased the intensity and of the subdivisions of the cube let's just hide my GI prevelant we need to see that anymore and in doing this you can try to improve the quality here of your reflections by increasing the subdivisions of the cube I'm just going to switch that all way back to 64 and rebake you can see the effect that's having now in doing this we're increasing or we're increasing the performance we're getting better performance because we're using less subdivisions on the GI probe cube but we're also here reducing the quality of the reflections and the diffuse into reflections so you will need to tweak several different settings on gie probes for your scenes and every scene is different it's different in terms of the objects you've got different in terms of the size of the scene you will need to tweak fundamentally the subdivision settings and these bias settings here to get the best result if you're creating an interior scene make sure to activate that interior checkbox so this is the fundamentals of how we get the GI probe system working now you may be wondering about these reflective surfaces here for example the red wall of that cube really very very reflective now part of this is also controlled by the materials in the scene so for example I'm going to take this red material double-click on it to select it and it has a range of different properties that are going to be controlling the reflectivity of that surface the first one is down here in the metallic field you can see we have this specular slot here that controls the shininess of this surface I can slide that all the way to the top to increase the shininess and you can see the change that makes in here or I can move all the way back down to the bottom to reduce the shininess but actually if you look carefully even in reducing the shininess there's still reflectivity going on you can see the top of the cube here reflecting on that red wall now the reason for that is because of the roughness parameter down here this tells us how rough or smooth our surface is at a setting of zero this is a perfectly smooth surface just like a mirror so I can increase the roughness of that surface to break up the reflections on that wall and you can see now we can hardly see those reflections and all I could revisit the other walls to change their reflectivity properties to this red wall on the other side shares exactly the same material so that's lost its reflectivity too I could change this back to for example more point five to increase of shyness you can see a bit at the reflectivity there and then reduce the roughness to again make this practically a perfectly smooth surface so with a combination of these different parameters we can create a GI probe system that gets us great-looking result now one of the interesting but is of the GI system that distinguishes it from the bait lighting system is that it's dynamic it's in real time the objects we've added so far this cube and this environment we selected each of these object and we mark them as used in baked lighting when we do that the GI probe system can perform optimizations so it can pre bake a lot of the lighting for these objects because it knows they're not going to move if we did something like take this cube and move it in fact let's just take the prop cube and move it we would need to rebake the lighting by moving back to the GI probe object and selecting rebake to update the lighting on that scene here like so because we've moved the object but if we added an object that moved for example a completely dynamic mesh it's still going to receive indirect illumination and update in real time now that's pretty performance intensive but we can still do it let's take a look I'm going to move to the route tab right click choose add child node I'm going to add a mesh instance here and I'm just gonna bring the mesh up into the level and move to the mesh tab and I'm going to add let's say a new sphere mesh and now in doing that notice that so long as this sphere is inside the GI probe volume it's receiving direct illumination from the lighting but it's also detecting the fact that for example it's near a red wall you can see the diffuse reflections shining on the rear side of that sphere notice it's going to be a very different case if I grab that sphere and take it outside of the GI probe volume when I do that and I remove it from the GI probe system suddenly I see what this sphere would look like if we didn't have the GI probe system we would have the direct light from the light here you can see that illuminating the sphere but then afterwards behind it completely black contrast that to putting it back into the GI probe system and now we're getting direct and indirect illumination on that sphere making it look much more realistic so if you do something like move one of these duck these objects here the static objects the cube or the all the walls here objects marked as used in Bank lighting then make sure that you select the GI probe and rebake whenever you move a static object but during gameplay if you do something like move the noosphere that we created that doesn't require a rebate that's going to be updated in real time showing us the raw power of a real-time lighting system this is a really amazing global illumination system but be careful because it requires a lot of power so you're gamers your players are going to need to have a pretty powerful system to get the best results from GI probes this has been Alan thorn at being DDOT beers I hope you found this tutorial helpful I'll see you next time for more tutorials you [Music]
Info
Channel: BeIndie - Alan Thorn
Views: 3,132
Rating: undefined out of 5
Keywords: gamedev, alan thorn, beindie, c#, tutorial, lesson, how to, programming, gaming, games, c sharp, beginner, easy, start, getting started, learn, indiedev, become game developer, game developer pro, static, endless runner, godot, light, lightmapping, light mapping, open source, free, evy benita, gi probes, gi, probe, gi probe, global illumination, realtime, real-time, indirect illumination, dynamic lighting, light probe
Id: TorNtdg1fag
Channel Id: undefined
Length: 20min 22sec (1222 seconds)
Published: Sun Sep 29 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.