3/8/16

Lightmapping issues

I've been having issues with Unity 5's lightmapping.  Sometimes.  I can't seem to figure out why they happen when they do.  One time I'll bake a scene and it will be covered in random black splotches.  Another time I'll bake the same scene and it will be fine.  And all I'm doing differently is restarting Unity and/or clicking on a few faces in ProBuilder.

I did some research and it seems that the black splotches are caused by overlapping lightmap UVs.  In theory the problem should be solved by having Unity itself generate the UVs (or at least that's solved the problem for a lot of people), but I'm using ProBuilder, which generates its own UVs.  I can only assume the issue stems from ProBuilder in some way.  Next time it shows up I'll try disabling automatic UV generation and manually hit the button myself before baking.  Maybe ProBuilder trying to make UVs all the time is causing issues.  At one point the problem seemed to go away when I upgraded to the latest version of ProBuilder, which I assume would have to re-generate UVs.

I'm also finding that initially baking lightmaps is taking a long time.  Like, 20 minutes, for a small scene with just one building and some ground.  Lowering the resolution and typical fixes like that don't seem to do anything.  This might just be because I have an old CPU (an i3), or it might be because the building in question is divided up into several parts rather than just being one object.  Or maybe that's just how it's going to have to be.

Anyhow, the point is that lightmapping has become a huge issue, both in terms of unexpected behavior and time, and unfortunately it's something I can't avoid doing.  I don't want the game to have high system requirements with low-res visuals, just because I have to use realtime lighting for everything to make development workable.  Plus, realtime shadows kind of ruin the look, and without realtime shadows (or baked shadows) there isn't a good way to make interiors and exteriors have different light levels in a single environment.

Oi.  It's frustrating, to say the least.  If anyone has any advice I'll be glad to hear it. 

No comments:

Post a Comment