Shadowing light mapping question

Hi guys.

I have actually fixed my own issue with lighting but I am trying to understand how I fixed it. Simply for the purpose of trying to learn to work with light mapping with unreal editor, i have modeled this basic chair in 3ds max and imported it into unreal editor.

At first the shadows looked very wrong, so I started messing with the settings for lighting. It seemed that nothing would help at first, but then I changed the light map resolution to 32 and it looked better. I continued trying different numbers for the resolution and made it look perfect at 8. At any other number though and the shadowing is wrong. Why is this?

So in a nutshell, I solved my own problem, but would like to know why what I did worked. Thanks.1ZZZ.png1ZZZ2.png

Default setting for lightmaps on a static mesh is 32, which means 32x32 pixels. Setting it higher (multiples of 2) increases the detail in the lightmap.
If things look wrong at a high resolution, then there’s likely an issue with the second UV channel which is what the lightmap uses.

Hi JWoods,

As DarthViper pointed out the lower resolution is essentially “hiding” those details by having it that low. 8x8 isn’t really at a high enough resolution to bake good shadow information.

When you build lighting and if your shadows appear wonky on your mesh this is typically likely to:

  1. not have a second UV with non-overlapping faces setup
  2. if you do, not having the UVs properly laid out
  3. having a poor resolution for your lightmap resolution (32, 64, 128, 256, 512)

As a tip: Most objects will not need anything higher than 64 or 128 for moderately sized objects. If you’re continually bumping up the LM resolution it may be time to reconsider the UV layout to make it more organized.

World of Level Design has an extensive setup for Lightmaps and how to properly use them. I’ve recommended this site numerous times and it’s a great place to learn about Lightmaps and how to properly set them up. This can greatly help explain some of the intricacies of using them and why extra care should be used for setting them up properly. Even though their tutorial setups are with UDK/UE3 and not UE4, lightmap setup is still the same.

If you’re confused or have any questions feel free to post and I’ll offer some assistance. If you have a specific quest about the LM setup make sure to post a screen shot of your second UV. This can help in determining a solution or offering a tip much more quickly.

Thank you!

Tim

Thank you. it seems that every time I answer one questiion, another comes up. I fixed my UVs and the shadows are now better, but now faces show or do not show on the arms correctly when I change angles. I have looked all over mesh settings and can not seem to solve it. Here are 2 pictures. One is how it looks and the other is how it should look.1 Looks.png2 - Should look.png

For whatever reason my browser will not post the images correctly, sorry about that!

This looks like flipped faces. This also, needs to be fixed in your modeling software. You can verify that this is it by looking at your mesh in the mesh viewer in UE4 and toggling on the Normals to see that they are correct.

If correct the the xyz will be outwared like so:

Normal1.PNG

If the face is flipped the normal will be facing inward like so:

What modeling software are you using? There should be a way to check the normals for flipped faces.

Let me know how it goes! :slight_smile:

Tim

I’ve been having issues with my second UV channel not seeming like it is actually being used for the lightmaps. I’m going to check out these tuts, Thanks for the reference.

If you’re not sure it’s using the lightmap open up the mesh in the mesh viewer and in the details panel to the right where the LOD information is. Find the “Lightmap coordinate index” and make sure this is set to 1 instead of 0. Here you can verify that the lightmap is currently being used.

Wow, Can’t believe I missed that. Thanks!

Thanks Tim. However, that was the first thing I checked and I have confirmed that the faces are not flipped.

XXXXXXXXXXX.png

New information

Take a look at this picture. I used a boolean compound to make this cup holder. I exported the seat with the cupholder and without. The one without the cupholder works fine, the one with does not. Any idea anyone?

When I see this model with the cup holder I immediately think you need to cut up that 20+sided Ngon you just made with the Boolean subtraction. Try to build your model with quads, and when you encounter a spot where you cant make a quad, then a tri is usually okay. Never ever export 5+ sided Ngons and make sure the quads you make are flat and the perimeter of the poly is convex and never concave. Also if you can help it try not to build long and very narrow polygons, if you can help it.
After you have built proper geometry, check your smoothing groups. These suggestions are not UE4 specific, just general good modeling practices. Other games engines I have used in the past would give all sorts of problems with 5+ sided polys, and bad smoothing groups. I have yet to test UE4’s tolerance for bad geometry.

Some of the old 3dbuzz modeling on the fly video tutorials did an excellent job of showing how to cut up polys for proper edge flow and eliminate Ngons and T-verticies. These video’s had Zak Parrish doing the modeling, who coincidentally is now at Epic. It would be very cool if we had a new video or two by Zak specifically on the best modeling practices for UE4.

Thanks Punisher. Okay, at the risk of feeling stupid, I must ask this. What are you defining as a “quad” I have an intro to 3ds max book that I have been studying and the thing I am finding is that the terminology the book uses is often very different from what people with experience use. I appreciate this again.

Yup, Booleans will do it! KVloger had a similar issue that was discussed on this thread where FrankieV and myself and a few others offer some advice for building meshes.

https://forums.unrealengine.com/showthread.php?31082-Meshes-with-missing-faces
The main thing to remember, as The Punisher pointed out, is to make sure you are avoiding Ngons.

You may be familiar with these terms but just incase.

N-Gons - any polygon with 5 or more sides.
Quad - polygon with 4 sides (most recommended way to model because a quad can always be divided into a Triangle)
Tri - polygon with 3 sides.

Try cutting the edges and making sure that your mesh is either using tris or quads.

UE4 does a fairly good job of making most ngons into tris but sometimes you’ll get errors like you’re seeing.

Give the the above a try and take a look at the other forum thread. If you’re still having issues feel free to ask questions and we’ll all do our best to offer some assistance! :slight_smile:

Tim

You guys have been great!

Because of this post the following things have happened through trying to solve this issue:

I have gotten much MUCH better with UV’s. At first I thought the issue was with my UVs or shadowing and at first it was. I learned to work with both MUCH MUCH better because of this.
2. I have learned much better ways of building my geometry.

  1. I have a better understanding of how game engines work, although I still have a long way to go

Although I am now looking for a workaround for this noon / Boolean issue, this post has been extremely helpful.

It’ll get easier the more you work with your meshes. You’ll make a lot of mistakes before getting things just right and honestly that’s the best way to learn. The more time you spend working on something figuring it out will give you insight into how to avoid things like this in the future.

Anytime you have questions feel free to ask! There is a really diverse group of people in the community and our staff that are willing to help. :slight_smile:

Tim