Search Unity

Disable Post Processing on shader generated via Amplify Shader Editor

Discussion in 'Shaders' started by rustofelees, Jul 10, 2019.

  1. rustofelees

    rustofelees

    Joined:
    Apr 22, 2013
    Posts:
    26
    I have a fragment shader that was generated using Amplify Shader. Objects that use this shader are currently affected by the Post Processing stack. Is there a change I can make to the shader so that the post processing stack is disabled for objects that utilize this shader
     
  2. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,546
    Post processing happens "post" rendering of scene objects, it's a screen-space process, not per-object, otherwise performance would be terrible.

    Depending on your needs for the rendered objects, you could try setting the render queue to 5000 on the material to see if the Overlay queue will happen after postprocessing, but I feel like it probably doesn't.

    The other option would be to render those specific objects after post processing has been done, or have them on their own layer that only a second child camera of the main cam that has no PP on it will render.
     
  3. rustofelees

    rustofelees

    Joined:
    Apr 22, 2013
    Posts:
    26
    Thanks for the reply Invertex. I tried setting the queue to be larger and can verify that doesn't work. Could you provide more info on how to render specific objects after post processing? Seems it might be my last option beyond using a second camera (which i would like to avoid if possible).
     
  4. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,546
    There isn't really another option I'm aware of short of making a post process script the renders a list of objects after all the other post processing has happened.

    Your simplest solution is just the secondary camera option. What kind of objects are you trying to avoid having post processing on? If it's just UI, a secondary camera is common for that and isn't as expensive as you might think it will be.
     
  5. rustofelees

    rustofelees

    Joined:
    Apr 22, 2013
    Posts:
    26
    It is in fact UI objects (mesh renderers) that I'm trying to render without post processing. It's possible to use a second camera, but I'm trying to avoid that route as the tools will be distributed to multiple teams who may or may not already have a second/third camera setup for such things. It would be more ideal to just have them work under the hood without having to determine which teams need the second camera.
     
  6. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,546
    Is there a reason they need to be mesh renderers? Could they not be sprite renderers with a custom sprite shape and then used in your canvas? As canvas rendered assets won't be affected by the post processing.
     
  7. rustofelees

    rustofelees

    Joined:
    Apr 22, 2013
    Posts:
    26
    in this case, they do need to be mesh renderers as most of them have dimensionality to them (they're more than just 2D sprites).
     
  8. spiritworld

    spiritworld

    Joined:
    Nov 26, 2014
    Posts:
    29
    Holy f- thank you! I was using Post processing outline effect and it didn't work well with shaders that modify vertex position causing effect where outline applied only on models original static pose and NOT in real time pose.

    Raising render queue from 2000 -> 3000 and outline is no longer rendered on that material.
     
  9. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,546
    There's a different solution for that issue. If those objects are using a shader that uses a Surface "surf" shader in it, then you just need to add
    addshadow
    to the
    #pragma surface
    line in the shader so your vertex program gets applied to depth/shadowcaster passes that outline effects read from. If it's a vert/frag shader, then you need to duplicate a default S
    HADOWCASTER
    pass to put in it and add your custom vertex deformation code to that pass's vertex program.