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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Area disk light not working?

Discussion in 'Global Illumination' started by pbaumgartner98, Apr 14, 2020.

  1. pbaumgartner98

    pbaumgartner98

    Joined:
    Mar 1, 2020
    Posts:
    13
    So I want to use a area disk light but it doesn't seem to work.
    I baked the scene, but no light?
    Any ideas?
     
  2. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Is the receiving plane set to receive GI? Does it work if you change to a rect area light?
     
  3. pbaumgartner98

    pbaumgartner98

    Joined:
    Mar 1, 2020
    Posts:
    13
    Rect area lights work
    What do you mean with "GI"?
     
  4. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,065
    What are the version where this is supposed to work? AFAIK it has never worked in 2018.4.
     
  6. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Baked disc area lights work just fine in 2019.3.10f1, I've tried it myself. As @KEngelstoft said, make sure that your plane is set to Receive Global Illumination from lightmaps in the Mesh Renderer component.
     
  7. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    I am not sure I am following: what has never worked in 2018.4? Could you please clarify?
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,065
    Baking Disk Light with progressive lightmapper. It has never worked for me in 2018 although I admit I haven't tried again super recently.

    Also, side tangent, are baked area lights broken in general in newer versions of Unity? I'm trying HDRP and 2019 and...

    This is not light coming from an area:

    upload_2020-4-30_0-28-17.png
     
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,065
    Updating this thread, Baking Disc Lights also does not work in 2019. There is no light being emitted.

    Is it an SRP only feature, somehow?

    Or is it a practical joke?
     
  10. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Are you by any chance using custom falloff scripts for your baked lights? If so, you'd have to modify the switch statement to take disc lights into account. Here's a modified version of the script:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Experimental.GlobalIllumination;
    5. using UnityEngine.SceneManagement;
    6. [ExecuteInEditMode]
    7. public class ExtractFalloff : MonoBehaviour
    8. {
    9.     public void OnEnable()
    10.     {
    11.         Lightmapping.RequestLightsDelegate testDel = (Light[] requests, Unity.Collections.NativeArray<LightDataGI> lightsOutput) =>
    12.         {
    13.             DirectionalLight dLight = new DirectionalLight();
    14.             PointLight point = new PointLight();
    15.             SpotLight spot = new SpotLight();
    16.             RectangleLight rect = new RectangleLight();
    17.             DiscLight disc = new DiscLight();
    18.             LightDataGI ld = new LightDataGI();
    19.            
    20.             for (int i = 0; i < requests.Length; i++)
    21.             {
    22.                 Light l = requests[i];
    23.                 switch (l.type)
    24.                 {
    25.                     case UnityEngine.LightType.Directional: LightmapperUtils.Extract(l, ref dLight); ld.Init(ref dLight); break;
    26.                     case UnityEngine.LightType.Point: LightmapperUtils.Extract(l, ref point); ld.Init(ref point); break;
    27.                     case UnityEngine.LightType.Spot: LightmapperUtils.Extract(l, ref spot); ld.Init(ref spot); break;
    28.                     case UnityEngine.LightType.Area: LightmapperUtils.Extract(l, ref rect); ld.Init(ref rect); break;
    29.                     case UnityEngine.LightType.Disc: LightmapperUtils.Extract(l, ref disc); ld.Init(ref disc); break;
    30.                     default: ld.InitNoBake(l.GetInstanceID()); break;
    31.                 }
    32.           ld.falloff = FalloffType.InverseSquared;
    33.                 lightsOutput[i] = ld;
    34.             }
    35.         };
    36.         Lightmapping.SetDelegate(testDel);
    37.     }
    38.     void OnDisable()
    39.     {
    40.         Lightmapping.ResetDelegate();
    41.     }
    42. }
     
    AcidArrow likes this.
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,065
    Oof! That was it!

    Thanks!
     
    kristijonas_unity likes this.
  12. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Glad to hear it is working for you! We will update the bespoke Unity manual page with the updated version of the script soon.