Lighting problems with edges of meshes

I am having a problem with shadows I don’t want appearing along the edges of my meshes, it is a lot more noticeable when the meshes are placed next to each other.

I measured the walls out so that they would snap together perfectly when using the grind in UE4 so they are technically clipping into each other a tiny amount, but moving them apart doesn’t do much to improve the problem.

I have tried a bunch of different things I have seen online to help, some things make it worse and others improve it slightly. I have tried:

  • Changing the Light mass settings in the World Settings.
  • Changing Lightmap resolution as well as Min Lightmap resolution and Light Map Coordinate Index.
  • Changing to different light sources as well as changing the movability of the light sources (Static, Stationary, Moveable): Changing lights to Moveable does improve it a lot but it also means I won’t be able to have that many lights in the scene close together.
  • The material / texture I use doesn’t change anything nor does changing the material to two-sided.
  • The mesh has good smoothing in Blender.

The only other thing I can think of is the UV’s. I have unwrapped them but I am not that great at knowing the best way to unwrap UV’s, if you have any tips on that, that would be great.
I am not sure how UE4 handles UV’s but there are 2 UV channels, 1 which is the UV I created and the other one auto generated?

The screenshots I have taken are from a new blank project with no changes to the default lighting settings. Although it looks the same as my other project with changed light settings.


Hopefully someone has a fix for this,
Thanks

My wild guess would be that you don’t have enough padding around your lightmap UV islands…

How are you building the lighting? CPU Lightmass? GPU Lightmass? Are you using virtual texture lightmaps?

I am just clicking the drop down next to Build then build lighting only. I will try just clicking build to see if that works.

Also I completely forgot to include my UV map.

Edit: Looks like building everything did not work.

Is this the lightmap UV? What do the lightmap UVs look like?

That was the UV layout on Channel 0. This is the UV layout on Channel 1 which I think should be the lightmap UV.

I’d suggest you try reducing your min lightmap resolution, while also increasing your actual lightmap resolution.

Min Lightmap Resolution is used to determine how much padding will be placed around the lightmap UV islands when Unreal generates the lightmap UVs, if you set it too high then you’ll get texel bleed from the adjacent islands, this is mainly noticeable at lower mips. In general you want it to be quite a bit lower than your actual lightmap res.

That seems to have improved it a lot but there are still some sharp lines on the top and bottom of the seam.

I messed around with a few values and edited the UV’s a tiny bit. It has improved it a lot but the shadows are a lot more sharp. My lightmap resolution is set to 512 and min lightmap res is at 16. I am going to keep changing the values.

Hello!

It could be that this is not a Light Maps issue, but Ambient Occlusion.
The Ambient occlusion is a shadow that is generated by the proximity of objects. I don’t know if it is activated from the beginning, but you can deactivate it from a scene using a Post Process.

  1. On
  2. Off
  • Create a new Post Process Volume (Or use the one you have in your scene)
  • Check “Infinite Extent (Unbound)” if you want to the post process to work in all your scene
  • And in Rendering Features category, go to Ambient Occlusion, check Intensity value and put 0.
    image

I’m not sure if this is your problem, but you don’t lose anything trying!
I hope this helps you!

Thanks for the tip, but it doesn’t seem to help much unfortunately. This is with AO intensity at 0.

16 is probably way too low for min res, I wouldn’t go below 64. I would expect 64 min with a 512 lightmap to produce the same results. The minimum resolution is basically a balancing act, you want it to be as low as you can get it while still getting good results, but you don’t want it to be too low or you’ll be wasting too much of your texture space on padding.

Your remaining artifacts I’m guessing are probably related to how you laid out your UVs, I’m guessing you did not create a UV seam on the edges that are still showing lines, and so you’re getting bleed from neighboring texels.

It’s hard to understand your UV layout but I assume you need to break these off into their own UV islands:

I changed the UV’s and created a UV Lightmap in Blender. It has got rid of the shadows but there is a clear seam between the meshes and 1 appears to be a different shade than the other. Could this be a separate issue?

This is the new UV map:

This is the new Lightmap:

That’s a crazy amount of UV islands for such a simple mesh… You should probably merge a lot of those if you care at all about efficiency… Every UV seam doubles the vertices along the seam.

Yes, your new issue is just an artifact of how lightmass works. Basically it has to process each mesh on a different thread that doesn’t have information about what the other threads are doing, so you end up with discontinuities in the lighting. You can read more about it here but unfortunately all the images are missing as they didn’t survive the forum migration.

There are 4 main ways to deal with this:

  • Use higher quality lightmass settings (will have a huge impact on your light build times, especially in complex scenes).
  • Design your mesh pieces in a way that the seams won’t be noticeable
  • Merge the meshes where the seams are occuring into a single mesh. This will ensure Lightmass treats them as a single mesh. Lightmass won’t be able to distribute its work as efficiently if you do this, but it’s still most likely going to be way faster than using higher quality settings.
  • Use GPU Lightmass instead of CPU lightmass. It doesn’t suffer from this issue. But it is still in development and is missing a lot of features, especially if you are in UE4. It also requires a raytracing capable GPU.

Some examples of higher quality settings and their results (including the light build time on my 3900x):

Most of the time my advice would be to either design around it (usually impossible for floors) or merge your meshes. But it’s your call.

1 Like

Thanks for the tips on removing the seam, its looking a lot better now.

The UV map that you pointed out was the UV Lightmap, is that not how lightmaps are supposed to work - Each of the UV faces separated. If not what would be the best way to make a better UV Lightmap?

You don’t want to separate every single face into its own island, you only want to split faces where it makes sense to place a seam, usually on hard corners for example.

It looks like you’re just auto-unwrapping your mesh, I would highly suggest you invest some time in learning how to create a proper UV map in general for whatever modeling program you’re using, as most of the same rules apply. The primary difference for lightmap UVs is that you cannot have overlapping UV islands.

Yea I understand how to unwrap in 3DS but I am using Blender for this and from what I can find it doesn’t have nearly as many tools as 3DS for unwrapping (hopefully I am missing them). A lot of the recommended plugins are either not in the Blender plugin library or the store page to download them has shutdown.

I remade the UV’s and lightmap. It seems to have improved it a little further.
UV:


Lightmap UV:

1 Like