Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Official Changes to automatic light baking in 2023.2

Discussion in 'Global Illumination' started by Pema-Malling, Jun 28, 2023.

  1. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    248
    We’ve made a few substantial changes to workflows for generating baked lighting in 2023.2. This forum post aims to briefly describe what each of these changes entail, and how they will affect our users. You will be able to read more about these changes in the 2023.2 upgrade guide, once the 2023.2 tech stream releases.

    “Auto Generate” lighting has been removed
    Overview
    Since Unity 5, Unity has provided 2 workflows for generating baked lighting data: “Auto Generate” and “On Demand” mode. Users could choose between the 2 modes using a checkbox in the Lighting Window.

    In the 2023.1 release, we introduced a new architecture for On Demand bakes, known as LightBaker V1.0.

    In the 2023.2 release (from 2023.2.0a19), we are removing the Auto Generate workflow and moving some of its functionality to a new “Interactive preview” mode, accessible via GI-related Scene View Draw Modes. The Auto Generate toggle in the Lighting Window no longer exists, and the matching scripting API has been made obsolete.

    Why are we doing this?
    Auto Generate mode provides a mechanism for iterating on baked lighting data, but has issues scaling to larger scenes. A lot of computation goes into detecting and responding to changes in the scene, as well as showing progressive updates as a bake runs. Additionally, since automatically generated lighting is written to the GI cache, which is a temporary per-machine storage, this computation would often be needlessly repeated when sharing a project between multiple machines. Data in the GI cache would easily become invalid or get evicted, with no way to track this in source control. We believe that, by rethinking the Auto Generate workflow, we can maintain much of its benefit to our users, while greatly reducing the complexity of the feature.

    With this change, our goal is to have a single, robust, architecture for delivering baked lighting data - LightBaker. We believe this can simplify our architecture, and enable us to develop new features and more scalable workflows in the future. Check our public roadmap for more info on some of these upcoming additions.

    What this means for our users
    • Existing scenes with Auto Generate mode enabled will be automatically changed to use On Demand mode when opened in 2023.2.
    • Use cases relying on Auto Generate mode must be adapted to instead make use of On Demand bakes, via the Lightmapping.Bake or Lightmapping.BakeAsync API.

    • Users relying on Auto Generate mode to iterate on baked lighting may either use On Demand mode instead, or make use of the newly added interactive preview mode, described in the next section. We’ve added a hotkey for generating baked lighting, Ctrl+Shift+L, which can aid with iteration speed.
    Interactive preview for GI-related Scene View Draw Modes
    Overview
    We realize that iteratively authoring and troubleshooting baked lighting data is an important use case. For this reason, we have added a new “Interactive preview” functionality to various GI-related Scene View Draw Modes.

    When entering one of the relevant view modes, a contextual panel will appear in the scene view, letting the user enter interactive preview mode. This feature works similarly to the now-defunct Auto Generate lighting mode, but is completely non-destructive, and will not affect any existing baked lighting data. This allows our users to experiment while troubleshooting baked lighting, without having to do a full On Demand rebake after each change, overwriting existing baked data in the process.

    Note that this should not be confused with the upcoming Realtime Preview of Baked GI in Editor Using Path Tracing roadmap item, which represents a completely separate feature.

    To use the functionality, first select an appropriate Scene View Draw Mode from the dropdown on the Scene View Toolbar.


    A new panel will appear on the Scene View. Use the Lighting Data dropdown to select between Baked an Preview data. Note: On some alpha releases, the dropdown may instead display as a checkbox.


    Users can inspect both the Baked and Preview lightmaps in the Lighting window.


    Automatic baking of environment lighting has been removed
    Overview
    Since the 2019 release, Unity has provided a system for automatically generating baked environment lighting in scenes that haven’t been baked explicitly. This system is known as the SkyManager. We noticed that this system was causing confusion for our users, as the automatic behavior wasn’t very clear, and was only present in a few specific situations. On top of this, the system caused differences in the behavior of the Editor and built Player, sometimes leading to the environment lighting being unexpectedly missing.

    In the 2023.2 release (from 2023.2.0a18), we are heavily simplifying the behavior by removing the SkyManager. To replace it, we’ve embedded a new default Lighting Data asset into the editor, which will be automatically assigned to newly created scenes. The asset contains environment lighting matching the default settings for environment lighting. If you change these settings, you will have to manually rebake lighting using the “Generate Lighting” button in the Lighting Window.

    What this means for our users
    • Scenes that were previously relying on the SkyManager to automatically bake their environment lighting, will be missing environment lighting when opened in 2023.2. A warning will be displayed in the Lighting Window, instructing the user to manually rebake lighting to fix this.
      • There is one exception to this. If the scene was using completely default environment lighting settings, it will be automatically upgraded to use the default Lighting Data asset, and will not have to be rebaked manually.
    • Newly created scenes will receive baked environment lighting from the default Lighting Data asset. If this is undesired, you can use the “Clear Baked Data” option in the Lighting Window to remove it. If environment lighting settings are changed, you must rebake lighting using the “Generate Lighting” button for the changes to take effect.

    • The behavior of the player and the editor, both in edit mode and play mode, is now unified and consistent.
     

    Attached Files:

    Last edited: Jun 29, 2023
    rasmusn and AcidArrow like this.
  2. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    592
    Are you guys going to make videos on Youtube demonstrating how to use these new GI tools?
     
  3. giorgos_unity

    giorgos_unity

    Unity Technologies

    Joined:
    Nov 14, 2019
    Posts:
    32
    Hi @KarlKarl2000!

    We are not planning to make any videos for these particular changes, as they are only re-designs of existing features (as opposed to brand new functionality). What sort of information would you be looking for if we were to make an instructional video on these changes?
     
  4. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    592
    hi @giorgos_unity
    Ok got it. I'm not sure which videos you mean, but if they are basically the same material, then ignore my request.

    keep up the good work all