Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Unity [2020.1] New Feature - Lighting Settings Asset

Discussion in 'Global Illumination' started by kristijonas_unity, Feb 21, 2020.

  1. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    466
    LSA-FeatureImage.jpg
    A simple diagram showing how to access the feature via the UI.

    Overview
    This feature was developed by Jennifer Nordwall (@JenniferNordwall).

    Improvements introduced by the Lighting Settings Asset (LSA) feature
    • Ability to change settings on multiple scenes and having more control in multi-bake scenarios.
    • Lighting settings are no longer a part of the Unity scene file; instead they are now located in an independent file that stores all the settings related to pre-computed GI.
    Benefits to the users
    • Lighting settings can now be easily shared between different scenes.
    • Ability to toggle between different lighting settings quickly.
    • Lighting settings asset file can easily be assigned to a scene, removed or modified (either through the Inspector UI or API). This allows for much faster iterations when authoring lighting settings.
    • A single lighting settings asset file can be used by multiple scenes without need to manually tweak the settings for every scene.
    Setup instructions
    Via the UI
    1. Open Lighting window by navigating to Window > Rendering > Lighting.
    2. Click on New Lighting Settings button located at the top of the window.
    3. Your newly created Lighting Settings Asset is going to be assigned and located next to the opened scene's file.
    4. Either select the asset directly from the Project folder, or edit the asset in the Lighting window after assigning it to the Lighting Settings slot.
    Note: Currently, the Lighting Settings asset will be automatically created in the folder located next to the Unity scene file when opening the scene after upgrading to the recent 2020.1.0/trunk branch, but only if the lighting settings of this upgraded scene were changed from the default values. We are going change that behavior for the upcoming 2020.1.0 beta version, so that the asset would only be created after making changes to the lighting settings of the upgraded scene (i.e. changing the lightmapper backend) and then manually saving the scene.

    Via C# code
    Creating the asset:
    Code (CSharp):
    1. Lightmapping.lightingSettings = new LightingSettings();
    2. ProjectWindowUtil.CreateAsset(Lightmapping.lightingSettings, "My new lighting settings asset.lighting");
    Setting directionality mode:
    Code (CSharp):
    1. Lightmapping.lightingSettings.directionalityMode = value;
    Feature access & feedback
    You can get access to the feature by downloading the latest 2020.1 alpha build via the Unity Hub, or via this link - https://unity3d.com/alpha/2020.1a#downloads. We are looking forward to hearing your feedback!
     
    Last edited: Mar 9, 2020
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,675
    Is this not optional? Do I have to clutter my project with a gazillion lighting settings asset files so I can safely edit the settings of a certain scene without affecting other scenes?
     
  3. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    140
    Just put the settings file next to you Lighting Data Asset, or create it from code :)
     
  4. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    955
    thank u Jennifer, good work!
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,675
    Is being unable to edit lighting settings from the Lighting tab an intended design decision, or is it a bug?

    (I can only change settings by clicking the settings asset and editing in inspector, the lighting window itself does not allow me to type new values).
     
  6. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    955
    Not yet ready maybe remember this is wip
     
  7. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    466
    Make sure that you have a LSA assigned in the Lighting Settings window. If there's no asset assigned, you will not be able to edit any values in the Lighting Settings window.
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,675
    Nah, it's some sort of bug. The asset is assigned correctly. It happens after I do a bake and it's only for inputting values with keyboard. If I click and drag to increase/decrease values, then it works properly (and uses the correct values). If I type values, nothing happens.

    Probably some sort of UI bug that is unrelated to the LSA feature.
     
  9. DavidLlewelyn

    DavidLlewelyn

    Unity Technologies

    Joined:
    Aug 14, 2012
    Posts:
    23
    @AcidArrow is the Lighting Settings Asset actually assigned in the Lighting window? If it is not assigned, you will be viewing the default values which are not editable by design.
     
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,675
    Yes. And also I wasn’t viewing the default values.

    I will post a short video if I find the time later today.
     
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,675
    Here's a video @DavidLlewelyn and @kristijonas_unity

    Some notes:

    1. You need to start a bake and let if finish normally by itself for it to repro. Before I do that it seems to work fine. I'm using the GPU baker, not sure if it matters.
    2. When I'm selecting the various fields in the video I am typing things. Please don't ask me to record myself trying to type things.
    3. I can edit values with a mouse, just not with a keyboard.
    4. At around 11seconds, I am selecting the asset directly and editing it in inspector (just clarifying because I cut off the top by mistake). I can edit the asset in the inspector fine with both mouse and keyboard. And as you can see they update the settings in the lighting settings window, meaning the asset is set correctly.
    5. I hope you can see that this mean that the asset is properly set in the lighting settings.
    6. I will not submit a bug report, if this is not enough for you to fix it, then it might as well stay unfixed.

    EDIT: 7. I did not try it in the video, but maybe you can take my word for it, copy pasting (with keyboard) also works.

     
    Last edited: Feb 24, 2020
    Jesper-Mortensen likes this.
  12. V_Kalinichenko

    V_Kalinichenko

    Unity Technologies

    Joined:
    Apr 15, 2015
    Posts:
    14
    Hey, thanks a lot for finding this bug! FYI, I've submitted it here: https://issuetracker.unity3d.com/is...-keyboard-after-switching-between-editor-tabs
    It looks like it's unrelated to the LSA feature, as this is a regression introduced in 2020.1.0a23.
    In any case, our developers will take a look at it and fix it as soon as possible.
    Cheers!
     
    kristijonas_unity and AcidArrow like this.
  13. CD_MT

    CD_MT

    Joined:
    Jul 18, 2019
    Posts:
    7
    Nice Work - this will be a massive improvement, thanks!... very keen to try this as soon as I get a chance.

    Could you tell me @JenniferNordwall @DavidLlewelyn - how these settings relate to baking a scene comprised from several sub scenes?

    Light settings currently exist for each subscene. Though we endeavor to maintain a 'lighting scene' which holds our required bake settings, the settings will will invariably differ across the other subscenes. As a result we regularly get into a tangle due to the 'wrong' subscene being active :

    The overall 'look' may immediately differ (skybox, fog etc)
    Baking may produce several directories of redundant baked data (named depending on active subScene)
    + AutoGenerate accidentally left on in any subscene exacerbates the above issue.

    Clearly the first of these issues is fixed with your new settings - but what of the actual baking? Can the new settings also provide the 'path' to which the baked data is written, for example?
     
  14. CD_MT

    CD_MT

    Joined:
    Jul 18, 2019
    Posts:
    7
  15. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    140
    Hi

    Currently, skybox and fog are part of the scene and render settings, which we haven't moved to its separate file yet (and might never do since most of those things will be redone in the SRP workflow). So these settings will be attached to the active scene (which is also being used to fetch the current lighting settings). The active scene workflow is so rooted into how everything works in Unity, but hopefully the lighting settings workflow helped a bit with this.

    As for the bake location, what problem will this solve? I just want to fully understand your situation and why this would be a good solution for you.

    Thanks :)
     
unityunity