Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feature Request Use of renderingLayerMask by CustomPassUtils.DrawRenderers

Discussion in 'High Definition Render Pipeline' started by Kronnect, Dec 27, 2022.

  1. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,894
    Hi,

    It would be nice to have support for renderingLayerMask in CustomPassUtils.DrawRenderers for better geometry filtering when doing custom passes.

    Thanks!
     
  2. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    257
    Hello,

    Thanks for the feedback, we made the change and it'll be available in a future version of HDRP along with other improvements in the custom pass API
     
    nehvaleem and Kronnect like this.
  3. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    429
    wow! Can you elaborate? Is this somewhere on the roadmap? I would like to read more about it as filtering renderers in custom pass is really limited atm.
     
  4. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    257
    So, there is no additional filtering option for renderers, the maximum options you can have is by directly using the renderer list API: https://docs.unity3d.com/2022.2/Doc...riptableRenderContext.CreateRendererList.html (the equivalent of the old DrawRenderers() API)

    The API improvements focus on injecting custom passes in code without using gameobjects, so it's mainly for systems that want to customize the rendering without having to spawn custom pass volumes dynamically.

    This new API will be a set of static function in the CustomPassVolume class like so:

    Code (CSharp):
    1.         /// <summary>
    2.         /// Register a custom pass instance at a given injection point. This custom pass will be executed by every camera
    3.         /// with custom pass enabled in their frame settings.
    4.         /// </summary>
    5.         /// <param name="injectionPoint">The injection point where the custom pass will be executed.</param>
    6.         /// <param name="customPassInstance">The instance of the custom pass to execute. The same custom pass instance can be registered multiple times.</param>
    7.         /// <param name="priority">Define the execution order of the custom pass. Custom passes are executed from high to low priority.</param>
    8.         public static void RegisterGlobalCustomPass(CustomPassInjectionPoint injectionPoint, CustomPass customPassInstance, float priority = 0)
    9.  
    10.         /// <summary>
    11.         /// Remove a custom from the execution lists.
    12.         /// </summary>
    13.         /// <param name="customPassInstance">The custom pass instance to remove. If the custom pass instance exists at multiple injection points, they will all be removed.</param>
    14.         /// <returns>True if one or more custom passes were removed. False otherwise.</returns>
    15.         public static bool UnregisterGlobalCustomPass(CustomPass customPassInstance)
    16.  
    17.         /// <summary>
    18.         /// Gets all the custom passes registered at a specific injection point. This includes both enabled and disabled custom passes.
    19.         /// </summary>
    20.         /// <param name="injectionPoint">The injection point used to filer the resulting custom pass list.</param>
    21.         /// <returns>An enumerator that iterates over all the custom passes in the injection point provided in parameter.</returns>
    22.         public static IEnumerable<CustomPass> GetGlobalCustomPasses(CustomPassInjectionPoint injectionPoint)
    23.