SPEAKER: Hey, everyone, and
welcome back to another Unreal Tips and Tricks series. Today will be talking
about the new GPU Lightmass plug-in released in Unreal
Engine 4.26, which brings a much faster
and more accurate light baking solution
to your project. OK, so let's start by explaining
the basics of light mapping and why you would want to
use it for your projects. So lightmap is a way
of generating textures that simulates lights in
your game environments. In this example,
I have two cubes. So on the left, we
have our cube set to static meaning
it will be receiving all the lighting
baking information at this defined position. Now if I move this
cube, we can see that we lose that information as
well as of the shadow not being projected in real time. Now on the right, we have
our cube set to movable, meaning it's completely dynamic. And if I move this, we
can see that it does keep the light information. And the shadow is
completely dynamic. But, we aren't getting
as good as the result compared to the baked
lighting information. And is harder for
the GPU to render. Now we have a basic
understanding of lightmaps. Let's jump into the subject
and go through the settings together. So the first step you need to
do is go into the Settings tab and in your plugins folder. And we're going
to be typing GPU. And the first thing that you
see here is GPU Lightmass. So make sure you enable that. It's going to ask
you to restart, so let's just hold
on to that for now. The next step we want to
do is enable ray tracing. So let's go into project
settings and let's type in ray tracing. And make sure that is enabled. And this will also prompt you by
asking if the skin cache needs to be enabled. So make sure those
two are enabled. Then what we need
to do is make sure it's set to DirectX 12. So type in RHI. And then what we want to do here
is scroll down to the bottom here and make sure
that you are set to DirectX 12 to make
the GPU Lightmass work. Now the last step is optional,
but is a good feature that allows you to visualize
your lightmap baking in a progressive way . This is done by using the
virtual texturing feature. So in our project
settings, let's search for virtual texture. And let's make sure that
both Virtual Texture and Virtual Texture
Lightmap are enabled. This is going to enable a
progressive rendering baking in the viewport, which I'll
be demonstrating later on. OK, so once those steps are
done, let's restart our editor and see you very soon. OK. So we are back in our
project and my shaders are done compiling. So let's go into our
Build dropdown menu and we can see that we
have our new GPU lightmass option appear. So as soon as we open
this, we get a few options for the quality of our baking,
which we'll cover shortly. But let's dock this panel
next to our details panel for easier access. Let's start by the
first option, which is unique to the GPU Lightmass,
and it's called the Progress Bar Visualizer. So let's go ahead
and demonstrate this by building our lights. We can immediately see
our lighting doing its job and projecting progress
bars onto the meshes. Now, the higher the
lightmap of the mesh, the higher density
of progress bar will have on our mesh reflecting
our lightmap texel density. For example, my floor has
a value of 2048 resolution, meaning that I'll have
much more lighting and shadow information at
the cost of a longer baking. Now if I stop the lighting
and go to my floor mesh and decrease the value to
something lower like 512 and then bake our
lighting again, we can immediately
see the progress by speeding up due to the
lower density of my lightmap. So it's usually best to
start with lower values to check any artifacts
in your lightmap and then work your way
up in terms of resolution to something that
fits your needs. While being in the
interactive mode, the baking will be slower
due to the real time feedback of the
viewport and prevent GPU high memory consumption. So a good tip is to deactivate
the real time viewport by pressing Control
R on your keyboard to allocate all your GPU
power to the lightmass and speed up your render. The main advantage
of GPU Lightmass is being able to pre-visualize your
lighting data before baking. While being in
interactive mode, I can adjust my directional lights
and see the global illumination reacting depending on
the angle of the lights. Same goes for my
skylights, which I use to illuminate my scene. I can adjust my intensity and
get a preview during the light baking process. OK, now that we tested what the
new GPU light baker can do let's go over some settings
together and get the best out of the tool. So our first option is to
Show progress Bar that you can either enable or disable. Note that requires the virtual
texture support in the project settings to be enabled. Next mode is the
Baking Mode, which allows you to choose between
a full bake, which renders the full lightmap resolution
for each object in the scene, or a Bake What You See mode that
renders only the objects that are in view. Then we have the
Denoiser, which as you can see on these renders,
smoothes the noise produced by lightmap baking. This is a good way to keep
your baking process fast without having to use
very high sampling to compensate for the noise. Now for the Global
Illumination settings, we have the number
of GI samples. The higher values,
the better results. But it will affect build time. We'll come back on
this one shortly. Now for Stationary
Light Channel Samples, it allows you to control this
sampling better defined shadows if required on the scene. For Irradiance
Caching, without going into too much
technical details, it's a ray tracing-based
technique for computing global illumination
on diffuse surfaces, computing indirect
illumination bouncing off one diffuse object onto another. When enabling
Irradiance Caching, you have the option to enable
First Bounce Ray Guiding. The basic idea is that it
traces a few samples known as trial samples to get
a general idea about how the lighting is in your scene. It fetches the brightest
area of the scene to weigh the rest of
the samples towards. This is the result with no
irradiance caching or first ray bounce guide where we can notice
some dark areas, especially in these two spots. And now this is the result
with the two enabled. We can see a clear improvement
of my light baking, especially around the corners. Now concerning the number of
samples, the higher the value, the better light baking you
will get at the cost of a higher baking time. If you want to
experiment with these, know that it's best to keep
your irradiance caching and first bounce
ray guiding sampling at 25% of the GI sample. This is the result
obtained with new values and we can notice
some improvements on the light sampling between the
default values and the new ones that we just entered. Notice how my corners of
the wall are now smoother and show less artifacts. I hope you enjoyed this video
about the new GPU Lightmass tool. And see very soon in the
next Tips and Tricks.