Global illumination & lightmaps OK in editor, but not working in builds

Hi everyone,

I’ve been fiddling with Global Illumination and lightmap baking in Unity 5 beta 14, and have been very impressed with the realtime lighting results. However I’m coming across an issue that has stumped me.

In this test, I wanted to depict changes in sun position over the course of a day, and have been successful in getting the scene lit up the way I want it to. Here’s a screenshot of the test scene in the Unity editor window. In this scene I used a main directional light, plus a few faint point lights added in darker areas of the space. All lights have some degree of bounce intensity boosted up to create that nice saturated light effect. This is how it looks like:

1889003--121544--unityGI_1.png

(Offhand, there’s the strange double LightmapDisplay dialog box there in the bottom right corner. Anyone get these in your Unity Editor too? It doesn’t affect the scene, nor mess things up, so it’s not a big issue.)

What’s bad for me is this here: when I build this as a standalone desktop app, and execute it, this is what I get:
1889003--121546--unityGI_2.png

The lighting has gone wrong, and I’m not quite sure where to start to fix this. The pitch black shadows and grey walls look very similar to when I manually disable lightmap display in the editor. So I suspect that the built app does not take the precomputed lightmaps into consideration.

The rest of the scene’s interactivity works, including realtime shadows. I also do get the occasional texture corruption, as bright green/magenta polygons. When moving through the scene, some partial polygons show up in the desired lighting (you can see some of that on the left side of the above image).

Can anyone shed some light on this? The test scene is a really simple, low-polygon mesh that rendered beautifully in the editor. There’s not much point if this visual effect doesn’t show up in the built app. I do not have much experience with lighting in Unity, especially realtime GI combined with lightmapping, and any advice would be greatly appreciated.

Here’s what I’ve gone through so far:

  • Testing this on my development machine: Macbook Pro Retina, 16GB RAM, GT750M, Unity 5 beta 14
  • I’ve checked the quality settings in Unity and ensured best visual quality a.k.a. Fantastic option, which I have also enabled when running the build
  • Tried both x86 and x86_64 builds, same results
  • Rendering Path: Forward
  • Lightmapping: non-directional, atlas: 1024, realtime (1texel) & baked GI (40texels/2padding/compressed)
  • Graphics API: Direct 3D 9 (tried D3D11 but needed Windows to run)
  • There’s no requirement for this to be mobile; it’s eventually meant to be run on a beefy desktop PC

Could this be a platform-specific issue? Something wrong with the way I configured my lightmaps? Did I run out of texture memory?

With respect to the double floating windows. I suspect that if you ‘revert to factory settings’ your unity windows layout that this will clean itself up. As far as the light-mapping did you try clearing out the baked data and clearing the GI cache and re-baking?

@seattlebluesky ,

Thanks for suggesting the clearing of baked data and GI cache – I didn’t realise the GI cache setting was found in User Preferences, so that was a good discovery! I believe clearing it helped to at least re-initialise the Enlighten routines. It didn’t work for me, as the baking would complete, but I still get the same results in the built application.

It turns out that the scale of my mesh was the cause. I worked on the model you see above in Sketchup, which was imported at a scale factor of 1. Re-importing the same model at a scale of 0.1 did the trick. I do wonder though: if we have large scenes and multiple static lightmaps to work with, will this problem show up again? Perhaps a test to run for the future.

In my attempts to find the cause, I also reinstalled Unity (b17). I noticed that there are no longer skyboxes included in the standard assets anymore? I can’t seem to find the Character Controller package, either. Here’s a screenshot of the importable libraries:
1889321--121568--unityGI_3.png

Yes, I noticed the missing Skyboxes also. The Environment package would be a good place for them imho.

We removed the skyboxes from the installer as it added a significant amount to the download size, as well as saving people from having to wait through the hdr convolution times on first opening the example scenes.

The plan at the moment is to have a set of hdr’s/skyboxes as a separate asset store package, as well as adding some more to the calibration scene package already on the store. The character controller package has been superseded by the characters package - there shouldn’t be anything missing in the new controllers that was present in the old one!

Thanks for the info. Sounds like a good plan. I did also notice that the Sparkles were missing from the Particle Systems package.

sketchup models are usually horrible topology. if you don’t bring it into a normal 3d modeler and clean it up you’re probably going to run into lots of issues.

thanks @p87 , it does seem like Sketchup had to trade off it’s ease of use with mesh topology issues. i’m now building the entire scene from scratch again, but I will definitely try the cleanup you mentioned.

@peteorstrike : thanks for pointing out characters package!

1 Like

yeah, it’s not ideal for games. Lots of really long triangles, high valence vertices, and weird topology can have lots of issues with lighting, especially if you’re trying to bake normals, etc.

I think if you’re good with sketchup you may be able to keep things somewhat in order, but will always probably have to take it into a 3d modeler, merge duplicate vertices, fix quite a bit of stuff… pretty much retopologize it.

I will say that it would be amazing if sketchup had some way to produce clean topology. That Sketchup Warehouse has sooo many models in it.

Thanks for the additional notes, @p87 . I’ll look into those detailed points you mentioned when it comes to future mesh optimisations.

Yes, the Sketchup Warehouse is extensive and another reason why I continue to use it to make quick mockups.

By the way, I seem to have isolated the problem regarding the screenshots above:

  • My mesh model scale was way too large – Sketchup FBXs need to be specified with a mesh scale of 0.1
  • At that scale, the single Reflection Probe I was using was simply way too big to compute correctly (basically I was using the dimensions of the entire model to serve as the probe – I had a glass wall on one end of the layout that I was trying to get good reflections of the interior). By reducing the Reflection Probe dimensions, the problem went away. This is an alternative to reducing the scale of the model, if your scene is huge.

Hope this might help others experiencing similar issues in the future.

1 Like