Lumen in UE5: Let there be light! | Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
PAULO SOUZA: Hi, everyone. My name is Paulo Souza, and today we're going to talk about Lumen, the new global illumination and reflection system in Unreal Engine 5. Lumen is the result of years of work from the team at Epic to bring real time global illumination to the Unreal Engine. It uses a fully dynamic indirect lighting pipeline, which means that the scene geometry material and light properties can change in real time. Because of that, Lumen greatly improves artist's workflow. Not only lighting updates instantly, but it also removes the wait for build times to get to the final lighting quality. We like to give special thanks to the Lumen team-- Daniel Wright, Krzysztof Narkowicz, and Patrick Kelly, who also helped me in making this video. I would also like to thank these asset creators. We use these assets to craft the scenes we're going to show in this presentation. With Unreal Engine 4, dynamic lighting was mostly done with direct illumination. Indirect illumination has always been challenging due to the amount of computation it requires. In UE4 all types of indirect illumination relied on broad approximation, faking, or pre-rendered global illumination using lightmaps. But we believe that the next generation of games and simulations will require more advanced lighting, such as time of day, sunlight, or lighting reacting to world changes. This is why every corner of the real time industry has been pursuing a definitive solution for real time global illumination and reflections in game engines. But if processing global illumination has always been challenging due to the amount of computation, calculating GI in real time is even worse. It's the reason why real time GI is known as the Holy Grail of computer graphics. Unreal Engine 5's Lumen tries to change that. But what is it really capable of? Let's start by listing the features of real time GI in Unreal Engine 5. Let's start with color bleeding. The most important effect you expect from a realistically lit scene. Color bleeding describes the way the color of an illuminated surface influences the surfaces around it. The effect is usually subtle, but it gives the underlying details that realistic lighting needs. You can reproduce that by pointing a strong direct light source, like the sun, to a bright color object. That shows the phenomenon in which objects are colored by the reflection of light from the other nearby surfaces that are being illuminated. Color bleeding is what allows us to light this entire scene with a single light source just by bouncing light around. Lumen also gives you support for soft indirect shadows. Indirect shadowing is also known as soft area shadowing and is a very important tool of global illumination. Soft area shadows help objects ground in parts of the scene that are not directly lit. In the past years, real-time graphics have relied on premade occlusion maps or screen space occlusion algorithms, a very rough approximation of how shadow works or, one can say, how light behaves in narrow spaces. Lumen completely replaces SSAO in Unreal Engine, removing the need for real time baked occlusion solutions. At the same time, it delivers precise and realistic soft shadows. Lumen calculates the current frame by tracing against the previous frame's lighting. This means that the resulting lighting is always accumulated with the result of the previous frames in a sort of a feedback loop. Since these updates are amortized over multiple frames, Lumen is able to provide efficient support for multi bounce global illumination and many dynamic lights. This has usually a subtle effect in most scenes as you can see in this scene with radiosity turned off and on. But it's clear that this is necessary to properly simulate how the sunlight needs to bounce multiple times to illuminate the scene behind this object in the middle. Let's talk about emissive surfaces. With UE4, you could use the emissive input in the material to give a glowing effect to an object, it didn't really affect the world unless you were using static lighting with light maps. In UE5, we can finally make use of the emissive properties of the materials to inject indirect lighting into the scene in real time. Keep in mind that Lumen often doesn't capture small emissive objects really well. So the lighting effect of those small surfaces may disappear if they're occluded. You may also see increased noise on the adjacent lit surfaces if the emissive objects are too small or too bright. SkyLights are also supported in Lumen. The SkyLight captures the distant parts of your level and injects that to the scene as an indirect light. That means that the sky's appearance and its lighting and reflections will match, even if your sky is coming from the atmosphere or layer clouds on the top of Skybox or distant mountains. You can still have the same setup as UE4 with a SkyAtmosphere, a SkyLight that updates in real time. Or you can even manually specify a cube map. Lumen's final gather ultimately picks SkyLighting at no extra cost and injects it into the scene. But how does it work? The most common method for solving global illumination is ray tracing. Ray tracing generates images by tracing the path of light and simulating the effects of its encounters with virtual objects. In ray traced global illumination needs a lot of traces to generate proper indirect diffuse, soft shadows, secondary bounces and et cetera. Lumen uses a hybrid approach for traces. Tracing rays against the screen first. Screen trace rays allow any geometric type to block indirect lighting, but they also have limitations. They can only trace objects in the frames camera view. But in most cases, there are parts of the scene that can't be covered by screen space traces, and for proper illumination and reflections we need to take off-screen objects into account all the time. Lumen makes heavy use of hardware accelerated ray tracing, which has become increasingly common in recent years. But while Lumen supports hardware ray tracing, we needed a solution that could work on current and last gen GPUs. This is why Lumen has a built-in software ray tracing solution. Or software solution traces to a simplified version of the scene, that is generated using signed distance fields. A signed distance field is a volumetric representation of the 3D surface. Think of it as a volume buffer. An approximation of the original triangle mesh. Mesh SDFs have existed in Unreal since Unreal Engine 4. The Unreal Editor was already able to generate mesh distance fields offline for every static mesh asset. In UE5, we have improved SDFs to support streaming in large objects. What's really cool about tracing to SDFs is that they are very fast to trace, as the entire tracing loop is basically stepping through a volume until we hit a surface. We have a solution to trace the surfaces and calculate GI. That's great. But to bounce light around properly, we still need to sample the properties of the surfaces in the scene. Sampling these properties directly from triangles for every hit would be so expensive, so we came up with a smarter approach. We generated a parameterization of the nearby scene surfaces which we call the surface cache. This cache is used to look up the surface and lighting information when a ray hits that point. Think of it as a way to cache the surface information and the lighting in the GPU, to be referred and used later. To generate it, Lumen places projections onto the object surfaces. The easiest way to think of it is as an inverted cube map of the object. These projection planes or capture positions are called cards, and are generated offline for each mesh. Cards can be visualized with the console command R.Lumen.Vizualize.CardPlacement. Using the card's projection, Lumen then renders the triangle meshes to capture all of the material properties from multiple angles. After the surface cache is populated with material properties, Lumen now has all the volume and surface information it needs. Lumen then calculates direct and indirect lighting. And the result of that is fed back into the surface cache to be used in subsequent frames. These lighting updates are amortized over multiple frames. And this is what allows Lumen to support many dynamic lights and multi bounce global illumination. It's important to say that the volume and the surface information are stored separately in the GPU. But to make it easy to comprehend we like to think of it as a single thing, which we call the Lumen Scene. We can visualize it using the Lumen Scene view mode. In the viewport, go to Show, Visualize, Lumen Scene. The Lumen Scene is probably the most important tool you have to understand how Lumen is lighting your scene. In the end, the Lumen Scene is what the Lumen ray tracer sees, and that's what it's going to use to trace rays against. It's the data that Lumen is going to use to generate the GI, shadows, and lighting. But it's also the data that you're going to see in the scenes reflections. Enabling the Lumen Scene visualization will be usually the first thing to do when something seems wrong with your lighting or your reflections. It should match the main view in ways that will have a noticeable impact on indirect lighting. For many years in games, lighting and reflections had to be completely separated systems. This always required some effort from artists to make them match. But in real life, these are all a single phenomenon. Lumen GI finally unifies that. GI and reflections in Unreal Engine 5 are calculated together. We're using some of the same trace results. This is another win for Lumen. Since we are already tracing a number of rays to calculate GI, why can't we reuse these for scene reflections? And we mentioned before that the Lumen Scene is what the Lumen ray tracer sees. This means that the diffuse global illumination and shadow skylight can also be seen in reflections. That also allows Lumen to have geometrically precise reflections, even in softer mode. No more need for manual placement of reflection captures. Lumen is also able to solve indirect specular or reflections for the full range of material roughness values. Remember that in UE4, existing screen space and ray trace reflections used to just cut out for rough materials. But with Lumen, we're able to reuse the diffuse global illumination traces to calculate better reflections on rough surfaces. And this is one of the main benefits of the unified GI and reflection pipeline. In UE5, once enabled, Lumen completely replaces a screen space and ray trace reflections. In Unreal Engine 5, Lumen GI and reflections are enabled by default in new projects. If a project is upgrading from UE4, you may need to change a few options to enable Lumen. First head to the Project Settings, and search for dynamic global illumination method. Set it to Lumen. This will ultimately change all necessary options. First, it sets the default reflection method to Lumen. Secondly, it enables generate mesh distance fields in the project. You must restart the editor to propagate the changes and to generate the mesh distance fields. Let's now go over a few applications and use cases where global illumination is key. Let's start with a clean level and try to create a very simple room. One of these meshes has a window we're going to use to let the light go through. Let's then add a directional light and configure it as we like. Don't forget to set it as an atmosphere sun light so it gets captured by the SkyAtmosphere later on. We now can see that the window lets some of the light through, and it fills the entire room. Next, let's add a SkyAtmosphere and a SkyLight. Don't forget to set the SkyLight to capture in real time. We can now see that as we rotate our directional light around, our SkyAtmosphere updates instantly to match the proper time of day. We can also try experimenting with different materials. As you can see, Lumen updates the scene lighting instantly. And don't forget, this is just a small window letting the sunlight through. It looks really cool to just see the light bouncing different surface colors around and illuminating the entire scene. Another win of real time GI is to finally be able to get the outside lighting to illuminate interiors when you have doors or windows that can be opened. We can even partially block those and have the interior be fully illuminated just by the light bouncing off the doors into the walls. Lumen finally enables those dramatic scenes where you open a door or a window and the light fills the entire room. Our next use case are day/night cycles. We're going to use our basic setup of directional light, SkyAtmosphere, and SkyLight. Again don't forget to set your directional light as atmosphere sun light and your SkyLight to update in real time. Just by rotating the directional light on the y-axis will give us the effect we're looking for. The SkyAtmosphere takes care of changing the color of the sky and the light color according to the time of the day. The SkyLight takes care of injecting the color of the sky as an indirect light, giving the environment a much nicer color. And then Lumen renders everything just as it should. In the context of a game or a simulation, you can change the rotation of the sunlight automatically and update it every frame. The rate of the updates can even be controlled according to your simulation needs. You can also let it be controlled directly. You can hook the sun rotation to the mouse wheel or any other input using Blueprints so the user can control the time of the day directly. And still with Blueprints, you can even trigger your scene to a different setup during nighttime, like making your lights turn on. Lumen can now update to these changes gracefully. And Lumen also works simulating daylight cycles in larger scenes. You can add another directional light to work as the moon, and emissive surfaces will beautifully indirectly illuminate your scene. Now let's talk about some of the tips and best practices that can help you deal with lighting in UE5. It's important to keep in mind that emissive surfaces are not meant to replace light sources. So we don't really recommend that workflow. You can still use emissive services in Lumen, but make sure that you keep them large and not too bright. Things like flat screen TVs or large windows are a good use case here. The small and brighter meshes will add lots of noise to the scene. So in these cases, we recommend that you add a light source next to the small emissive surface, and that you dim the material a little bit. As we said before, the Lumen ray tracer sees and traces to the Lumen Scene, so you can assume that that's what you're seeing in the reflections. But by default, texture and material features may look a little bit blurred if you try to emulate mirror like surfaces. You can alleviate that by enabling harder acceleration in Lumen and increasing the reflection quality. By default, reflection mode is set to 1. So Lumen samples material information and lighting from the surface cache. Your reflections will basically look the same as the Lumen Scene. With mode two, Lumen samples material information from the hit shader, but it still uses lighting information from the surface cache. Mode four has the highest quality. Lumen not only samples material information from the hit shader, but also the direct lighting Using only indirect lighting information from the surface cache. The mesh distance field resolution is assigned based on the imported scale of the static mesh. If you use significant scaling up on placed instances, use the distance field resolution scale to compensate. By default, Lumen traces against each mesh distance fields for the first few meters for accuracy, and then traces the merge global distance field for the rest of each ray. We use these for objects farther from the camera, which allows our traces to be really fast. And we are even less dependent on the scene complexity. Scenes that require areas with a lot of small objects crammed together should consider baking these to a single mesh or whether setting the software tracing mode to global traces. That may reduce overall quality, but will increase performance. Screen space traces work well with most meshes. If you look at this skeletal mesh, you can see that it bounces lighting around quite well due to the screen space traces. But then there is no bounce from it when the screen space traces can't hit it. Both skeletal meshes and world position offsets can receive and contribute to GI if they are visible on screen and the receiving point isn't occluded. The Final Gather default setting is usually good enough for highly detailed environments and exterior scenes. But it may be necessary to increase the quality in some situations. That seems especially important for interior and architectural visualization. In your post-process volume, head to the global illumination section and try to play with the Final Gather Quality option. Try to find what suits best for your scene. But keep in mind that the higher the value, the higher the performance cost, so this is something that you will need to balance. And with this, we conclude this video. Keep in mind that while it's still in early access, Lumen will still go through changes and improvements until the final release of Unreal Engine 5 next year. We hope you enjoy the ride. Stay tuned for more content on our social networks and in the Unreal Engine channel on YouTube. Thank you, and see you later.
Info
Channel: Unreal Engine
Views: 182,935
Rating: undefined out of 5
Keywords: Unreal Engine, Epic Games, UE4, Unreal, Game Engine, Game Dev, Game Development
Id: Dc1PPYl2uxA
Channel Id: undefined
Length: 21min 26sec (1286 seconds)
Published: Tue Aug 10 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.