Search Unity

Feedback Per-mesh light collections (also query)

Discussion in 'Universal Render Pipeline' started by hippocoder, Jan 21, 2020.

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hi,

    In my game I want to light meshes quite individually with no overlap with other objects. At first I was really excited and assumed URP would allow us to restrict 4 lights per object that would only affect those objects. This means I could have a UI light layer and a light layer per object on screen, because I need to have no overlap.

    I totally get that URP is 1 pass per rendered mesh for 4 lights, but why can't the 4 lights be unique per pass? There is nothing preventing this as far as I know.

    (I know I can raise the number of lights but that will still break it, I don't need more lights, I need to group a set of lights per object, without overlap or sharing).

    Instead it becomes stressful and gets in my way because when one light goes near another, it automatically sorts it and removes a light that's near it. I understand totally what's happening there. It's fine for a general game where lights are all over the place but I specifically want to use URP's wonderful power to light objects individually with no overlap and no sharing.

    This is because my game has a lot of intricate portal objects which all have their own lighting setup, but can be moved around the screen. As you can imagine it works wonderfully until things get close to each other.

    By making the light settings unique to each rendered object this would go away. In fact it I sadly expected such a mode to be baseline what with the already existing internal layer system...



    Hows it done / advice please / did I miss something obvious ?
     
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Yeah they completely have obfuscated the culling process, even if you gop down to srp, which was a huge let down to me. Having the cull result to pass manually would be cool. Anything you want to do with light mean writing your own light and culling pass most of the time.
     
    hippocoder likes this.
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looks like I'll have to settle for something less good, a shame really considering there's no technical barrier.

    I'd have thought not sharing lights at all would be more reliable for the developer. Being able to assign or group lights to renderer.

    Even something like "render this mesh with this list of light settings".

    Actually now I've dug into it, it is per regular unity layer and it works fine for my purposes. So I've got 4 lights for my UI, 4 lights for this kind of object collection and so on, and that's just perfect for me. I like that it's intelligent enough.

    It'll do :D

    Still would like it per material tho... if Unity's listening. I want uniqueness and isolation.
     
    neoshaman likes this.
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    It's srp, but while looking at how to pass light list to my GI system I found that there is some undocumented stuff in the scripting manual:
    https://docs.unity3d.com/2019.3/Documentation/ScriptReference/Rendering.PerObjectData.html

    most notably
    https://docs.unity3d.com/2019.3/Documentation/ScriptReference/Rendering.PerObjectData.LightData.html

    I'm also amaze I'm finding nothing to get a list of light in a scene in built in :(
    Does that mean I have to do my own light and culling system, come on!
     
    hippocoder likes this.