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

Lights per object only

Discussion in 'Universal Render Pipeline' started by hippocoder, Feb 14, 2020.

  1. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    Quick question:

    I'd have loved to be able to do 4 lights per object properly, as in I would like to authoritatively reserve 4 lights per rendered object instead of sorting/sharing (I know exactly what lights I want for what object and they must not be shared)...

    Currently I have to use the main layers for this as Unity otherwise tries to sort them and cull them and they pop and it's all very silly. As you can imagine I ran out of layers. Is there a better way to assign lights directly to rendered objects without sharing and without layer limits?
     
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,525
    Not really a solution, but You can probably sort your lights yourself with
    var foo = FindObjectOfType(typeof(Light));or var foo = FindObjectsOfType<Light>();

    You can set a custom shader and pass the lights data manually as parameter.

    I'm still investigating that, I need to do meshless lighting on a texture. Currently spelunking the cginc :(
     
  3. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,158
    This part of the light sorting per object is locked away in the c++ side right now and we can't really expose it in a non trivial way as it ties in deeply with the culling system and a number of other things :( We are exploring how in the (far) future we could expose things like this but it's going to require a redo of a lot of the underlying tech.
     
    neoshaman and hippocoder like this.
  4. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    Thanks Tim, this is a good heads up. I have put some basic dir and point lighting in the shader itself my end which is quite cheap (no spec etc) and will do + some URP lights for niceness.
     
    neoshaman likes this.
unityunity