Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feature Request Use of renderingLayerMask by CustomPassUtils.DrawRenderers

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

  1. Kronnect


    Nov 16, 2014

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

  2. antoinel_unity


    Unity Technologies

    Jan 7, 2019

    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


    Dec 13, 2012
    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


    Unity Technologies

    Jan 7, 2019
    So, there is no additional filtering option for renderers, the maximum options you can have is by directly using the renderer list API: (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)
    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)
    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)