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

How to optimise 2D lights?

Discussion in 'Universal Render Pipeline' started by JUSTCAMH, Mar 24, 2020.

  1. JUSTCAMH

    JUSTCAMH

    Joined:
    Dec 8, 2018
    Posts:
    18
    I've set up a pretty simple 2D lighting scene, using the URP 2D lights and some 2D Shadow Casters. I'm having difficulty optimising these lights, so that I can use multiple without slowing down the game. All the lighting performance advice that I could find online pertained to the old lights, or to 3D URP lights, so what sort of tricks can I use to speed up my 2D lights, using the URP 2D renderer?
     
  2. JUSTCAMH

    JUSTCAMH

    Joined:
    Dec 8, 2018
    Posts:
    18
    Hey, I'm still interested to know some more optimisation tricks, but here's two that I found;

    Use sorting layers, and only have the bare minimum layers rendering lighting.
    Avoid using volume lights, these are quite slow.
     
  3. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    Hi! A few points here:
    • Use as few Blend Styles as possible.
    • Try reducing the render texture scale of your Blend Styles.
    • Use as few sorting layers as possible.
    • Make sure your lights affect as few sorting layers as possible.
    • Use normal mapped lights only when it's absolutely necessary.
     
    Gojarz and goodgamershow like this.
  4. erizzoalbuquerque

    erizzoalbuquerque

    Joined:
    Jan 23, 2015
    Posts:
    50
    Hi! I'm using 2d lights in my project and I'm working with Unity 2020.3.21f1

    I'd like to know if 2d lights with normal map are still slow?

    I did a small test with 150 2d lights. And turning "use normal map" on and off didn't result in any significant difference in performance.
     
  5. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,323
    Test for your lowest-end target device. 150 lights may be perfectly fine on desktop but too much on mobile.
     
    erizzoalbuquerque likes this.