Unreal Engine Lighting Tutorial | Global Illumination & CPU Lightmass

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello beautiful people it's from vr division in today's video we're going to learn about the pre-computed global illumination in unreal engine the indirect lighting if you're already familiar with some of the information i present in this video for example what global illumination is take a look at the timeline to find what you're looking for faster if you learned something useful today i would really appreciate it if you can do your boy a favor leave a like on this video subscribe if you're not already and let's get started global illumination also called indirect lighting simulates lighting interactions with geometry and material surfaces to add realistic lighting to your scenes and projects the simulation also takes into account the absorption and reflectiveness of the materials with which it interacts simulating the way light behaves in three rewards is handled in one of two ways using real-time lighting methods that support light movement interaction of dynamic lights or by using pre-computed baked lighting information that gets stored in textures applied to geometric surfaces unreal engine provide both these ways of lighting scenes and they're not exclusive to one another as they can be seamlessly blended with one another let's talk about the highlights of each system to help us understand their usage and capabilities the precomputed lighting is ideal for scenes and projects where lighting does not need to change its performance costs are relative to the memory required to load and store the lightmap textures this is why i say don't go too crazy on your lightmap resolution the quality and accuracy results is set by the texture resolution of the lightmap texture being baked and applied to geometry it supports static meshes and bsp geometry by default static meshes require setting up a lightmap uv to store the lightmap data this is why we unreact everything before we export it to unreal engine and of course it can be used in combination with dynamic lighting the dynamic gi is ideal for times where we need to change the light so if it's a day night cycle or turning a light on and off if you're working with a very large or open world environment sometimes it's just impractical to bake the lights because that could take so much time or could take so much memory the performance costs can be significantly more expensive to calculate in real time depending on the method being used for example if you're using great race gi the brute force method is more expensive than the final gather method supports all geometry types by default and of course can be used in combination with recommuted lighting diffuse into reflection is by far the most visually important global illumination lighting effect light bounces by default with the light mass and the base color term of your material controls how much light and what color bounces in all directions here i have a simple cornell box with few walls and different materials so one is blue one is red and few boxes here and there are no lights i'm using android engine 426 the cpu light mask everything is default i'm just going to drag a point light let's click on unless and let's switch back to that once we place the light it tells us hey lighting needs to be rebuilt we have seven rebuild objects so we can simply click here and click on build lighting only give that few seconds let's bake is finished and you can see how the color is bleeding across our meshes so here we have the blue bleeding all the way on the box and this box have a white material and we have the red bouncing or bleeding on this box here so we can control this for example if you go toward settings and if you don't have word settings here you can go to settings and then click on word settings and it will show up here so find the option diffuse boost and let's take this from one to something like three and let's make a camera i'm gonna find an angle like this and i'm going to press ctrl 1 so it saves as a bookmark so now if i move my camera i go back always to that bookmark i'm gonna press f9 to take screenshot and the all diffuse post was on one now it's three so let's build light again and you can see how much more bleed we have onto our meshes here so the more or the higher this value is the more color bleed we're going to have so i'm gonna take another screenshot and open my screenshot this is the first one on diffuse boost set to 1 and this is diffuse boost set to 3. you can see how much color bleed we have you can control this in other ways or you can disable it for specific meshes so let's say we don't want this blue to do any color bleed you can actually click on the static mesh go to details and search for diffuse boost here and let's set this to zero let's click build light and see what will happen you can see there is no color bleeding at all or no diffuse into reflection at all coming from this wall because we set the diffuse boost to zero let's set it back to one and now i think diffuse into reflection is understandable now we understand what diffuse inter-reflection is let's switch to our other map this is a test room i did quickly in 3ds marks to showcase the different lighting problems we might have so with that said there is also a post process volume with auto exposure disabled everyone hates auto exposure it is what it is let's switch to let mode as you can see there is nothing to see because we need the sun so let's add the sun the directional light is going to act like our sun if you have snapping on the rotation grid on i usually disable that when i'm controlling my lights so it just gives me more control like this feels kind of clunky and let's say we're fine with this i'm going to make sure all my static meshes have the same light quality 64 for now i'm going to click on build lighting only so that's ctrl shift plus semicolon if you don't know what semicolon is it's this guy so it's somewhere on your keyboard now pressing ctrl shift semicolon it will take few seconds to build the light and now look at this as you can see we have indirect lighting everywhere and that's amazing i'm going to take notes of every time we build the light and let's set a camera angle we like so let's say something like this i'm going to press ctrl 1 on my keyboard to save this as a bookmark so every time i move my camera i have this as a bookmark and the second thing i would like to do is going to window developer tools and output log and i'm going to search for light mass on then my computer name to filter my results here so this is our light bake here ignore all of these these are earlier it took three seconds to build the light on the scene with the settings of the light mass on default and the build letting quality is set on preview let's see what problems we have and what could be improved here there is strange gradient going on and we can say almost the same about here all of these meshes have gray material assigned on all of them so if you look at the assigned material it's just a opaque material with a gray color on it on the base color it's not always the same grey especially on these parts here this is because how cpu light mass handles the light bake each of these meshes is built on different thread and this is why we have sometimes these differences between meshes next to each other the gpu eliminates all of this you don't have to deal with this when you're using the gpu light mask and the same can be said on the floor meshes here but there are always small things we can do to improve on this some of these problems can be solved with the cpu light mask and some of them you have to move to the gpu light mask or change how you model your meshes so if you don't want to have this on your floors let's say then it should be slightly a bigger floor like this not like this and the same can be said on the wall hey quickbuzz this video tutorial is sponsored by our master class you can get it on gumroad right now it's in early access you can get it for 60 percent less before it leaves early access if you're looking to master android engine in architecture materials lighting blueprints all that good stuff check out the link in the description now let's go back to the tutorial something i would like to discuss first is the num indirect light bounces i'm going to set this to zero and then i'm going to build the light again as you can see we have no indirect lighting anymore because there is just no indirect lighting to bounce this also took shorter time to finish usually the most expensive light bounce is the first and then the second the third and so on is much more cheaper i'm going back to my view take screenshot from here and then i'm going to increase this one from zero to one and then press on build light this one took 2.6 seconds and we have our first light bounce i'm gonna put this to two then press f9 then click build the light bake now took 2.7 seconds so it's like 8 milliseconds extra for the second light bounce and i'm going to press f9 again i will locate my folder where i have my screenshots so this is the first image with num indirect lighting bounces on zero this is the second one where we set this option on one and this image is where we have the indirect light bounces on two the max setting you can go with this is 10 so if you put 11 12 15 it will just not work i'm gonna put this now to 10 and build that again this time it took 2.97 seconds to build the light and i'm gonna press f9 then go to my screenshot and compare the screenshots here 0 1 2 10. i'm going to try and put this on something like 50. it took slightly longer but if we take a screenshot we will almost see no difference so this is 10 and this is 50. you can see that these dark areas are not lighter in any way there is something here however we only see a difference here not here and not here now we took these screenshots i'm going to rename my images and now i'm going to make a new folder and just give it a name i'm going to make all of these available for you guys once we finalize this tutorial series and now i'm going to switch the build lighting quality from preview to production and i'm gonna click build light this time it took 16.8 seconds when we change the lighting quality from preview to production and i'm going to take another screenshot call this 16.8 how both preview and production starts with p production preview so we need something better call it low and production and let's compare these two images here so this is on the preview settings and this is on the production settings obviously production settings is way way much better than preview that's for good reasons and one of the other problems now i would like to tackle is the weird gradient we are having with these meshes here and for that we're going to discuss the static lighting level scale i build the light one more time on the default settings and i saved another screenshot with three bounces now let's go back and see what other settings we can change the static lighting level scale if we look at the documentation basically it is used to decide how much detail to calculate in the lighting the smaller this number is the higher quality we're going to get but it will also greatly increase build times so with the last final break we just did right now on these settings it took three seconds let's set this camera i'm gonna set this to control two so now we have one for this and now we have two to this and i'm going to take another screenshot on these default settings now what i'm going to do is to set this on a value of something like 0.8 and then i'm going to build the light and see if anything is going to change for us took slightly more time not that much so let's take another screenshot and let's set to something like 0.5 and click build light bake is finished it took even slightly more time so that's from 3 seconds when it was on 1 to 3.2 seconds when it's 0.5 press f9 i'm going to set this to a value of 0.25 and then i'm going to build the light again once late bake is finished just give it few seconds now you can see it took 3.9 seconds and it introduced some new artifacts i'm going to show you how we can fix this later let's take another screenshot and open our screenshots folder and this is the first image where we had our value on one this is point eight and as you can see here we're starting to somehow see less of the weird gradients on our meshes or the artifacts and this is point two five and as you can see now when we went too extreme with this we just introduced new problems that's ok let's select our first image and call it static lighting level scale 1. i changed the lighting quality from preview to production while i kept this on 0.25 and it took from 4 seconds to 30 seconds that's way many times more however if you want to compare the results so this one is 2.25 where we introduced new problems and then when we switched it from preview to production you can see the difference 0.25 could be extreme so let's try something like 0.5 and also compare it preview to production you always need to find the sweet spot for your settings if you're using the cpu light mouse so this is static level scale on point five preview settings we can see things look okay this took about four seconds and the next one where we changed the light bake to production it took 22 seconds but there is also a much better result generally this is the other one 0.25 production preview production preview and the next thing i'm going to talk about is the indirect lighting quality usually this is set to one and the more we increase this the indirect lighting is going to look better but it will also take much longer to bake the light in order to see the effects of the indirect lighting quality we need to build on something that's higher than preview let's find the nice location where we have some indirect lighting and switch this one from one to two and what we will do now is switching from preview medium high and production take screenshot change the lighting quality to medium and build once light bake is finished let's take now another screenshot and let's switch from medium to high click build let's take another screenshot and switch to production then click build again and you can see the first one on preview took 3.7 the second one on medium took six seconds and the third one took 11 seconds and now this should take like 16 or 20. so again this is indirect lighting quality on two on preview and it took four seconds nothing really special this is now medium and this is high and this is production very interesting results however what i'm going to do now is switching the indirect lighting quality from two to four and then i'm going to build light again and i also believe the highest option we can go on here is also 10 so it won't do anything more than 10. now it's set on 4 let's build light again the two settings we need to be very careful when we are using it's the indirect lighting quality and the static lighting level scale these two guys alone can increase the render times exponentially so let's talk about what happened now we set the indirect lighting quality on two and four and we built both on production so the first image on production took 26 seconds the lighting quality is on two and this is what we have and the second image is on four and it took double the time almost and this is what we got so this is two this is four we can see there is definitely improvement in the indirect lighting but the same for the time it took to build the light this is another camera the indirect lighting quality on two it took 26 seconds and this is the next one where we don't see much difference visually but took double the time so sometimes the changes happens from time from place to place i will never understand the cpu light mask next on the list is the indirect lighting smoothness it is useful in some lighting conditions when light masks cannot resolve accurate indirect lighting one is the default value sometimes you may want to increase this if you want to make the indirect lighting smoother or decrease it to make it more accurate values like three or more are going to make you lose detail so i actually so to save you some time i went ahead and did some tests on different settings on two different cameras from 3 to 0.66 so this is the first camera indirect lighting smoothness on three look at this area we almost have no indirect lighting and now this is two we're starting to get like the indirect lighting now is smoother and this is the default value of one so it's like good now if you want to increase this to make it more accurate you start reducing this below one so this is a value of 0.9 this is the value of 0.85 this is the value of 0.75 and you can see what effect it's making and this is the value of 0.66 this is another camera so this is the value of 3. it's looking pretty bad so this is value 2 where it looks much better and this is one the normal default value and here we are 0.9 we look at this area so let's just enlarge this ah look at this area here and these areas where we have indirect lighting so again one point nine point eight five so point nine point five 0.75 and you can see now the indirect lighting here is like much more defined next on the list the environment color it represents a constant color light surrounding the upper hemisphere of the level so imagine it like a sphere around our level like a sky this light source currently does not get bounced as indirect lighting and causes reflection captures brightness to be incorrect so it's preferred to use a static skylight instead so it's not really recommended to use this guy however just turn it into something like this let's see what happens when we build the light so there's the color we chose and you can see how it somehow interacts with the scene it's kind of weird so for this example i'm going to get rid of our directional light so i'm going to press ctrl x and paste it somewhere so i can bring it back and i'm going to set this on a color that's white like so and the environment intensity is just going to make this environment color more intense so let's set this to something like five and just notice here once we bake the light again so light bake is finished you can see it acts like an ambient light but there is no indirect shadowing so there are absolutely no shadows from this mesh and like many others so it's like super weird um yeah direct or indirect actually there is indirect shadowing but not direct shadowing so i don't recommend using this so let's set it to black and let's bring back our directional light set it to static for now let's get this guy here so the next option on the list is the use ambient occlusion so i'm going to enable this and real quick if you want to read in the documentation feel free to read all of this but light mass calculates detailed indirect shadows automatically so all these indirect shadows here are calculated automatically it can be useful to exaggerate indirect shadows for artistic purposes or to enhance the perception of proximity in a scene here are settings to control the ambient occlusion i'm going to leave now everything at default except for the max occlusion distance so we can see what's going on i'm going to set this from 200 to something like 50 and i'm going to bake the light so if we look at the corners or where we have meshes intersecting we should have some ambient occlusion but for that to look good we need to increase the lightmap resolution on our meshes feel free to experience with visualize ambient occlusions when you enable this you can only see the ambient occlusion let's actually try that since this video we can make it fast you can see this is the ambient occlusion in our scene so mainly it's in these areas all right i'm gonna disable this what i'm going to do now is actually click ctrl x on my direction light again just paste it here again and i'm going to place a skylight on this skylight i am going to change it from sls capture scene to sls cup specific cube map to choose an hdri and i'm going to set this on static and i'm going to build the light again so i'm going to talk now on light mass importance volume and light mass portals when the light bake is finished we can take some screenshots to show you what's up alright so lightmake is finished and wow it's like so dark in here and it's not that good but you can see at least we can get some stuff from from our window here not like the environment color so they are not the same what can we do now you can use hdris to light your projects with the cpu light mask is kinda harder so let's click the skylight again and let's increase the intensity of this so the intensity scale let's set it to something like 10 see if it's going to change anything now the lighting looks much better since we have higher intensity and we can also increase the intensity on the indirect lighting so let's go ahead and also do that i'm gonna do this on something like five build the light again so these areas here where we have indirect lighting should look brighter nice now the indirect lighting could be improved especially when you use a skylight or even a directional light when using the cpu light mass when we go to visualize the volumetric light mob now we can tell unreal engine to focus this volumetric light mod now it's going like way too far away from the scene how can we focus this well for this there is the light mass importance volume it basically tells the engine to focus the light mass build or especially on the indirect lighting quality on this area so you can go to place actors then to volumes you can find it here or you can just search for it from here light mass importance volume and light mass portals we're gonna discuss these two now so let's take a look at the documentation here this is a massive map and these are some background meshes we can see from our playable area and here on the right we have our playable area by using the light mass importance volume we told light mass to focus or reduce the region of light from 80 000 units to 10 000 units and that's like for this example here 64 times less area to light so let's do the same here i'm going to press light mass importance volume press g just in case you cannot see it then just surround our map with it our playable area with it like so and then i'm going to build the light you can see it's much more focused on this area so that's one thing we can do and when we are using a skylight to light our projects so i'm going to set a camera here and let's disable these guys for now so i'm going back to show visualize volumetric light map let's just disable this and go to an angle like this and i'm going to press ctrl 6 or any number to set a bookmark and what can we do is using the light mask portals to help light mass determine where the light is coming from and these light mass portals and the light mass importance volume i believe they are only useful in the cpu light mass if we put them in the gpu light mass they just gets ignored so needs further testing but that's something we can also do in the second part of this video and you need to place the light mask portals in every opening of your interior project anywhere where you have light coming in you need to place these guys let's build the light i'm going to take screenshot here and a screenshot here let's keep only one actually this would be just easier to see the changes so you can see these areas here some of them would just improve all the indirect lighting here by placing the light mass portals however you should also keep in mind by placing light mass portals it will slightly increase light bake and this time i think it took double the time it 100 percent worth it to finalize this video and not to make it too long well yeah what do you do as final settings on your project well let's bring back our directional light like so so i like to use skylight and a directional light and then on the worst settings let's call it a day and do the final settings to finalize this so the final settings for most of projects they usually look something like this if you want more skylight bounces we don't want to play with intensity we can actually play with this so let's do something like five ten that's fine let's do this at three and this is like usually 0.95 or 0.8 i i i don't go below 0.8 so if you press alt 0 you can visualize your light maps density so in arch fields projects you need the between green and orange areas so to get nice shadows and those red they have to go because this is like very high light map resolution which is 64 on such a small mesh the engine is telling you hey this does not make sense with this like this is 64. and this is 64. so this could be something that's like way much less so what you need to do actually is to match the size of the boxes across your project to get constant shadow quality so if this light for example cross this area where we have like green and blue the shadow is going to look completely different the the quality of the shadow unless they have the same density of the light map i'm not gonna increase the light knob resolution i'm gonna keep everything at 64. let's just remember this as it is in the video and let's actually have some fun so let's go to place actors bring a light put a point light here set it on two do the same and let's just build the light hey we're back light bake took almost four minutes it looks so much better like i love this it's totally possible to achieve lovely results with the cpu light mask just look at this the only thing we need to do now in order to improve on this is actually selecting these meshes and increasing the lightmap resolution just like we discussed two minutes ago so that's that i hope you found this video useful in the next video i'm going to compare lu xuang's gpu light mask to the cpu light mask the short answer hey if you can use lushuang gpu light mask use it however wait for the next video i'm going to compare all these guys together i hope you enjoyed this subscribe if you're not already don't forget to leave a like and i will see you guys in the next one cheers hello habibi i hope you found today's tutorial useful don't forget to leave a like share this with your friends this is the best way to support us and again if you'd like to check out our master class in architecture check out the link in the description this is also one of the best ways to support us making more videos so thank you for that i hope i i will see you soon bye you
Info
Channel: VR Division
Views: 5,172
Rating: undefined out of 5
Keywords: unreal engine 4, unreal engine 5, ue4, ue5, archviz, unreal engine architecture, unreal engine lighting, unreal lighting academy, ue4 lighting, learn lighting in unreal engine, cpu lightmass, gpu lightmass, lighting needs to be rebuilt, unreal engine, ue4 4.26, CPU vs GPU lightmass, interior lighting ue4, interior lighting, interior lighting in vray 3ds max, Loushwang, Global Illumination, ue4 lighting tips, ue4 lighting basics, ue4 lighting tutorial, vr division
Id: kJbLhuKSC0s
Channel Id: undefined
Length: 32min 45sec (1965 seconds)
Published: Tue May 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.