How do I get rid of shadow errors with lightmaps (with proper resolution)?

Hi,

So I tried to use lightmaps instead of dynamic lights and the results are awful. The resolutions is 1024 and I tried all the possible settings but non of them helped. Any ideas would be greatly appreciated! :slight_smile:

Also the shadows on the wall is quite blurry, even though it has a 0.2 lightmap resolution (BSP).

Thanks,
Fisher

After more than 2 weeks, I’m still struggling with this. :frowning: Really nobody has any idea?

Hi Fisher,

For your object can you post a screen shot of your Lightmap UV? If you’re having to pump your LM resolution that high the LM UV may need a little tweaking to better utilize the space for the best results.

With a model this size targeting a LM size of 128-256 should work best with a good UV layout.

Thank you!

Tim

Hi Tim,

Thanks for the reply. Here is the 2 UV sets. The second one is the original hand made, after having the issue I made an automatic rearrange for more edge padding (the first one). It didn’t help sadly, also it looks the same with different UVs so I doubt if it would be the source. I pumped the LM resolution so high to see if it helps.

I also tried without SGs and with recalculated normals, non of them helped. The next ting to try is to bake in an older version and taking apart the mesh completely and see if it is really down to the relation between lightmass and the shape. If it is lightmass then I’m stuck as I have already tried to change the relevant settings.

Cheers,
Fisher

(Btw why is your answer got marked as resolved? :slight_smile: )
Edit: Nvm, it seems that it automatically marks it as resolved if there are no more comments? Sorry about the confusion. :smiley:

So I narrowed down the issue. It is existing in 4.2 as well and it seems that it is caused by model.

The difference is only in the UV and the resolution. From left the first one is auto UVd in the editor, the second one in Max, the third one is the original. You can see that the 2nd and 3rd has identical normals, tangents and binormals. I don’t really have any other idea to solve this so some help would be much appreciated. Also not sure if it is related, but this doesn’t look normal either (3rd image).

Cheers,
Fisher

With the complexity of the object and how much is being packed into the 0,1 space for your second UV it may be necessary to pump the lightmap resolution up to get better results.

For the 3rd Image I’m not sure which lightmap UV you’re using (looks like the second one that is hand made with the smaller geometry) but this looks like you need to pump up the resolution to get better results. you have a large face that is shrunk down and lighting isn’t getting baked with an immense amount of detail.

Give that a shot and let me know how it goes.

Tim

"If you’re having to pump your LM resolution that high the LM UV may need a little tweaking to better utilize the space for the best results.

With a model this size targeting a LM size of 128-256 should work best with a good UV layout."

This was your first post and now you are saying that the LM resolution is not high enough… I stated in my first comment that I pumped the resolution to 1024 to see if it helps, I’m still here so it obviously didn’t help.

Two identical meshes, two LM resolution (256, 512).

The shadows look better on the BSP but far from being actually good or anything that I have seen in games.

LM resolution of 2048 on the normal mesh, looks terrible.

This was your first post and now you
are saying that the LM resolution is
not high enough… I stated in my
first comment that I pumped the
resolution to 1024 to see if it helps,
I’m still here so it obviously didn’t
help.

I was honestly just eyeing it. I suggested pumping it up when you want more resolution in your LM. The thing is you have a complex mesh with limited space in the 0,1 space for the LM. If you’re not getting the results you like at a lower resolution then bumping it up is a potential solution.

LMs takes work to get right especially if you’re trying to get a specific look.

Part of the issue I can see in the second to last image on the 1024 where it has the line in the middle of the shadow. Are you using a fully static light? This looks like a stationary that is switching between the static and dynamic at a distance which is why you’re seeing a difference.

As for the differences of the LM resolution you’re comparing apples to oranges in this one. The BSP has it’s own LM at it’s own resolution that the shadows are being baked to.

The Mesh you have static shadows being baked to it’s own LM and not another LM.

Try using fully static lighting and build lighting in production level.

You were right, fully static lighting works perfectly. The only problem -and that’s why I haven’t even thought to try it- that if you use static light, dynamic objects won’t cast shadows, right? That is really not an option in a modern game so the problem is still open. I can’t really understand why would stationary make such an awful lightmaps, in the docs it is stated that actually stationary has the better quality. So I still have a feeling that this isn’t the way it should work. :frowning:

There is a fine balance here for getting good lighting. It’s just liking being a good artist. Good lighting is an art in itself.

You are correct, If you use a fully static light it will not cast dynamic shadows on movable objects.

First thing, There is no difference in quality in the lightmap bake between stationary and static lights. The difference you’re seeing is the fade in distance of the dynamic lighting vs the lightmap bake. This is where the discrepancy is coming. You can adjust the cascaded shadow distance and quality to get better results and set the distance you’re happy with the transition.

Secondly, It’s key to remember that Stationary lights are a new thing. They are a balance between full static and full Dynamic lighting. This allows for using your lightmap shadows at distances where dynamic shadows would not be present.

Another powerful feature is to limit how each mesh is affected by lighting. If you select your mesh you can look in the details panel and adjust what type of shadows it is affected by.

For instance, on your mesh, you can use stationary lighting for everything, but for your mesh uncheck the box that says Cast Dynamic shadow. This will only use the static lighting from the stationary light rather than switching to dynamic as you get closer.

I hope this helps clarify some. Give this a test and let me know how it turns out. I’d certainly like to see you getting the results that work best for you! :slight_smile:

Tim

Static:

Stationary:

I checked if the stationary is using dynamic shadows and no, those are the baked ones so there is no fade in. Also, cascaded shadow distance is only for the directional light. What if the scene is indoor (as it was originally)? I’m using a point light for the above 4 pictures, as far as I’m aware there is no such option for that light type.

As for the per mesh settings, as I mentioned there are only baked lights, so changing any settings affecting dynamic lights and shadows has no effect. (I checked all of them just to be sure)
The strange thing is that stationary lights aren’t that new, I was using them in UDK and they worked perfectly. Well I agree with you that creating good lighting is rather an artform but they have been quite better than this. :slight_smile:

Also, thanks for the efforts Tim! :slight_smile: I really hope to get better results as well because UE4 is just so much better than UE3 was, but this really sets it back at the moment.

So I made a simple mesh with a extruded section similar to your exhaust.

Here are my results. Static is getting slightly lower res than stationary static Lightmap. Barely though. I’m not seeing the difference you are though. My mesh is using a 128 res lightmap and it’s using more UV space than yours is though.

Here are the results using a Directional Light:
This is the stationary light with the mesh set not to receive dynamic shadows

This is the static light

Next up, I did the same with a point light:

This is the stationary point light with the mesh set to not receive dynamic shadows

This is the static light:

As I showed you earlier, the BSP had more acceptable shadows, the real problem existed only on the mesh. I uploaded my fbx to Dropbox, if you could take a look that would be grand. :slight_smile:

Also, just to make my dreams better I screwd more things. :’( Dynamic lighting doesn’t work with a directional light anymore. Well it works at first if I open a new project, but then if I bake lighting and then move the light it switches back to dynamic but it is super low res.

I didn’t do much, just opened a new project, imported the mesh, dropped on the scene (first picture), baked lighting (second), rotated the light a tiny bit (third).

I was able to do a test with your mesh and have made a simple test scene with different LM resolutions and lights. I specifically turned off Stationary lights ability to cast dynamic lights and baked only the static for both a static and Stationary light. I was able to see the quality difference between the two and have submitted a bug report for this. (TTP: 348502)

Here is my sample test scene.

Tim