Lightmap issue with static meshes

Hi,

I have the following problems with the lighting of a static mesh. I am sure it is due to a lack of knowledge on my part, so if anyone knows what I may have missed or left out, please let me know.

What I do is:

I create a static mesh in 3dsMax. A simple wall, thus a simple 6 sided mesh.

As I want to save texture space / have more detail, the front and the back share the same texture space, as well do the sides.
Top and botton are separate though due to their different coloring.

After creating a material from the texture (incl a normal map), I export the mesh as FBX and import it to UE4

37164b10c9d63db782c8ec10fdd83e88559af01b.jpeg

It looks OK so far. I have then added a simple box collision.

I do know that lightmaps need their own, strictly non overlapping, set of UV coordinates, which makes absolutely sense, since the texture may be shared between front and back wall, the shaddow will surely cast different on both surfaces.
So I created a second set of UV coordinates via the UE4 mesh editor:

CreateUV.jpg

And it seemed to have been successfull. Here are the two UV channels:

Challel 0 for the texture mapping.

428b4ee91c1b05a7e3e62895b2ef67db2f08f11f.jpeg

And channel 1 for the lightmap

And channel 1 does not seem very overlapping to me…
However, when building the lighting, I get the following error:

UVError.JPG

So, what have I missed/done wrong:confused:
Any help is appreciated :slight_smile:

Cheers,
Klaus

Update:

I managed to set the lightmap index to 1 in the static mesh properties. So no more error there…
Must have just missed that … Ooops… :mad:

However, there is still a small issue.
Can someone give me a short pointer on how to avoid the edges of the mesh showing shadow seams at greater distances…

When I put two of these meshes side by side and view it from closeup, it looks like this:

The shaddow looks good, also the texturfe tiling works fairly well. (The meshes joint asbout where the shaddow falls into the colored part).

But now, when I back off a bit, it looks like this:

Backoff.JPG

A nasty shaddow seam at the lower part of the mesh.

I am not sure where to fix that. Is it a matter of lightmap resolution or LOD related, or both?
How can I get rid of these seams?

Cheers,
Klaus

Hi KVogler,

I am having the same issues.

However, when I put the lightning quality to “Production” (Build > Lightning Quality > Production) it looks better for me.

Probably not the answer to where the problem is, but it might help :slight_smile:

Thijs

By default the lightmap resolution is 32 (32x32 pixels) which is very low, you can see on some places where the corners are rounded which means the lightmap resolution is too low.
When a lightmap is too low then a pixel can also overlap the edges of the UV’s so if there’s black there then it overlaps a bit, so the UV’s need to have enough space between pieces so that it can add padding. If the lightmap is too low, then it doesn’t have enough room.
It’s also best to create your lightmap by hand in your 3D software, the automatic results in UE4 are OK, but you can improve results greatly by doing it by hand. That way you can reduce the number of seams and pack things together better.

Hi All,

Thanks for your replies.
Here is an update of what I tried so far.

@Thijs :
I changed the lighting to production. All it does for me is to render the seam in a better quality.:rolleyes:

@darthviper :
I changed the lightmap resolution to 512with the following result:

399fc652bd912df08b9cd4b324142cd6f0415228.jpeg

So it still looks quite nasty in indirect light.

In direct lighting, the seam is much more narrow, but still unacceptable…

b15437444b5446c968720a753d872dc31ea624d6.jpeg

I also had the normal map temporarily detached to see if the problem lies there, but the seam still shows.

Im still struggling with creating and exporting a second uv set in max and export it correctly…:frowning:

Cheers,
Klaus

see my post? Light in solid, meshes, with normal soft error.... - Rendering - Unreal Engine Forums

the emissive channel material and oclussion map light in post process volume… can “make invisible” your problems.

Hi All,

@ayjolnerub :
I will definitely have a look at your post.
However I think using the emissive for that (and basically eliminating the shadows at all) sounds questionable. :slight_smile:

In the meantime I managed to export the second, in 3dsMax created, set of UV coordinates. They look indeed now a bit “cleaner” as to what the UE4 mesh editor produces:

And now the seams are gone… well, at least if the mesh is lit only indirectly:

That looks nearly perfect on all distances and viewing angles.

However in direct lighting, the seams still prevail… :frowning:

As you can see, the walls facing away from the camera (with the shadow halfway dropping in) also has only a tiny hint of a seam in the shaded region.

Any more clues on thisone? (In case the azjolnerub-solution does not work :slight_smile:

Cheers,
Klaus

Hi All,

just to wrap this up: I finally managed to get rid of the seams. It was appearently a slight misalignment in the UV maps.

Here is the result:

Direct lighting

Indirect light
cfada38f1d0dcb61bf4e0190fb8838ddee29b046.jpeg

Both screenshots were taken with the standard lightmap resolution and the lighting quality set to preview.

What remains is the different shading on both meshes in the indirect light.
Appearently this is due to objects being rendered in different threads, thus inherent to UE4.

It is essentially the same problem as here:
https://forums.unrealengine.com/showthread.php?8491-Baked-Lighting-Variation-Between-Static-Mesheshttp://

Thanks all for your help :slight_smile:

Cheers,
Klaus

Did you check, if all your vertices on the model are merged? It’s absolutely crucial that you don’t have any double geometry, as that will always cause lightmap errors. You may also find that the light itself can cause problems (e.g. too many lights in a scene). I had best results without any direct lighting source, for example. At least with interiors. Of course, not everyone makes a map in darkness/space.

However, try reducing the lights in your scene and switch between the different light types to see if that makes a difference in your bakes. The first thing to do, however is to check your mesh for errors. With plain cubes like these, I don’t really understand why you don’t simply use CSG, though.

Hi,

The only light in the scene is a directional light.
The mesh geometry is absolutely ok. Since it is the most primitive mesh imaginable.
I created a box, punched in the correct dimensions. - Editable poly - UVW unwrap - center pivot in the world - export as fbx.

Good question :slight_smile:
I am currently blocking out a map and running into the following issue:

The map is about 40% done and contains already 1200+ brush actors. It has only one directional light and with preview quality, a build takes now 2 minutes and more.

I just think with meshes, the lighting build times will not be that high anymore.
I estimate that, if created by CSG, the final level would have 3000+ brush actors…

How do you block out bigger levels?

Cheers,
Klaus

ps: Is not only the lithing build time, also while changing geometry, the editor lacks incredibly and an undo takes between 6 and 8 minutes to perform…

I group brushes or put them in folders and copy and paste everything that repeats. In architecture that is usually a lot. I try to use as few pieces as possible and use them over and over again. In Maya, I also found it useful to place the (left, front) corner edge of my meshes on 0,0,0 Position, as that will make them snap more easily than when the pivot is in the center (hold v to snap and drag in UnrealED). Later on, I replace the BSP/CSG with the actual models, after exporting the BSP to use it as a template. Some BSP, such as floors often remains in the final version of a map.

This map must be extremely hard to work with, if you have so many actors. You might want to figure out small and large modules first and make a list + sketches of everything, before starting the in-editor work. I often also make a list of materials I need and start grouping my brushes/models accordingly, so I know which assets belong in the same material group. I find organisation extremely important when working with the Editor, so I use a lot of Groups and Folders.

When you do your lightmap UV’s, try to use as few seams as possible, if there’s no seam on the corner then it can’t bleed over the surface.

Hi,

I already use tiling for walls. I use 500 wide, 40 thick and 460 high slabs for outer walls (covering the floor and ceiling) and a version that is 380 high for inner walls.
There is also a 540 wide version of the wall to cover edges. Only the floors/ceilings are “custom” at the moment.

If I group the brushes, they will still be separate objects. In what way would that affect buld times / editor lag…:confused:

The map is not that hard to work with. Actually it is fairly easy (because nothing is grouped). I can easily pull a window from nearby and duplicate it on the spot without having to fiddle it out of the group first)…

Maybe I should make a little tour video of the level so far and show how it is constructed brushwise…

I also use a well organized folder structure for my assets. As I dont care for brush groupings and they are just for blocking purposes, i didnt bother establishing a folder structure there, especially since so much is in the flow there…

Cheers,
Klaus