Search Unity

Scene lit by many togglable lights

Discussion in 'Global Illumination' started by jpmota99, Apr 26, 2021.

  1. jpmota99

    jpmota99

    Joined:
    Jan 21, 2019
    Posts:
    4
    Hi!

    I am currently working on an island map with a day/night cycle and 4 seamless zones.
    At night, the scene should be lit by multiple fixed light sources spread around the scene (probably around 50-150).

    The problem I am facing is that the player needs to toggle each zone's lighting system, which means baking the light is not optimal.
    On the other hand, has there won't be any other light sources during the night, and for that reason, no-bounce real-time lights won't fill the scene properly (not to mention the performance concerns of having 100 real-time lights in a scene).
    (I haven't implemented each solution, I am only trying to predict the outcome and can be wrong)

    The 'obvious' solution that I came up with is to create about 16 different baked lightmaps and programmatically chose the right one for the current state of the map (lights active only on zone 1, or zone 1 and 2, etc...).

    Am I missing something?

    Thanks for your help.
     
  2. jpmota99

    jpmota99

    Joined:
    Jan 21, 2019
    Posts:
    4
    Forgot to add that I am using the Standard Render Pipeline
     
  3. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    You could do that, but interpolating between so many lightmaps will be expensive. Especially at higher lightmap resolutions. But it is doable.

    One of our community members has created a 3rd party plugin which allows you to do just that: https://assetstore.unity.com/packages/tools/utilities/magic-lightmap-switcher-built-in-rp-192332

    Note that we cannot endorse 3rd party plugins, nor provide support for them here on the forums. You'd have to contact the developer directly for that.
     
    Last edited: Apr 29, 2021
    Eugene-B and jpmota99 like this.
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Alternatively, you could use Enlighten Realtime GI for this. Though, with so many light sources present, you'd need to resort to deferred rendering.
     
  5. jpmota99

    jpmota99

    Joined:
    Jan 21, 2019
    Posts:
    4
    I might be missing something, but my real-time lights look like this:


    I am instead looking for a more "natural" look that, from what I know, can only be achieved with baking, right?
     
  6. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    323
    Thanks for mentioning my tool! It's great to know that the Unity team is keeping an eye on this.

    I would like to clarify something about the costly interpolation between lightmaps. The fact is that my tool interpolates only between two lightmaps and at certain moments it changes the pairs between which it is necessary to interpolate. It doesn't seem to matter how many lightmaps are baked in this case? This will only affect the build size. In addition, interpolation occurs at the shader level. Anyway, I didn't notice any performance degradation even on complex baked scenes with many lightmaps in different indices. (for example on Archviz vol.6)

    I would be very grateful if you could tell me how to check what you are talking about to make sure.
     
    kristijonas_unity and JoNax97 like this.
  7. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    323
    I think baking in mixed mode is what you need.
     
  8. jpmota99

    jpmota99

    Joined:
    Jan 21, 2019
    Posts:
    4
    Thanks for the suggestion, but in this case that didn't do much more than add some reflection to the 'lamp'. It's not the look I was going for, light spread around the lamp.

    I will try to implement the original idea of switching between lightmaps, thank you for your replies and suggestions!!