light mapping is not consistent across meshes

Hi,

I am experiencing some inconsistencies with light mapping using UE 4.8.1.

More specifically, I am computing light maps (using production quality, but the problem arises with any quality setting) for a building where walls for the
two floors are separate meshes, using the same material (which is a rather simple material with base color, metallic, roughness and normal textures).
However, lighting computation is not consistent across the two meshes, i.e. one is lit differently than the other:

The lightmass settings are the same for the two meshes, and I am using just a direct light (sun), a skylight, and the BP_Sky_Sphere blueprint. The inconsistency issue is visible where the building is only lit by indirect light and sunlight.

These are the global lightmass settings I am using:

Any advice to solve the issue, besides attaching the meshes together? I would rather keep them separate to reduce light map resolution (since
this is going to run on mobile devices).

Another issue is that there are some artefacts on the inside part of the walls:

These dark bands corresponds to “columns” that are attached to the wall on its outside part. Using two sided lighting on the mesh gives the same results.

Any help is very appreciated.

Looks like you have a lightmass importance volume around your play area, but can’t be sure, can you confirm this?

the usual culprit for these kinds of artifacts is caused by incorrect lightmap UV’s. Check that your wall static mesh pieces have a second UV set and that UE4 is set to use that second UV set for lightmapping/lightmass.

Tips:

  1. make sure the second UV set (lightmap UV’s) are not overlapping at all
  2. lightmap UV’s should be fitted into 0-1 UV space
  3. make sure there is sufficient padding around the UV islands on your lightmap UV’s to prevent bleeding
  4. create as little seams as possible on your lightmap UV’s
  5. use up as much space as possible in your lightmap UV’s (it’s ok to scale and stretch the UV’s to use up more space, as long as it’s a little bit of stretching)
  6. in UE4, open your static mesh in the static mesh editor (select it in the level and hit CTRL+E) go to the lightmap resolution settings and increase it to see if that helps in your next bake

Good luck!

Also, decrease the lightmap smoothing in the lightmass settings. Also, if you are using multiple simple meshes then try making them into a single mesh instead of building walls out of multiple meshes.

First, thanks for the comprehensive checklist. Yes, there is a lightmass importance volume around the building, and all static mesh pieces have a second UV set that UE4 is using for light mapping.

These conditions are met.

These are the light mapping UVs for the bottom and top walls, they look ok to me:

I tried that, but the problems are still there…

My understanding is that these artifacts are caused by lightmaps being calculated on separate threads, and that there’s no way to solve this on the asset creation side. Instead, the solution is to turn up your lightmass settings.

Tim Hobson wrote a really good post about the issue and how to fix it here:

Brian Karis proposed some fixes to somerelated issues about a year ago using techniques from Naughty Dog, but I don’t know if anything ever came of that.

I decreased the light map smoothing to 1.5, and then to 0.8 and 0.6 and indeed the artefacts are less noticeable as the parameter is decreased. Still not perfect, but thanks! This is the result with the parameter at 0.6:

6.jpg

Now I would like to know what that parameter really does, as the tooltip explanation is quite obscure, and several posts on the ArchViz forum suggest to increase it below one to get rid of noisy light maps (and that’s why I had increased it ) …

Yes, I know I could have joined the wall meshes, but I was trying to avoid that to keep light maps size as low as possible. I’ll do that if there are no other possibilities.

Ouch, lots of answers already there, I should have searched better before posting. Thanks!

Btw it would be nice if all sorts of lightmass-related issues were collected in a wiki page, with pointers to existing solutions (or even better, a resume of them). I know there is one wiki page, but the info that I received in this thread were not there … Information is so scattered across forums, answer hub, documentation, wiki that sometimes it is quite easy to miss something due to choice of search keywords … Also, the fact that changing a lightmass parameter requires, in some cases, to wait minutes (if not hours) to see the result makes it a bit hard to experiment with parameters.

However, when it works, result is awesome :slight_smile:

They’re going to be putting together an all-in-one guide for lighting so that people don’t have to keep reading the threads, but the reason is this

Building lighting uses a number of light samples, to render faster you can reduce the number of samples (part of the Lightmass Quality setting), but at lower quality it creates noise in the lightmap. So there’s the smoothing setting which reduces the noise, but since lightmass is processed on each mesh individually the lightmap doesn’t get smoothed across the meshes. In cases where you have a flat surface made up of multiple meshes it can show seams when it receives more indirect lighting. A way to reduce it is to lower the smoothing value and increase the quality value. Though it might not be enough.

Your UV’s are too fragmented, you have a ton of shells/UV islands. You need to get rid of most of those seams. You can never get rid of all of them, but I can tell you by one glance at your UV layout, it needs a lot of work. Most people think creating lightmap UV’s consists of just autounwrapping everything and keeping it from overlapping, but that’s not the case. The artist needs to understand how the UV layout will affect the lightmap results in the engine later. Creating proper lightmap UV’s is actually a skill, as tedious as it may be. Stretching the UV’s slightly is not a problem, if you have to, do it; but you need to make sure you have the least amount of seams possible AND make sure the few seams you have (you will have them) are located in areas not visible to the player.

Basically, if you have a bad UV layout (like the image you posted, those are REALLY bad) you can crank up your GI settings as much as you want, will still look horrible. However, if you have a great UV layout, you can get great GI results with lower/crappy settings. It’s crazy to me how this important piece of info is overlooked so often by many people, it should be the first thing you learn if you’re an environment artist (else your lighter/finishing artist will hate the **** out of you).

Let me know if you have any questions!

Since you asked for it :slight_smile:

Let’s consider my top wall. What do you mean exactly by “getting rid of most of those seams”?
This is the geometry (you are seeing the outside part that is shown in my previous screenshots):

ae84f3189b086d9f8f6eeb1ada614656aae48815.jpeg

and the inside part has small “columns” attached to the wall.

This is the same mesh with the UV mapping, where I highlighted with arrows two correspondences.

de43b8b2c8f2a7ef733db6ca82d0f1d0d10e9252.jpeg

My understanding is that the two meshes pointed by the arrow need to be separated in the light map UVs because there is a 90 degrees
angle between them in the mesh, so, because the normal has a discontinuity by traveling from one triangle to the other, than lighting behaves
differently, and, if I attached them, there would be light bleeding. In other words, I have seams at corners and I thought this would be correct.
Where I am wrong?

Again, thanks for any help. Really appreciated!