Search Unity

Question Custom Post Processing Volume.

Discussion in 'Universal Render Pipeline' started by FronkonGames, Dec 2, 2022.

  1. FronkonGames

    FronkonGames

    Joined:
    Feb 24, 2022
    Posts:
    16
    Hi, I have finished a custom post process for URP that works perfectly when added as a Renderer Feature, but I would like to make it usable using a 'Volume'.

    After creating something like this:

    Code (CSharp):
    1.  
    2. [Serializable, VolumeComponentMenuForRenderPipeline("Custom/TestEffectComponent", typeof(UniversalRenderPipeline))]
    3. public class TestEffectComponent : VolumeComponent, IPostProcessComponent
    4. {
    5.   // ...
    6.  
    7.   public bool IsActive() => true;
    8.   public bool IsTileCompatible() => true;
    9. }
    10.  
    It appears in the list to add in the Volume, but nothing happens. Do you know how I can add a custom
    ScriptableRendererFeature to a Volume?

    Thanks!
     
  2. superarhow

    superarhow

    Joined:
    Mar 24, 2015
    Posts:
    5
    Hello, it seems by now, the official way to implement a post process with integrated post process stack is just keep your renderer feature, and in the actual Execute function in your render pass, using the following syntax to access your VolumeComponent and to detect where if should to render, and get more parameters.
    Code (CSharp):
    1. VolumeManager.instance.stack.GetComponent<TestEffectComponent>();
    2. if (customEffect.IsActive())
    3. {
    4.     // Do actual render
    5. }
    6.  
     
  3. FronkonGames

    FronkonGames

    Joined:
    Feb 24, 2022
    Posts:
    16
    That's what I was afraid of. I would have liked to be able to use a 'VolumeComponent' (why is it public if there is no point in using it?) to make it easier to use an asset for a store that I am finishing. I'll have to wait.

    Thanks superhow.
     
  4. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    After unity 2021.3.15 i would be extra cautious to use instance in a renderer feature, it crashed Unity on build in some cases, e.g. when create instance of the feature to access its parameters
     
    superarhow likes this.
  5. FronkonGames

    FronkonGames

    Joined:
    Feb 24, 2022
    Posts:
    16
    superarhow likes this.