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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Change Default Post-Processing Stack Effects Order

Discussion in 'Image Effects' started by Retruate, Jun 22, 2019.

  1. Retruate

    Retruate

    Joined:
    Jul 5, 2014
    Posts:
    111
    Hello,

    I have been writing some custom effects for the post-processing stack for my game. The custom effects guide says that you can order your effects per post-processing layer, which I have done, and that built-in effects are ordered automatically. However, I want to be able to change the order of all the post-processing effects, so that one of my custom effects can be run before or in-between the built-in Unity effects. Surely this has to be pretty easy, but I can't find where Unity has opened it up to let you change the default order. I think I could accomplish what I want with CommandBuffers, but I'm not as familiar with the post-processing stack as I am with other parts of Unity so I don't want to mess with it and risk it breaking down the line.

    I suppose a workaround could be to copy Unity's effect(s) or write my own and use it as a custom effect instead of the default one, but that sounds horrendously unconventional.

    Apologies if this is something simple that I have just overlooked. Took me a while to find custom effect sorting even though it was just under my nose on the PP layer.

    Thanks!,
    John
     
  2. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    949
    Did you find a solution?
    I have also written a selective custom effect and I am wondering how to manipulate with its order.
    The custom effect template does not seem to provide an option to set an order variable, even with a limited options (BeforeStack, BeforeTransparent and AfterStack).
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using UnityEngine.Rendering.PostProcessing;
    4.  
    5. [Serializable]
    6. [PostProcess(typeof(GrayscaleRenderer), PostProcessEvent.AfterStack, "Custom/Grayscale")]
    7. public sealed class Grayscale : PostProcessEffectSettings
    8. {
    9.   [Range(0f, 1f), Tooltip("Grayscale effect intensity.")]
    10.    public FloatParameter blend = new FloatParameter { value = 0.5f };
    11. }
    12. public sealed class GrayscaleRenderer : PostProcessEffectRenderer<Grayscale>
    13. {
    14.    public override void Render(PostProcessRenderContext context)
    15.   {
    16.        var sheet = context.propertySheets.Get(Shader.Find("Hidden/Custom/Grayscale"));
    17.        sheet.properties.SetFloat("_Blend", settings.blend);
    18.        context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
    19.   }
    20. }
    This is the template from https://docs.unity3d.com/Packages/com.unity.postprocessing@3.0/manual/Writing-Custom-Effects.html
     
  3. elisetong95

    elisetong95

    Joined:
    Nov 30, 2021
    Posts:
    2
    Did any of you find a solution? Kind of curious what could be done to re-sort everything all together.
     
  4. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    855
    Have you tried shuffling the order of the effects on the volume component?
     
  5. a52

    a52

    Joined:
    Mar 15, 2018
    Posts:
    18
    This does not seem to do anything.