Search Unity

[SRP] More control over filtering/drawing

Discussion in 'General Graphics' started by Meetem, Oct 10, 2020.

  1. Meetem

    Meetem

    Joined:
    Feb 10, 2014
    Posts:
    23
    Hello, I'am writing custom render pipeline and I want to send additional per-object params for rendering (which cannot be done without having renderers exposed). Ideally it's done by allocating ComputeBuffer and filling it with coresponding data (gameObject.layer for example), then call context.DrawRenderers(). Yes, there is a hack with setting material property via script but this would be definitely break batching, which is not a performant solution.

    We can obtain lights from CullingResults, but there almost no info about objects. It would be much nicer to have renderers exposed to managed code or at least for burst.
    Burst/IJobParallelFor callback would be such a nice feature for Sorting/FilteringSettings to make custom filtering and sorting.
    With current implementation I can't even access how much objects of given layer exists.
    This can be useful for example for deferred light rendering where stencil bits can be manually calculated.

    The other valuable thing is to have access to renderers visible by specific light, this also can be used to speedup shadow rendering (using instancing for objects visible for multiple lights)
     
    Last edited: Oct 10, 2020
  2. Meetem

    Meetem

    Joined:
    Feb 10, 2014
    Posts:
    23
    It would be also nice to have control over RenderState for CommandBuffer.DrawMesh/DrawMeshProcedural e.t.c to set render state params like blending/stencil not only for DrawRenderers. Of course this could be done by materials, but it's not convinient to append all the shaders inside project. And it's not always possible (for example when using built-in shaders)