Search Unity

Lightmapping Complex Close Quarters Scene

Discussion in 'Global Illumination' started by Drtsprtn, Apr 10, 2019.

  1. Drtsprtn

    Drtsprtn

    Joined:
    May 31, 2016
    Posts:
    10
    I'm trying to come up with a lighting solution for a complex CAD scene involving a ship containing more than 200 rooms, this is excluding all of the steel floors, walls and ceilings. These models are not always well optimized and due to the project's time frame remaking them is not a feasible option.

    There's a couple of problems I'm running into or expecting to run into and I am unsure of how to approach them; the three most explicit ones being the behemoth bake time, artifacting, probably due to the models not being of great quality and the memory and performance impact of such a giant scene and the lightmapping problems that come with trying to stream it.

    I managed to get lightmap UVs to be good enough with a blender batch processing script but there is still a lot of artifacting, especially on cylinder-like objects like pipes. Due to the UV artifacting being effectively unfixable, despite many attempts, I've opted to bake their shadows into the environment and to use light probes and light probe proxy volumes to light them. This gives accceptable results, but it feels like it is not entirely the correct approach. Moreover, I still get a lot of dark spots from indirect lighting on walls, even with 512 indirect samples. I have not been able to fix this.

    Secondly, the bake times are insane. I've done bakes for a subset of the places aboard the ship and it takes up to a day while running medium detail settings. With 2 bounces, 32 direct and 512 indirect samples over a texel resolution of 40 per unit the results are not what is expected for the time it takes to bake them. I'm expecting it will take at least 2 to 3 weeks to bake the entire scene. This isn't entirely feasible to my workflow.

    Last of all, I'm expecting to have to implement level streaming due to performance reasons. As far as I know there should be no issues related to lightmapping except for probes not being supported in level streaming yet. As such I'm waiting on a proper 2019.1 release that adds support for this.

    Am I correct in using the workaround for artifacts and just waiting for the GPU baker to handle the lighting in this scene or am I missing an obvious solution?
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hey! Large scenes can definitely be a challenge. Here are some pointers to keep in mind:
    • Rely on mixed lights as much as possible. They provide realtime direct and baked indirect contribution to your scene.
    • Mixed lights will allow you to lower the lightmap resolution considerably, since baked indirect GI does not require high lightmap resolution in order to be convincing.
    • In order to get rid of lightmap noise in indirect areas, you'd need to increase the amount of indirect samples considerably. Something around 2K - 4K would do. 2019.1 comes with Optix denoiser which will allow you to get good results even with low sample counts.
    • Only mark large objects as lightmap static. Smaller objects are better of left as dynamic. Have them receive GI from the light probes instead.
    • You will most likely have to rely on screen space effects for ambient occlusion, as low lightmap resolution will give undesirable results.
    • You could also try to split your rooms into separate scenes, and work with them individually. You can then either bake them in their own respective scenes, and additively load them, or load them right away, and have them inherit lighting settings from the active scene. For more insight on how to work with additive lighting setups, check out our official Additive Lighting examples - https://assetstore.unity.com/packages/templates/tutorials/additive-loading-lighting-examples-129922
    I hope this helps.
     
  3. Drtsprtn

    Drtsprtn

    Joined:
    May 31, 2016
    Posts:
    10
    Thanks for the reply!

    I've seem to have omitted a few important details.

    The scene I'm creating will be used in VR and contains roughly 350-400 potential light sources. I've created a few tests using realtime lighting in deferred but the results were unsatisfactory, both visually and performance wise. Would it still be feasible to take the mixed lighting approach?

    For additively loading scenes, would baking them separately not introduce artifacts at the edges of the areas when they are brought together? Does baking separate scenes with gameobjects that are big enough that they are present in both introduce errors? For instance, would separating 2 rooms and baking them separately with a wall that goes through both give correct results?

    Additionally, I've been looking into options for distributed lightbaking but haven't been able to find anything. Does this exist, or is it perhaps a planned feature?
     
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Seeing as VR is your target platform, then yes, deferred rendering is not a viable option. You could still use a lot of lights in forward rendering and cull them via script, but that requires additional work.

    Baking scenes separately, and then additively loading them afterwards would indeed require a more careful way of authoring content, so that you would not run into the issues you've described. There's still the possibility to additively load all the scenes and bake the lighting once they are all loaded. You will not run into issue with lightmap transitions then.

    Distributed baking is not yet supported in Unity, but it's been in our backlog for awhile now. The short term solution is to have GPU-accelerated lightmapper to offset long bake times.