>> Hey everyone, and welcome to another Unreal
tips and tricks video.
Today we'll be looking into lightmap bleeding.
Light bleeding usually occurs
when using baked lighting and visible between the walls seams
or when the mesh has incorrect lightmap UV information.
In this video, I will show you the different steps
to solve light bleeding and get the best lighting results
inside of Unreal.
In this tutorial,
we will be using Revit to show you
how to correctly prepare your assets before exporting
your data
in order to avoid any light baking issues.
Here's a useful checklist before exporting our data.
Make sure to connect wall tops to ceilings
to avoid any gaps between the meshes.
Set wall joints to miter
and finally, avoid any thin geometry for your walls.
Use split faces and give some thickness to your wall
to avoid any light bleeding.
This is our scene set-up in Unreal.
I've used Datasmith to import my building from Revit
and added a directional light and HDRI
background to light up my scene
In this first part of the series, we will
look to how to correctly setup your scene for baked lighting
and use various techniques within the Engine to solve
lightmap bleeding.
A few steps to start and avoid
any light bleeding is by helping Unreal which
area to determine my lightmap
calculation by setting up a lightmass
importance volume.
What the lightmass importance volume does
is control the area
the lightmass emits photons in, allowing
you to concentrate it only on the area that needs
detailed indirect lighting.
So in this case, we want to concentrate the photons inside
of this house.
So let's go ahead and in our top left in our search classes,
search for lightmass importance volume
and drag the actor on the scene.
So what you need to do here is make the actor here represented
by this box the size of the house.
So let's go ahead and scale it on the x-axis
here and do the same on the y-axis.
And actually for better visualization,
let's go to our top view here.
So let's enable the top
and let's enable unlit mode.
We can see that our box is the size of the building, which
is very good.
Now let's drop back to our perspective mode.
And we can see that the box needs scaling up on the z-axis.
So I'm going to go ahead here and press R on my keyboard
and scale that up on the z-axis.
And let's make it
just so it reaches the ceiling.
So we have the size of the lightmass importance volume.
Now it's time to set up the lightmass portals.
All right.
Second tip to enhance your lighting
and avoid light bleeding is by placing lightmass portals
on each window opening.
So go to search classes and type in lightmass portal.
And there you go.
Just drag that actor onto the scene and just
like our previous setup, what we have to do here
is scale it to the appropriate size of where the lighting is
going to be important.
So in instance here,
it's going to be on each window opening
and I'm just going to scale it up again
by pressing R on my keyboard
I can scale the objects.
Let's make sure that our lightmass
portal is covering the entire window bay
and lets duplicate the object by keeping Alt key pressed
and dragging up our actor here.
And let's do the same process as we did on the first floor.
Once you have finished placing the lightmass
portals on each opening,
this is going to tell lightmass that more light rays should
come from this area enabling high quality lights
and shadows.
We're going to go ahead and build the lighting.
But first, I want to make sure we're on preview settings.
So go into the drop down menu and go to lighting quality
and make sure to set preview for now.
All right, here we are after our first light baking
and we have a warning message in the log telling us
that one of our meshes has overlapping
UVs by more than 80%.
So let's go and check that out.
Now I know which mesh is causing the issue in this scene,
but sometimes it may be hard to track which one.
An easy way
to track the object is by clicking on the message,
and this will bring you to the Assets folder.
Right click and go to asset actions,
select actors using these assets.
And this is going to highlight the actor for you.
Press F8 on the keyboard and that
is going to focus on the selected actor.
The error we're seeing here can happen when an object has
bad UV lightmap information.
With the asset selected,
go into details panel and double click on the thumbnail.
This is going to bring us to the mesh editor window.
Go to the UV bar
and let's check our UVs here.
We need to check our channel number two
since this is our automatically generated
lightmap done with our export.
Our UV channel 2 seems to be set up correctly.
But let's check if our asset is using
the correct lightmap destination.
Go into the search details tab on the right
and type lightmap coordinates index.
And we can see here it is using number 1.
So let's go and check number 1.
And what we see here is some overlapping UVs
that must have been set up for our textures.
But for lightmap we need separate islands
and we need to use number two.
I'm going to set up the lightmap coordinating next to two
and press Enter.
Save the assets
and quit the mesh editor window.
And here we can see that we have to rebuild our lighting.
So let's go ahead and check if we have solved our
lightmap bleeding.
And this is our results after light baking.
So as you can see, no more error messages
stating that we have overlapping UVs.
Lightmass is working as it's supposed to.
Now let's enhance our lighting further.
To get better lighting
and shadows in our scene,
we need to increase our overall lightmap resolution
on our static meshes.
You can visualize lightmap density
by going to the view mode tab and drop down
to optimization view mode and enable lightmap density.
Lightmap density mode displays the lightmap density of objects
that are texture maps color coding them
by their relation to an ideal density
setting and displaying a grid that maps to the actual
lightmap texels.
It is important to have an even texel density across your scene
to get consistent lightmap lighting.
I'm going to switch to my lit mode and as you can see,
we have some decent values in the interior.
Let's check the exterior.
Though the exterior lighting doesn't
seem too bad though I noticed that we
have some heavy light bleeding going on the structure here.
So I'm going to enable my lightmap density view mode again.
And I can do that by pressing Alt-0 on my keyboard.
What we can see here is that this structure is
using a low-res texel density for the lightmap.
We're going to go ahead and bump that up.
The way to do that is by clicking on the mesh
and going in the details panel here on the right.
And if you scroll down,
you can override the lightmap resolution here.
Right now we're using a value of 128.
I'm going to go and increase that to 512
and press Escape to display the correct color.
And it's still blue
so we're going to bump that up again and always use
a power of 2.
I'm going to go ahead and go 2048.
It's yellow, it's not too bad,
but we can increase that further.
All right, a value of 496 here is pretty good for our structure.
Before we move on to the light building,
I would like to mention that the values that I'm using here
are for a AEC purpose and may not be suited for games.
Increasing the lightmap resolution
may help fix light bleeding but at the cost
of a higher memory usage, and higher light calculation time.
OK, now, that said, let's go ahead and build our lighting.
After a few minutes of light calculation,
I'm already seeing a much better defined shadow on this arc.
If we compare the two images side by side,
we clearly see that increasing our lightmap resolution
solved our issue in this particular scenario.
In the next series,
we are going to cover lightmass settings
for our final light calculation.