cgshares.com
In case you missed itYou may find these articles interestingRealistic & Stylized Lighting Studies Made With Unreal Engine 5Breakdown: The Science Of LightingIntroductionHi everyone, my name is Arthur Tasquin, and Im a Real-Time Artist with over seven years of experience using Unreal Engine. I previously worked in the VFX industry on several virtual productions, real-time experiences, and previsualizations, and Im now interested in the gaming industry.The subject of this article is the release of my next Unreal plug-in, a tool Ive been spending most of my time on for the past few months: PBL Database. While learning about the physically based lighting workflow in 2024, I was surprised by the lack of resources available online. I decided to scout for any information I could find on the subject and put what Id learned to the test through a project called Look Up Doodles.I described my entire process and combined all my discoveries in a voluminous 80 Level article: The Science of Lighting. While we will briefly review a few key notions here, I highly recommend you read that one thoroughly, as it will help you build a solid understanding of the basics. In this article I also teased a little in-editor tool that grew in scale over the months to become the plug-in Im presenting you today.What is PBL?PBL stands for Physically Based Lighting, a workflow that consists of using real-life light values and exposure settings for CG lighting.Why should you use the PBL workflow?Learn the rules like a pro, so you can break them like an artist. Pablo Picasso.Im a strong believer that learning the way things operate under the hood will improve your final result. By integrating core principles and natures laws, youre building mental pathways that will be useful for your future creative endeavors.In the field of lighting, using physically based data helps you achieve consistency between your different sources of light. The numbers can go from 0.001 for a candle to 100.000 for the sun, so it can be complicated to achieve both a realistic and pleasing balance with arbitrary values. Moreover, when using the PBL workflow, you emulate the cameras limitations.When to stop?A word of advice: when using this workflow, its easy to get fixated on the technicality. If you spent the last hour trying to fit two values together, youve lost yourself in the details. Take a step back and remember that PBL is only a tool and should only be a means to an end.Breaking the rules of physics is not wrong if its intentional. Movies and video games are, in the end, smoke and mirrors. Dont let physical values stop you from achieving a specific look youre after, a mood, or an idea. Use it only as a starting point and tweak it as much as you want.PBL DatabaseThe PBL Database came to life from the need for guidance in the learning process of the PBL workflow. When studying the subject, one thing struck me: I couldnt find enough data to cover the usual lighting scenarios. A few websites or images were often referenced, but they only provided so little. The information was scattered across the internet, and most of the time, the sources were not even there. From that moment, I decided to take matters into my own hands and do the dirty work. Ive spent 2024 sampling lighting data everywhere I went to build the most physically accurate collection of PBL values I could.The PBL Database is a time saver, by gathering both external and internal resources coupled with a set of unique tools, this plug-in is the perfect place to start learning PBL.Here is a non-exhaustive list of its features:Access to a growing database of physically accurate lighting data (lux, cd/m, lm, and EV100) with sampling notes and proof (pictures and videos of the sampling environment, light meter, and sky);Everything is in one place, everything in the engine;Sorting of the data based on multiple modifiers: Unit, Location (Outdoors or Indoors), and Type of Data (Artificial or Natural Light);A lighting scenario selector with two parameters (i.e. cloud coverage and time of day) that provides the exact data youre looking for;A description panel showing the definition based on your modifiers selection to ease the learning process;External resources (useful cheat sheets, relevant links) are in the palm of your hand;The Sunny 16 rule and its derivatives with the possibility to dynamically change one of the two camera settings to fit your needs;The Camera Settings Convertor: a tool to understand the relationship between Shutter Speed, Aperture, and EV100 and find the best camera settings for your scene;A Light Temperature converter to find the right RGB color for your emissive.The plug-in is divided into three tabs: Natural, Artificial, and Utilities. At the top of each tab, the common toolbar gives you access to external resources like cheat sheets and useful links and also a shortcut to the HDR View mode.Natural & Artificial LightingThe Natural and Artificial tabs look almost identical because they work the exact same way. The only difference is the type of data they take into account. Lets see how we can use them.First, you need to figure out what kind of data youre looking for. Select the tab depending on your light source: natural (sun and sky) or artificial (electricity). The modifiers will then help you narrow down the search.ModifiersThe Unit toggle will define the type of actors youre working with in Unreal. It is really important you understand what lux, lm, and cd/m are to work in PBL. Each of them has a different approach both in capturing the data and using the data.The Illuminance (lx)The Illuminance, calculated in lux (lx), is the quantity of light that hits a surface. It is captured through an incident light meter, also called an ambient meter or a lux meter in my case. This device samples the light hitting a little white hemisphere.This is the type of data youll find the most in the PBL Database, as I only used a lux meter in my sampling session. All the other types of data are gathered from the web.In Unreal, there are two places you will find this unit:The Directional Light intensity;The HDR View mode: Unreals own light meter you can use to monitor the lux of your scene. We will go over this feature in lighting studies below.The Luminance (cd/m)The Luminance, calculated in nits (cd/m), is the quantity of light that is emitted from a surface. It is captured by a reflective light meter, also called a spot meter. This kind of device is what you can find inside cameras to estimate the correct exposure of what you aim at. None of the luminance data was captured by me but Im planning to buy a spot meter for a future update (more on this at the end of the article).In Unreal, there are two places you will find this unit:In any emissive material (lamps, screens or sky sphere, HDRI Backdrop);The HDR View mode.The Luminous Flux (lm)The Luminous Flux, calculated in lumen (lm), is a measure of the perceived power of visible light emitted by a source. Nowadays, you can find this data on any bulb packaging to express the brightness of the light source.In Unreal, you will find this unit in every local light (point, rectangle, and spot light) as long as you set up the light unit correctly in the Project Settings. As you can imagine, this unit is only available in the Artificial tab.The LocationMost of the time, working with natural lighting implies an outdoor setting, and artificial lighting is an indoor one. Nonetheless, it happened that I needed to capture a street light at night or a sunlit office in the middle of the day. For that reason, you can tweak the location depending on the case and on the matching data.DataOnce youre happy with your modifiers, you can explore the available lighting scenarios. If your modifiers are lux and outdoors, you will have the choice between the cloud coverage and timing of the samples.Each scenario can contain one or more samples. In this case, on a clear sky late afternoon, the first row indicates sunlit values (by placing the light meter in the direct sunlight) and the second one shade values (by placing the light meter in the shadows). A row not only contains an average value but also a range and a median EV100.Why do you need a range?In reality, a lot of factors can alter the data. I call them factors of variation: you can find them in the description of each lighting scenario. Numbers depend on the weather, the pollution, the time of day, the season, the location, the surroundings, and the clouds. It can also be affected by our own sight differences, the device range of error or tilt, and more.This makes it difficult to build a consistent database as you cant reproduce the exact setting I was in at the moment of sampling. Thats why I designed the tool in a looser way. By introducing a range that comes from a collection of data through multiple sample sessions, I remind you that the most important thing is the overall scale. While the suns impact on earth can vary greatly, often by thousands of lux, the intensity of a candle will fluctuate within a way smaller range. Its your role to adapt the physical dimension of the scene to your lighting intentions.Edit (Experimental)The Edit section is an experimental feature that should only be used if the user knows what theyre doing. Its main purpose is to directly tweak the lighting actors from the scene based on the selected data. While the Post-Process Volume and the local light (in the artificial tab) will work as intended, the way you use the Directional Light and HDRI Backdrop will impact how physically accurate your lighting is. This will be further developed in the HDRI vs. Sky Atmosphere section.RecapLets review the process we just saw:Is the lighting artificial or natural?What unit are you searching for? 1. lux: for sunlight or ambient light checking (with the HDR View mode); 2. lm: for artificial local light; 3. cd/m: for sky sphere or emissive objects;Is the location of the scene outdoors or indoors?Once you answer those questions, you can display the data based on your lighting scenario selection and copy paste them into the appropriate actors!UtilitiesThe plug-in also comes with a series of utilities:The Camera Settings Convertor highlights the relationship between the Aperture, The Shutter Speed, and the EV100;The Sunny 16 rules are methods to estimate the correct daylight exposures without a light meter;The Kelvin to RGB allows you to find the right emissive color for a given Kelvin temperature.I wont go over them here, but Ill use some of them in one of the practical examples below.Lighting Study: The High School Science ClassDisclaimerBefore we get into practical examples, something needs to be addressed. While I spent a lot of time studying the subject, Im not done learning about the PBL workflow. When you scratch the surface, things can get really complicated and scientifically more advanced. Although I dont have an engineering degree, I tried to translate my understanding of the matter. My point of view is that of an enthusiast who saw an opportunity to reduce the friction it takes to learn the subject.In the following section, I will cover how I integrate PBL into my work. Ill try to be as transparent as possible regarding its physical flaws. With that in mind, you should not take for granted everything I say here. Make up your own opinion through experimentation and iteration. This is especially the case for use in production: the PBL Database should not substitute a proper pipeline.If you do have experience in the matter, I would be very happy to chat and connect. This subject, unfortunately, still lacks coverage, and the few resources out there often point in different directions.Keep in mind there are always several ways to get things done, choose the one that suits you the most. The tool is meant to help you in your lighting journey but you dont need to use every feature it contains.HDRI vs. Sky AtmosphereIm confident to say that the plug-in is as physically accurate as it could be (see Why do you need a range?), but how you use it is where it will really differ. In this section, were going to talk exclusively about natural lighting and the consequences of using the Edit Mode from the Natural tab.To understand the issue we need to go back to the way I sampled the data. Each scenario comes with a collection of values I took in different places and at different times using an incident light meter. This kind of device records the illuminance (lux) of a specific spot in space. Those samples represent most of my own contribution to the database (the rest being gathered from the web) and they should be used with the HDR View mode.If we take the supermarket example, which is only lit by artificial light, the values in my database vary from 79lx to 1621lx. The process would be to place supermarket lights in your environment and then use the HDR view mode to monitor the illuminance of the place. A few questions could then arise: Is the ceiling too high? Do I need to increase the number of lights? Is the placement of the lights correct?This way of working is perfect because youre working with two types of units: first the brightness of the lamp in lumen and then the illuminance of the place in lux. While this works for artificial lighting, its a whole different thing for natural lighting as the suns unit is lux.In real life, the sun doesnt change its intensity. The only thing that makes the result differ on my incident light meter are the factors of variation and the most impactful one is the cloud coverage. By going through the atmosphere and the layers of clouds, the light scatters, and a fraction of its original intensity reaches me. So, how can we reproduce that in Unreal?The first answer is the Sky Atmosphere. This is both the easiest and the most physically accurate one. The way this actor operates is that it does all the math for you in terms of atmosphere scattering, and it drives the suns intensity and color accordingly based on its rotation. Coupled with volumetric clouds, you get appropriate shadows and light intensity, and the whole thing is dynamic. This means that the lux values available in the natural tab serve the same purpose as the artificial ones: monitor the overall illuminance of the scene. The only thing to do really is to put the suns intensity to 120.000 lux, as mentioned at the end of the Unreals official documentation.This method, though, comes with its drawbacks: by linking the sun to the sky atmosphere, you lose artistic control over the lighting. The sky is one of the most important and biggest light sources around, and its diversity in intensity and color is crucial to creating impactful lighting. Im a big fan of using HDRI in my work, and I dont really like the look of the Sky Atmosphere or the Volumetric Clouds. Now, I could use an HDRI that doesnt contribute to the lighting coupled with the sky atmosphere, but that would mean that the skylight doesnt take into consideration that amazing range of color from my sky. With the Sky Atmosphere, you lose control over the color and the intensity of the sunlight as well as the brightness of the sky.As my approach is more about creating the most pleasing visuals, I usually tend towards the HDRI approach, which is what were going to dive into. Keep in mind its not the most physically accurate workflow. It works for me, but it might not be relevant to you.Preparing The SceneFor the following lighting studies, I will use the High school Science Lab Classroom pack from Dekogon Studios, which has been an industry standard for years. By choosing this environment, Im confident I will work with optimized assets with a coherent art direction. My goal will be to push the quality as far as I can to produce beautiful static shots for a cinematic using only lumen and no post-production. While the PBL workflow isnt bound to real-time dynamic lighting, we will neither use static lighting nor path tracing to make those shots.The first thing to do for any lighting study is to inspect the level at which youll be working.Although its extremely well-optimized, you can see that the quality of the environment is quite impressive. We will build the lighting from scratch, so lets get rid of it. I usually prefer to move the original lighting into a sub-level so that I can compare it to mine. I will also work on my new lighting in another sub-level to keep things organized.Dont forget to right-click/Change Streaming Method/Always Loaded on your lighting sublevel if you want to render it. Without that option, your sub-level will not be loaded when you render.Our first issue arises: turning off the original lighting doesnt remove it from the scene. This occurs because the lighting is baked. To remove all baked lighting, you can rebuild the lighting (Build/Build Lighting Only) or turn off Allow Static Lighting (Engine/Rendering/Misc Lighting) in the Project Settings. If your plan is to only use dynamic lighting, I would recommend the second option as it will be cleaner and more optimized.While were on the subject of Project Settings, there are a few of those you should consider if you want to output the best result from the Engine. Heres a list of the changes I did for this project:All of these settings are located in Engine/Rendering.Natural Lighting A Sunny AfternoonFor this example, well go with a typical sunny afternoon. I want the warm light of the sun to fill the room and play with the contrast.The first thing to do is spawn the basic light actors: the Directional Light, the HDRI Backdrop, and the Post-Process Volume. You can see that we already have a few issues here: the sun seems to bleed through the walls and the ceiling, the lens effects are way too strong, and the lumen isnt working properly.As this environment was made with a modular approach in mind, all the foundations of the room were divided into blocks. This, coupled with the thickness of the assets, can introduce light bleeding, but theres a very simple way to fix it. By placing unlit dark blocks outside the room, Im making sure that the only way the light comes through is through the windows.When lighting a scene, its always better to start with a neutral setup. We dont want any effect to clutter the space. Thats why I always set the Post-Process Volume to unbound and the Bloom, Lens Flare, and Vignette to 0.For this scenario, I chose an HDRI from the website Location Textures, which provides a lot of free, high-quality content. Something I really like about them is that each of their images comes with additional data. I chose this HDRI both for the look of the sky and the time of capture that matches our scenario. You can see that the photo was taken in the UK on 01.08.2019 at 3:30 PM.When I know the timing, I usually like to inspect where the sun is in the sky at that moment. With Time and Date, you can retrieve sky data from a date and a location. By entering those parameters, you can see that the sun at 3:30 PM was in the first half of the afternoon (between solar noon and sunset), which in my tool is indicated as Early Afternoon.Using The ToolThe SunNow that the scene is neutral, that we got rid of all the issues and that the basic light actors are there, we can start using the tool. Like I said earlier, I want a sunny day in the early afternoon and I will start with the sun. To retrieve those data, I need to be in the natural lighting tab with the lux unit selected and I will first balance my scene for an outdoor setting.How can we interpret that data?In direct sunlight (first row), the range varies from 9155 lx to 86700 lx. This is a huge difference (x10 factor), and I need to understand why;The notes indicate that the smallest samples were taken in a forest, this might have affected the result;There are two times of sampling: the first one matches the timing of my HDRI (date and hour).I want to see the behind-the-scenes to understand how those values were taken. To do so, we can click on the link icon next to the scenario, which will bring us to a Google Drive. After choosing the date and inspecting the pictures, I can say that in a more open area, the illuminance is closer to 80 K lux, which is in the high part of the range.Now that we understand the values lets try to use them. With the Edit mode, we can iterate within the given range and find the proper exposure for our scene. Ill set the Directional Light intensity to 77.000 lux.A proper exposure only means keeping as many details in both the shadows and the highlight. Its important to start with balanced settings but it doesnt mean that you will have to stick to it until the end. Right out the bat, we can see that the numbers work pretty well. The sunlight isnt blown out or too dark, but we have lost our sky. Dont worry its totally normal as its not yet set to a more physical range like we just did with the sun.One last thing I would like to do is to verify that my suns impact on the scene is the same as its intensity. Using the HDR View mode, Unreals own in-engine light meter, we can see that the upper square shows 76179 lx, a value very close to the one I used.The SkyTo calibrate our sky, we will need the data available in the cd/m toggle.The numbers for a clear sky vary from 7000 to 10.000 cd/m but what does that really mean? HDRIs are far from uniform, they vary from pixel to pixel both in intensity and in color. Likewise, the skys luminance completely changes depending on where you sample it. This is why any luminance value should always go with a description to understand where and when the value was taken. In our case, the range covers the intensity of a clear sky during the day at the horizon. Our goal now is to tweak the intensity of the HDRI Backdrop until we reach a value that sits in that range. Lets click on the average value and paste it into the HDRI Backdrop intensity.From a quick glance, it seems pretty well exposed, but lets review this with the HDR View mode.1 of 2The luminance meter (lower square of the HDR View mode) indicates 7979 cd/m at the opposite side of the sun; its pretty close to our range, so Im going to leave it that way. As the values fluctuate depending on where you point the HDR View mode, I always like to cross-reference information, so for this example, I also used the white illuminated cloud value of 10.000 cd/m.Although my incident light meter covered a substantial range of scenarios, I didnt capture any luminance data as I needed another device for that. All the luminance values are coming from external resources that you can still access through the link icon. The lack of those makes this step less precise and requires you to eyeball the perfect luminance. This is something I would like to improve for a further update.Our scene is now well-exposed for an outdoor setting, but were dealing with an interior here. If you go inside the room, everything is pitch black except the sky outside the windows. The ideal EV100 for an interior is 5 or 6, depending on the amount of light. You can find that in the EV Cheat sheet from the upper toolbar.1 of 2The question here is, what do you want to expose for? As we used physically accurate lighting data, we emulated the cameras limitations. You cant expose both the highlights from the sun and the shadows in the class. Like a photographer, you need to choose what the subject of the photo is.The rest of the process is quite similar to taking pictures with a real camera. You just have more control over the scene if you want to change the lights or play with the shadows. I also added an Exponential Fog, turned on the volumetric checkbox, and played with a few post-process settings.Here are a few shots from that session:1 of 3Artificial Lighting A Neon NightSo, what changes when youre dealing with an Artificial scenario? As previously mentioned, you will mostly use local lights, which are expressed in lumen.For this light study, I would like to use the neons already placed in the environment to light the classroom at dusk. Most of the steps we saw in the previous example are very similar.Although Im not using sunlight, I would still like to place a blue hour/dusk very fainted HDRI in the scene. In this example, I used the Blue Clouds 2686 from Location Textures. The process is exactly the same as with the natural setting: I sample the sky with the HDR View mode, and based on luminance data, I tweak the intensity of the HDRI Backdrop.Thanks to the EV Cheat Sheet, we already know that the average interior exposure is around 5-6. Lets put 5 in the Max and Min EV100 of the Post-Process Volume and enter the classroom. The result is pitch black, and it shouldnt be otherwise, as we didnt introduce any light into the environment.Neon LightsThe project already comes with neon lights that have an emissive channel. Turning on the Emissive should make a difference in my scene, but its not the case. Why is that?Like often, Unreal default values dont represent the real scale of light intensities. Similarly to the default 10 lux of the Directional Light, having an emissive value of 1 will only be seen if your EV100 is at 1.As a base, lets crank up this value to 500 and see what happens. The setup doesnt come with an emissive strength parameter but a color so what I did here is to increase the value of the color itself.This shows us something really important: the impact of emissive objects on our lighting. Lumen is a great tech, but when working with PBL, it can get in the way. Were going to light our scene with local lights using real-life light intensities in lumen. On top of that, we need to use emissive material to simulate where the light comes from, and we need to keep in mind that they will add up to the already calibrated lighting. This might not sound like an issue when dealing with an intensity of 500, but were far from the reality here. This is where Unreal falls apart in terms of PBL: heres what the scene looks like when using calibrated values from a spotter pointed towards a fluorescent lamp.The only solution would be to exclude an emissive object from Lumen, but I couldnt find any way to do that. For now, we will trust our gut feeling and tweak the emissive intensity accordingly.There are several ways to link a local light to the neon mesh, but I chose to use a rectangle light just beneath the two cylinders. To be a bit more accurate, I couldve put two point lights exactly shaped as the neon (using the source length and radius) and removed the shadows of the tubes, but I didnt want to double the number of lights in the scene.The rest is pretty straightforward, I used the light intensity range available through the lm modifier to tweak the rectangle lights. Neon lights vary from 500 lm to 5000 lm so I need to think of how they are used here: a science lab is a place where you need to see clearly what youre doing, it needs a functional lighting. I can then use the HDR View mode to compare the illuminance of the place to another functional place I have in the database.UtilitiesTo finish this study, I would like to go over two utilities. The Kelvin to RGB will help us translate a light temperature into an actual emissive color. Thanks to the Light Temperature Cheat Sheet, we know that the Fluorescent temperature is at 4000 K. After changing the rectangle light itself, we can use the tool to output the appropriate color.Although EV100 is a real measurement, it is not used that much by photographers as they work mostly with their camera settings instead: Aperture, Shutter Speed, and ISO. The first utility allows you to do that. In our case, we know that the EV100 we aim for is 5 and we want to see what are the different Apertures available while keeping the same exposure. You can see below that to have an exposure of EV100=5 with an Aperture of 1.4, you need to set your shutter speed to 15. This is very interesting if you want to control in a realistic way the motion blur or depth of field.For this tool to be usable, you need to set the Exposure Metering Mode of your Cine Camera or Post-Process Volume to Manual.Once your lights are calibrated, youre free to change the space how you like it and to tweak what doesnt work for you. In my case, I reduced the number of lights in the environment to introduce more contrast and played with the fog:1 of 2ConclusionLearning the PBL workflow can be a real headache, trust me, Ive been there. Thats the reason why I started to share my thoughts and discoveries and developed this plug-in. I hope it will help you in your own lighting journey and that it will spark some public discussion about the topic as the number of resources out there are too limited.Talking about resources, here are a few recommendations:My previous 80lv article: The Science Of LightingTalking Physically Based Lighting With Scott Warren, EMC3DLighting with Eros, Visual Tech ArtUltimate Lighting Course, Tilmann MildeThe PBL Database is now available on my Fab page!I want this plug-in to be an evolving resource based on your needs. If you want to submit feedback, you can do it on this form. On top of buying a spot meter and improving the database by covering more scenarios, I already have tons of ideas for additional features like a favorite system, a way to add your own data or templates for quick PBL lighting setups.Before ending this article, I would like to thank a few people whose work I admire and who were kind enough to try out the tool before its release and give me feedback:Elliot McSherry,Corentin Wunsche,Ted Mebratu,andEros Dadoli.If you dont want to miss anything from me, be sure to join my newsletter or add me on LinkedIn! In case youre searching for an Environment or Lighting Artist, Im also looking for a job in the gaming industry. My work is available on ArtStation and on my ownwebsite, where I write blog posts about visual theory.Source link The post Get Started With Physically Based Lighting In UE5 With PBL Database appeared first on CG SHARES.