[2020.1] New Feature - Lighting Settings Asset


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

  • Open Lighting window by navigating to Window > Rendering > Lighting.
  • Click on New Lighting Settings button located at the top of the window.
  • Your newly created Lighting Settings Asset is going to be assigned and located next to the opened sceneā€™s file.
  • 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:

Lightmapping.lightingSettings = new LightingSettings();
ProjectWindowUtil.CreateAsset(Lightmapping.lightingSettings, "My new lighting settings asset.lighting");

Setting directionality mode:

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 - Unity Editor Alpha Releases. We are looking forward to hearing your feedback!

9 Likes

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?

7 Likes

Just put the settings file next to you Lighting Data Asset, or create it from code :slight_smile:

thank u Jennifer, good work!

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).

Not yet ready maybe remember this is wip

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.

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.

@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.

Yes. And also I wasnā€™t viewing the default values.

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

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.

1 Like

Hey, thanks a lot for finding this bug! FYI, Iā€™ve submitted it here: https://issuetracker.unity3d.com/issues/ui-unable-to-input-data-to-the-lighting-window-by-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!

2 Likes

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?

@kristijonas_unity Perhaps you could provide me an answer to my query above please?

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 :slight_smile:

It would be extremely useful to have the lighting environment settings as a .asset. We modify the ambient color, and skybox as part of in game ā€œtransformation eventsā€ in our scenes. Having the environment settings as asset would make previewing and setting this up in the editor much more straight forward.

Right not we just use a scriptable with a custom script, we can obviously keep doing this, but it would be easier if it was supported directly.

Why is this being generated every time I save a scene in 2020.1?
I have a 2D renderer, no lights in any scene, and all lighting settings are disabled everywhere in the project and URP.
All sprites use the UNLIT material.
Is this a bug?

I keep deleting the files every time they are generated to stop them clogging up my hierarchy for nothing.

3 Likes

It seems to be no way to choose default lighting settings (Settings.lighting). Iā€™ve switched a project to 2020.1 and all the scenes got default settings, except one that got (None) and would only receive a separate settings.lighting asset. Itā€™s a mild inconvenience but still looks like a bug.

Thank you all!
I am getting really weird maps though now ā€¦
So I disabled all lights and probes in scene. Everything is set to Bake in Lighting tab. I even took off all environmental setting and I still get a bake but only generated @ runtimeā€¦?

Weird right?

Is there a way to use the global asset by default and not generate an individual file for every scene now? The project clutter is highly undesirable for the majority of smaller unity projects that donā€™t require per scene global illumination settings.

2 Likes