Search Unity

ScriptableRenderContext.DrawRenderers() specify Gameobjects to render?

Discussion in 'Universal Render Pipeline' started by Solovykh, Oct 18, 2019.

  1. Solovykh

    Solovykh

    Joined:
    Aug 28, 2017
    Posts:
    59
    In a custom render pass, is it possible to specify which renderers to render in the pass?

    I know you can specify which culling mask layers to render, however, I'm looking for something more fine grain.
     
  2. Shane_Michael

    Shane_Michael

    Joined:
    Jul 8, 2013
    Posts:
    158
    There are a few ways that I know of to specify the renderers you want to draw:

    A) By layer. You can use a cullingMask or by distance per-layer. Once you get the culling results you can refine it further filter it with a more specific layerMask or a rendererLayerMask in your FilteringSettings.
    B) By position. The ScriptableCullingParameters are usually these are set to match a specific camera's frustum, but you can customize it. You can set the six culling planes manually and cull everything but a very specific part of the scene.
    C) By shader tag. In the DrawingSettings you can specify a LightMode tag and a shader pass.

    If you need something more specific than that, then I think you may have to set it up manually by maintaining your own list of renderers and rendering them manually with a command buffer in your render pass.