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

Unity [2020.1] New Feature - Baked Light Cookies

Discussion in 'Global Illumination' started by kristijonas_unity, Mar 17, 2020.

  1. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    497
    CookieSupport_Marketing_Final.jpg
    An example of baked fake caustics achieved using baked light cookies.

    Overview
    This feature was developed by Uygar Kalem (@uy3d).

    Using modelled geometry is one of the methods to change the way the light looks. Getting accurate and clean results using such method would need a lot of samples. This is where light cookies come into play. They allow users to change light's appearance and intensity. With their help, users can simulate many different lighting effects. Such effects include caustics, soft shadows, light shapes, and others. This practice is very common in games and architectural visualizations. Before this feature was only available for realtime and mixed lights. We now support baked lights as well.

    Baked light cookies have no runtime cost and are very efficient to render. As an added benefit, they also affect indirect global illumination. This is a key factor when striving to achieve realism in baked lighting scenes.

    We support both grayscale and RGB textures. RGB textures allow for colored cookie effects. Grayscale textures act as a simple mask. Keep in mind that point lights need a cubemap texture in order for cookies to work. All other lights need 2D cookie textures.

    Setup instructions
    Baked cookies support is disabled for upgraded Unity projects to maintain legacy behavior. In order to enable it, navigate to Edit > Project Settings > Editor and make sure that Enable baked cookies support flag is checked. Newly created projects will have this flag checked by default.

    BakedLightCookiesSupport-ProjectSettings.jpg

    Select a light in the scene. In the Inspector, unfold the Emission header. Cookie texture field is located there.
    BakedCookies-LightInspector.jpg

    Here are couple of things to keep in mind when importing cookie textures in different render pipelines:
    • In HDRP, set Texture Type field to Default. Set Texture Shape to 2D if the texture is a 2D map. For cubemaps, set Texture Shape to Cube.
    • In Built-in RP, set Texture Type field to Cookie. Set Light Type property to Spot if the texture is a 2D map. For cubemaps, set Light Type property to Point.
    Unity's texture importer will extract the cookie mask from the alpha channel. For colored cookies make sure the texture contains no alpha channel.

    Additional information
    For more information on light cookies, please refer to the following pages:
    Please keep in mind that is feature is currently available in Built-in and High Definition Render Pipelines. Support for Universal Render Pipeline will follow at a later stage.

    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: Apr 3, 2020
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    7,052
    Didn't play with it yet, might have more to say once I do, but from first glance this looks great!

    Baked IES Support next? :)
     
  3. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    214
    The IES support will sit on top of this feature. Work is underway on an IES importer. Once that is done we can connect the dots.
     
  4. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    345
    Hey I just wanted to say it's nice to see this along with the other illumination goodies in the next release :) Thanks for the hard work!
     
    Last edited: Mar 18, 2020
    kristijonas_unity likes this.
  5. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    217
    Thanks for the baked light cookies and hope to see baked ies support. But, I will criticize that do u think editor section of project settings is right place to put check box for cookie??? Shouldnt it be somewhere else ? Maybe lighting tab? Second, İts name should be "Enable Baked light Cookie" , not start with "Disable" word, isnt it?
     
  6. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    164
    This setting is a guard to ensure legacy behavior. By default support will be enabled for new projects (the new scene templates are being updated currently). Unless you're upgrading an old project and want to start using cookies, you shouldn't even have to know about this setting.
     
    Gokcan likes this.
  7. DryerLint

    DryerLint

    Joined:
    Feb 7, 2016
    Posts:
    45
    I was extremely excited about this new feature, but it doesn't seem to work with HDRP.

    I have the latest beta build of Unity (2020.1.0b4), and my version of HDRP is up to date (8.0.1). I can neither get directional cookies nor cubemap cookies to work. I did get baked cookies to work in the default pipeline, but I need RGB cookies.

    Any advice? Thanks.
     
  8. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    164
    You'll have to use the soon to be released HDRP version 8.1 for baked cookie support.
     
    DryerLint likes this.
  9. valarus

    valarus

    Joined:
    Apr 7, 2019
    Posts:
    203
  10. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    164
    Latest probably not. There'll be a proper 8.1 release and it should show up in the package manager.
     
  11. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    497
    PSA: @JenniferNordwall has made some UI usability improvements to this feature. The checkbox in the Project Settings window has been renamed from Disable cookies support to Enable baked cookies support.

    We will now also show a warning when assigning a cookie to baked light when baked cookie support is not enabled. Same goes for mixed lights.

    This change will land soon in the latest 2020.2 alpha. 2020.1 backport is on its way.
     
    Last edited: Apr 3, 2020
    JenniferNordwall and Gokcan like this.
  12. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    996
    Thank you Jennifer, I just did test and it is working nicely.
     
unityunity