Baked Lighting Discontinuity, leaks and seams

Hi! I’ve been messing around with a very simple test level to try and work out how UE4’s baked lighting behaves. I was planning on using some procedurally generated rooms consisting of multiple static meshes - however, constructing a very crude mockup shows a whole bunch of odd looking lighting behaviour. There is light seeping, and in one example an entire bsp displaying the wrong lighting level.

Some of this is previously logged - I know that lightmass doesn’t like multiple static meshes, so seam covering can be a good idea - but I am wondering what the best steps to take to avoid this type of problem would be.

The only light active in this scene is a single directional light.

How thick are the walls?

I used the default example wall static meshes to avoid any possibility of errors caused by my poor uving!

Open up the static meshes you are using for the walls and increase the lightmap resolution to at least 512 for what you are doing. The default is 64 or even 32
Your light maps look too small for the map and you get leaking because of that.

Thank you! That nailed the leaking. I also cranked down the resolution on the bsp parts, and that sorted out the bizarre bsp lighting too. However, the meshes edging out into the main light still display problems.


Say what. Can you reword your “meshes edging out into the main light still display problems.”

That actually might be bad UV lightmap placement.
Try editing the lightmaps.

Absolutely! The end of both hallways has a wall section which is bright white, but is nonetheless inside the hall and sealed. Here is a closer view.


And this is the outside of the room.

Apologies, but I am unsure how to edit the lightmap directly - how would I go about doing that?

You’ll need a 3d modeling program. What UV are trying to edit?

I am unsure. He appears to be suggesting that the lightmap UV might be malformed on the meshes. I think this is unlikely as they are assets packaged with ue4, and I would have thought the lightmap uv would have all shells suitably padded and lined up, especially given it’s just a 6-sided poly!

I do know how to edit the second channel uv in maya, say, and I know that it is a good idea to make a lightmap uv channel for meshes you import to ue4 for that reasons. But I do not know how to edit an already-baked lightmap, which appears to be what he is suggesting!

A lot of the meshes that come with the ue4 stuff have (and im sorry to say this) very unoptimal lightmap uv’s. you could either export the ue4 mesh and edit the uv in maya, make your own mesh and work on the lightmap or try to auto generate a new lightmap inside ue4 (there is an option somewhere in the mesh browser).
Basically you want to make sure the lightmap uv’s are on grid to get rid of most lighting/shadow bleeding.
That said, be sure ALL meshes have a higher lightmap resolution. (256/512 or 1024 if needed) though for a simple wall with proper lightmap uv’s 256 should suffice.

This is actually a known issue resulting from lighting be baked on different threads. The best solution is to have seams at corners or have other meshes that are used around these seams.

This has been discussed multiple times on the forums and here on AnswerHub.

This is a solution that will help some: https://forums.unrealengine.com/showthread.php?8491-Baked-Lighting-Variation-Between-Static-Meshes

Also adjusting the Static Lighting Level Scale to .75 or .5 will help but this will increase your light build times.

AnswerHub Post: https://answers.unrealengine.com/questions/55062/lighting-issues.html

1 Like

I have read these, and these certainly explain the tiling. However, is it the case that any mesh with two dramatically different lighting environments affecting it will render incorrectly?

E.g.


http://i.imgur.com/7cI2v5Z.jpg (this is the outside view showing the projecting wall)

Looking at the example level design map in content examples, some of the meshes appear not to behave like this even though they have two different lighting environments affecting them.

Yes, This is the result and hopefully will be resolved in the future. The main thing is to build your meshes with thicker walls or to have some overlapping or a closed model to keep the light bleed from happening. If you’re using dynamic lighting you can tweak the Cascaded shadow map distance to help with the light bleed.

If you notice in the level design content example that there is a mesh to cover the seams that are present. Also using thicker walls will help.

Here is an example of me replicating (somewhat) what you’ve gotten:
This one is using two walls at the end vs a single

Single wall at the end with some overlap:

Here are some additional links to help:

[Light Leaking from forums post][3]

[Lightmap Bleed in Dark AnswerHub Post][4]

Thanks for taking the time out to reply! I know you guys are working hard on this stuff, Ticking this resolved.

(A question for content creation and level design, in the end).

I want to add an additional comment here that I don’t think is in the above. Bias for lighting has been a long known problem in all work CG related, and is no different here. Yes, having goodish UVs is important. If your UVs are for a gigantic structure, you won’t get many pixels devoted to any single part. I generally break things down quite a bit.

Additionally, there is known problems with your UVs being too close, creating bleed. So a face on one side of the object may interfere with another face elsewhere that is tangent to it.

But mostly what I wanted to say is that BIAS is a problem. It causes shadows to move off the surface, and cause gaps between objects. The bias is found on the light that is creating the shadow. The default bias is .5 I believe. I have had to make my bias .1 to close that gap. Now if you go too small, you will get artifacting, or self shadowing. The polygon faces will get sort of diagonal striations of shadows as it tries to cast shadows on itself. The lower the number the worse it will get. You need to find the sweet spot, between making the shadow move away from where the objects meet, to creating self shadow artifacts.

Bias. Don’t underestimate it.

-Daev