Geometry and Lighting

Very quick question here. Let’s say you make a mesh like a one story house and you have all your interior walls and exterior walls in this single mesh. To stop thing’s like light leaking and to get good lighting/shadows, is it recommended to intersect you’re geometry? Like if I have 3 walls and one wall intersects into another wall and that wall intersects into another etc, is that ok to do?

No, don’t intersect walls, the part that’s not visible will still be part of the lightmap and if it receives light or shadow it can bleed into the visible parts.
Don’t combine that much geometry into a single mesh, a lightmap isn’t enough to cover the space, you have to break it up.

Thanks darthviper that’s great. This has been bugging me for awhile because even when I didn’t intersect geometry I still had light leaking through wall’s. I am building my layout in MapScape (just a CSG builder that you can export your CSG models from.) It’s just walls that I am making in MapScape as I find it easier to layout everything in there rather than building it all in Maya. If that’s what it takes though to resolve this issue then I will go back to Maya :smiley:

I did try to do a modular workflow on my layout of my level but I just got so many seams and issues with lighting and my texture’s were terrible that I decided to give it a go and build the level as a whole rather than breaking it up.

I just want to get a good workflow that works and is quick and easy lol.

Any more advice would be greatly appreciated.

Ok I have been doing a fair bit of researching. I found various threads (which I will link below). It seems to me that there is a lot of people having issues creating modular environments due to the way Lightmass is calculated which is probably why I am having these problems with my modular environments as well.

I was just wondering has this been fixed in anyway? I know UE4 now makes lightmaps for you but are they actually any good? Would it be a better option to just make your own lightmaps?

Other Threads:

In a lot of those cases there’s no reason to make those pieces modular, you actually use more geometry than having a unique wall that’s a single polygon and you cost more in efficiency because each object will count as a draw call. If the objects are really low poly, then don’t make them modular, it’s better to use up a little bit more memory to have unique wall shapes.
The way lightmass is processing things is set to be improved so that things can blend together better, the issue being that currently each object is processed by itself which can lead to slight differences in color from one mesh to the next.
UE4 does better lightmap UV’s than it used to, but you can probably still get a better result by doing it yourself–reducing the number of seams and making better use of the space.

So I have done some tests and the results are a lot better than what I was getting before. I have done my lightmap UV’s myself but I am noticing that I get these weird blotches on my materials/models. I’m pretty confident in saying it is most probably the lightmass settings and I just need to tweak them. I have a 4 point lights and 8 static meshes and a lightmass importance volume.




Ok those blotches appear to be compression artifacts. When I switch off the option to compress lightmaps they go away.


May be I can try and make use of more space in my lightmap UV and see if that helps as I want to compress my lightmaps to save on memory

It could also be something to do with GI samples, it would probably improve if you set the Indirect Lighting Quality higher, though it will increase render times.

Awesome I will give that a try when I am home later tonight. To be honest sacrificing build times to get the best look for my game is something I am happy with :smiley:

So I fiddled around with some of the ‘Lightmass Settings’ and I still can’t seem to get this issue resolved. In fact, after messing around I have had a mixture of results but none of have been able to fix the problem. Here are some shots. I am happy to share the assets (as simple as they are) to see if there is anything I have done wrong. I have made my own lightmaps here and snapped them to the grid using the 1/128 for my grid snap settings. As far as I am aware there is no problem with the lightmaps. I have filled as much of the texture space as I can without overlapping and making sure there is a minimum of 2 pixel padding.



You can clearly see where my modular assets meet. I am using 4.5 version of UE4.

I think your meshes could possibly be better, it looks like there’s some surfaces that you can’t see and you shouldn’t have those there. And the wall section could be one piece, including the molding, and you could make a lightmap UV where it maps perfectly to where it could use the entire UV space.

But the seams are due to how lightmass handles objects individually instead of together, smoothing happens per object so you can end up with seams. Try reducing the amount of smoothing in the lightmass settings.
Alternately, consider not using modular assets. It would actually use less polygons for the wall to be made of one mesh, and since it would reduce the number of objects it would improve performance a bit since it would reduce draw calls.
Modular assets are good when the object has a high number of polygons and you want to save memory or it’s just easier to manage the assets that way.

You could also try covering the seams with either a separate mesh, or something built into your modular piece. For example, this is a modular wall piece from the game Dishonored (which was built in Unreal Engine 3)

On the left is a single piece, on the right is the piece tiling. See how they built a little trim/pillar on the edges so the tiling would work better with the lighting?

Last time I tried making walls similar to the one’s above, my shadows weren’t being cast right. They were wobbly looking (that’s the best way I could describe it lol). My workflow heavily relies on modular assets. I hate working to specific sizes. I work best when my models are modular I find everything more easier, texturing, UV’ing etc.

The game I am making is a pretty big project so I don’t know whether I can just keep building modular assets and ignore the lighting problem and keep developing my game until Epic get it resolved in future updates of UE4. My project is going to be in development for a good year or two (may be longer), I can imagine that Epic should resolve it by the then?

Or isn’t this recommended? I understand that sometimes it isn’t good to have modular parts due to draw calls but the majority of the levels in my project are going to be pretty big. I am confident that my models and UV mapping on the models are pretty much perfect, I’ve been up for a few nights solid trying to get this problem to go away haha.

The lighting is something that they’re working to improve, but no idea when that’s happening. They could end up having a fully dynamic lighting system by the time you’re finishing your project.

Yeah that’s what I am worried about. If I choose to ignore this and keep working, then they could change something big which would make all my models redundant and I would need to go back and make everything all over again. I was using Leadwerks Game Engine for awhile which is a deferred renderer so static lighting everywhere is handled very well and you aren’t required to make lightmaps for each of your static meshes as lighting is all done in real time and there isn’t any performance decrease which is really impressive. Only problem is the engine doesn’t support PBR and there isn’t any support for native Substances or any cool matinee system for it, it’s pretty much a level editor without all the fancy bells and whistles unlike UE4 :stuck_out_tongue:

UE4 is a deferred renderer too, but dynamic lighting is always pretty high in a performance hit.

If something improves in the future, I don’t think it would require you to do more work, beyond like rerendering the lighting or something like that. The problem is, you can’t really count on stuff changing in the future.

I’m a little late to this thread, but just to jump in a bit. I can say that I don’t see Static Lighting and lightmaps going anywhere anytime soon. Would it be nice to not have to worry about all the “problem” fixing and focus on development? Sure, but IMO dynamic lighting just isn’t up to the quality that I can get with static lighting.

There are always improvements to be made, but I wouldn’t expect anything greatly different than the options available now for sometime. Although, if I do use dynamic lighting and shadows I stick with distance fields as I’m loving that system! Daniel has done some great work with that!

The best advice I can give is to work within the tools that you’re given and test often! Only update your project to the latest build of the engine when it has features you can no longer develop without. Finally, make sure to keep backups of your project and not only a single copy.

These are common things that successful games companies do, and I would encourage every other person to do so as well. :slight_smile:

@Tim. Thanks for the advice man. I am confused as to where I am going wrong with the whole modular shadow problems. I don’t know whether it is something I am doing wrong or whether this is just a common problem which happens to everyone. I saw you made a post (this was a while ago) about helping someone with modular floor tiles and you managed to get them tiles looking amazing. I figured one of the main problems which helped remedy the issue I was getting with shadows was to only UV what is seen. I know that this is pretty much common sense (I am still kind of new at this though and working things out as I go along).

Someone told me that whatever you UV in your lightmaps will cast shadows, so I did some testing and UV’ed a simple wall which had about 32cm thickness and I left the sides and top/bottom with no UV’s and sure enough when I brought it into UE4 no issues with light leaking and seams were there but very very unnoticeable and discrete.

I have left the whole modular thing now because it just causes to many problems for me and with me still new to 3D modelling I figured I would like to put my brain somewhere else, so I am starting to focus on mastering the material editor :smiley:

Just wanted to clear up that I have made my mesh for my level and split it into chunks rather than modular sets/kits and the lighting is great now :slight_smile: