Download

Lightmaps and seams

Looking forward to the new “Do-it” button :wink: . I don´t suppose the new lightmapping tool will cure the problem of different shading on modular building parts? Sometimes I get very strange lighting differences on my modular floor tiles, for example. I guess this has something to do with lightmass rendering the different parts on several threads. I´m not talking about lightmap-seams, but the whole area gets shaded differently sometimes, like per-object an not per-pixel lighting :-/ .

I read somewhere that grouping the objects together should help, but that didn´t solve my problem. Is there any cure for this? It makes modular building really quite difficult in my opinion :-/ .

Thanks!

Excatly. Auto-UV will not cure this at all.

But how can you stop this from happening? It seems so very random and this really bothers me. For example I´ve got four identical pieces all snapped together in a row, two are fine, two are shaded differently. Is there a useful workaround for floor tiles?

@ ForGobbler:

This isn’t random, it’s the way lightmass bakes lighting from different threads. This can be corrected with the use of good lightmaps with verts of hard edges falling on grid lines and using the World Settings > Lightmass > You can adjust settings here (specifically the ones below to get rid of the issue)

World Settings > Lightmass > Indirect Lighting Soothness set to something like 0.6 and Indirect Lighting Quality to 2 or higher but it will increase your light build times.

A combination of using techniques from World of Level Designs tutorials and these lightmass settings should help resolve your issues with seams. I have had success with this and by having a good UV layout, resolution, and making sure hard edges are on grid lines for the LM resolution I’m targeting this has resolved my issues.

Here are some links that may also help. If you’re still having issues with seams feel free to post on any of the multiple threads between AnswerHub and the Forums or start a new post. :slight_smile:

World of Level Design: Lightmapping

https://forums.unrealengine.com/showthread.php?8491-Baked-Lighting-Variation-Between-Static-Meshes
Tim

Actually from my tests, yes it solves modular pieces lightmap seams. I tiled a modular wall and noticed no different shading between the pieces. I think the algorithm aligns the edges with lightmap pixels, which solves this kind of problem.

Edit: or more precisely, as per Tim’s explanation: I think the algorithm “aligns hard edges on grid lines for the LM resolution I’m targeting”. There’s an option for “Minimum lightmap resolution” on the static mesh build options, probably to do this sort of thing.

Thanks guys :slight_smile: .

If I use 64px lightmaps in UE4, the uv-grid settings in 3d studio max are 1/64, right? I´m asking this, because I snapped the uv island to the grid, have enough padding around it and I still get a slight seam :-/ and this strange smoothing shading error . Tim, I tried different smoothing and quality settings, and it is a lot better, but still not 100%.

EDIT: Tim, feel free to move this post to another thread, if you want to keep this related to the new lightmapping function in 4.5 :slight_smile: .

How many tiles had the wall. I have a level here, consisting of 1800 segments for walls, floors, ceilings, etc.
Sometimes I get a dozen in a row lit correctly, but then huge seams at another place. Maybe you were just “lucky” with your wall.
I was also able to attenuate the effect wen directly lit. But in the indirectly lit areas, I never could get rid of the issue.

If one thinks about the whole thing it becomes a bit “funny”:
The lightmap baking is distributed between multiple threads to improve baking performance.
Due to the thread separation we get inconsistent lighting. So this is not systemic to the way the lighting is calculated, but more like an optimization artefact.
If no interpolations were made and the lighting were explicitly calculated for each shading point, the lighting would be a-ok.
Then we need to crank lightmap resolutions up to mask this effect, which in turn, increases build times, thus largely defeating the intended goal of optimization.

Dont get me wrong. Optimizations are good and neccessary. And for most optimizations a compromise must be made.
However it should also be taken into account what “stage” is optimized: Designtime, Build/Compile time or Runtime.
Optimizations that help runtime performance are almost a must and if there are compromises to make, they may be unavoidable.
But that is something where the player (paying customer) can say: “Hey, I benefit from that”.
On the other hand, optimizations that speed up things during Designtime (enabling/disabling geometry rebuild), or lighting build time (multi thread baking) should be optional.
When I am able to build the lighting in 10 minutes for a level but have these artefacts, the paying customer will never know that I only spend 10 minutes on the baking job and he will probaply not even care. He will only judge the result. Whether I enjoy a book depends on the content. I would never say, hmm “crappy book, but wow, it was printed in 35 seconds…”

As it had been suggested already, a single thread baking would be highly appreciated.
Maybe call it another lighting quality stage… Preview - Production - Unreal
It would be intended to the final lighting build. Really the last build before the thing goes into production at the DVD plant.
Even if this would result in a 50 hours lighting job, for the final build it would be worth it.

You are correct that 1/64 will get you the grid size you need. It’s also good remember that since this is a power of two and you’ve targeted a lower resolution LM that if you up the LM resolution to 128, 256, 512 that it will keep aligned to the grid.

There is another methodology and I’ve had better results with it, but only with modular seams at the moment.

This other methodology is taking and minus 2 from your pixel resolution that you are targeting for LM’s then divide that new number by your LM resolution.

ie. 1/(64-2) = 0.0161290323

This thread from the AnswerHub covers a lot of stuff with lightmaps and texel density. The alternative method above is covered about half way down the page.

Here is the original Reddit post that brought this method up.

I used this method with good results, but it requires changing the Environment color from Black to a lighter shade to get decent results.

Give this a look and if you have any questions feel free to ask.

Tim

I have a quick question in regards to this (I also have the same problem). Just like texture UV’s, would texel density apply to lightmaps as well (sorry if that question is stupid)? I mean would all my lightmap UV’s have to be relative to each other on each of my modular pieces? I haven’t tried what Tim mentioned above yet with changing the lightmass options etc. I will defo try this and see if this solves the problem

Hi David,

Texel Density does still apply here as well. For instance, If you have a wall with two main faces and you scale one face to be significantly smaller than the other you will notice that shadows baked to this does not reflect the same density as the one that was not scaled smaller. This also plays into your target LM resolution as well.

Ahh I see, of course that makes sense. I think that might be one of my problems. I’m working with a power of 2 on all my modular parts, my lightmaps are 64 res but all my shells are relative to each other. I think the scale of my shells could possibly be wrong. Stuck at work right now so can’t do any tests to fix. Ahh the joys of life haha. Cheers for the quick response though Tim!

So I think I might have to go back and take a look at my lightmaps. Here is a shot of a wall, the walls modular so its the same wall, same UV’s, same lightmap. So it’s a bit weird why this is happening. I have changed my lightmass settings as stated above.

These are all modular parts so I have no idea what else to look at. The lightmaps seem ok to me as well. If you want some screens of them, let me know :slight_smile:

EDIT: There is only one directional light in my scene. I did read something about having lightmass importance volume, which I don’t have in my scene.

Add a Lightmass Importance Volume to your scene and have it surrounding all the playable areas where players would go.

Then in World Settings > Lightmass > Indirect Lighting Quality - change this to 2.0 and for Indirect Lighting Smoothness - change this to around 0.6.

Also, If you adjust the environment color from Black to a lighter shade this should help eliminate these shadow seams. This will also make your shadows not be pitch black.

It may also require you to build lighting on a higher level than ‘Preview’ along with using a LM resolution of 128.

Give this a shot and let me know how it goes. :slight_smile:

Tim

I tried what you recommended last night Tim. It seems to have definitely made an improvement, but I am still getting seams, so I’m thinking I may have to go back and check my lightmaps. This may be due to me only having one directional light in my scene.

This goes back to the thing that lighting is being baked on different threads. Using the settings for Lightmass will help alleviate but not fully get rid of the seams. It is recommended, because of this, to either have the mesh as one contiguous mesh or to place other meshes and corners at these places where seams would be.

There are improvements being made all the time though, so this could improve in future releases.

Tim

Cool man, right now it isn’t a big issue because there is only one directional light in my scene that’s just there for me to see what I am doing. When I add all my lights in and fix up my lightmaps I’m pretty sure that the seams won’t be that visible :smiley:

I had the same problem, but when I set up Indirect Lighting Quality and Indirect Lighting Smoothness, then build Lighting in production quality as Tim Hobson mentioned, seams gone.

Ahh very nice! Yeah I think then my issue would be with my lightmaps so I’ll go through them this weekend to fix it :smiley:

*Right-click “Creating single static mesh from selected actors” and replacing the single ones could be a workaround *(it happened again)

“Force Volumetric Lightmap” in the object settings might help