Search Unity

Real-Time Lighting Documentation

Discussion in 'Editor & General Support' started by stonstad, Nov 15, 2021.

  1. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    I struggled greatly in my journey to better understand Unity's lighting system. In hindsight, I believe some of my 'hard lessons' were due to undocumented behavior in Unity. Or perhaps the documentation exists but it is not directly linked from the table of contents or top-level sections.

    With this in mind, I wanted to share what those hard lessons are, and ask Unity to please update the documentation. There could be a section titled "Important Lighting Considerations" which discusses lighting minutia. This feedback is specific to the built-in pipeline but it likely applies to the scriptable pipeline.

    1. Environment Lighting
    a) The skybox ambient light option creates an internal global light probe.
    b) This global light probe regenerates when lighting changes are modified while the editor is stopped; however,
    c) during playback DynamicGI.UpdateEnvironment() is required and the result is async.
    d) The resulting light probe data may be imported and exported via RenderSettings.ambientProbe. You may need to do this because updating the global light probe is asynchronous (you can't easily control the timing or outcome) and it is computationally expensive and/or slow.
    e) This light probe data may be interpolated using a multiplication overload of the underling spherical harmonics data. This is useful for interpolating lighting after a skybox changes.
    f) If this spherical harmonics data is interpolated, care must be given to not increase intensity because it is also multiplied.

    2. Environment Reflections
    a) The environment reflection setting describes a global reflection probe with mask 'nothing'.
    b) This reflection probe regenerates when the skybox is changed and the editor is stopped; however,
    c) It does not regenerate when the skybox is changed during playback.
    d) To modify reflections during playback a custom cubemap must be assigned and there is no command to update it. Provide a link to the code sample which discusses how this should be done, since the editor does not provide a built-in function.

    If all of this is sufficiently explained in the documentation -- thank you! I just wasn't savvy enough to locate it outside the forums.

    I reviewed the documentation available today to see if it is there and I'm just not finding it.
    https://docs.unity3d.com/2021.2/Documentation/Manual/LightingInUnity.html
    https://docs.unity3d.com/2021.2/Documentation/Manual/lighting-light-sources.html
    https://docs.unity3d.com/2021.2/Documentation/Manual/lighting-window.html

    Case 1381022
     
    PapaPaolo57 likes this.