Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

HybridRenderer only draws up to 4 lights per batched drawcall

Discussion in 'Graphics for ECS' started by spaceemotion, Apr 1, 2020.

  1. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    I am currently facing an issue with the HybridRenderer (v1 as it seems), both in 2019.3 as well as 2020.1.

    When I put my GameObjects into a subscene and they share the same material, only up to 4 lights (or whatever limit I have set in my render config) actually show up - not per mesh, but for the whole drawcall.

    Is this something that is known or being tracked? Otherwise I could submit this as a bug report. If this has already been fixed in HybridRenderer v1, I can just wait and increase the limit for now.
     
  2. SebastianAaltonen

    SebastianAaltonen

    Unity Technologies

    Joined:
    Feb 21, 2020
    Posts:
    112
    Hybrid Renderer V1 does not support URP in 2019.3. In 2020.1 we have minimal URP support for Hybrid Renderer V1, but local light sources are still not supported at all. Hybrid Renderer V1 codegen has a bug that it doesn't disable light and SH, etc fetching. So you get undefined results as the engine doesn't setup this data to the shader. We fixed a lot of these issues in SRP 9.0.0-preview. Unsupported features are properly disabled.

    Hybrid Renderer V2 will have URP lights support before end of the year. HDRP lights are properly supported even in Hybrid Renderer V1 in 2019 Unity versions.
     
  3. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    Hm, that’s weird. We are already able to use subscenes with URP in 2019.3 + hybrid renderer and both directional as well as point lights work as expected (well, except for the bug as described above).

    Since we can’t wait til the end of the year, what would you propose? We really like the simplicity or using subscenes right now, especially for collaborative editing.
     
    Opeth001 likes this.
  4. SebastianAaltonen

    SebastianAaltonen

    Unity Technologies

    Joined:
    Feb 21, 2020
    Posts:
    112
    Directional light works fine. It's a global light source that doesn't need per-instance data inputs. The original hybrid renderer (v1) didn't support any per-instance data inputs in addition to LocalToWorld/WorldToLocal matrix. Thus it didn't support features such as URP lights (needs closest light indices per instance) and light probes (needs SH coefficients per instance). It should only render one local light (light 0) properly. If you are seeing 4 lights then that's strange indeed. And as you said, there's no code in the original hybrid renderer to find the closest lights, so the same lights are visible on every rendered mesh. If you have too many, then that doesn't work.

    In Hybrid Renderer V2 we added a new data path for per-instance data from DOTS to the shader backend. This allows us to feed per-instance data such as closest light indices and SH coefficients for each entity separately. We have backend for this working in Unity 2020.1 (needs also SRP 9.0.0-preview package and hybrid.renderer 0.4.1). However we don't yet have the DOTS Burst C# jobs for setting up the URP lighting data. This is scheduled for 2020.2 currently.
     
  5. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    That is SO weird. we're getting expected results when placing point lights in URP subscenes; both directional and them work like they would as normal game objects.



    The "fake" GI you see in this example scene (e.g. near the gate) is all using hand-placed point lights. They also appear/disappear depending on the configuration in the render settings.

    Based on your explanation it matches what we're seeing though: as soon as we go over that threshold no more lights can be placed in the scene. So I guess we'll have to use game objects for now and convert to subscenes at the end of the year? We're not afraid to use preview packages, so if there'll be an "early adopter" package out sooner, that'd be very helpful (like for a 2020.2 alpha build or something).