Search Unity

Official New Post-processing Stack (Pre-Release)

Discussion in 'Image Effects' started by Chman, Oct 10, 2016.

  1. Deonity

    Deonity

    Joined:
    May 16, 2018
    Posts:
    3
    -Help/Reset Packages worked for me thanks =)
     
  2. io-games

    io-games

    Joined:
    Jun 2, 2016
    Posts:
    104
  3. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    I would love to write a custom effect that lives on PostProcessLayer and not PostProcessVolume. The effect needs to be specific per camera and blending in a 3D world makes no sense in my context.

    This is easy to achieve in the legacy rendering system. Just use Blit inside OnPostRender or on a CommandBuffer. But in the two provided SRPs, this seem impossible. In my case I need the effect for HDRP.

    Is there any known workaround for this?

    The only solution I can think of is to write an effect (as described in the Wiki) that has no settings. Then write a behavior that I put on the cameras that need the effect. Then in PostProcessEffectRenderer.Render, pick up the behavior (with settings) from the current camera (if any) and apply the effect. The problem is, 1) it's ugly and 2) there seem to be no way of cancelling the effect once inside Render(), I have to copy the source to the target to not loose the image, a waste of processing.
    EDIT2: After trying this, I realised that the method won't work because each PostProcessVolume only holds one sheet (PropertySheet) of settings per effect. So separate settings for each camera is not possible.

    EDIT1: Also ... I have been staring at PostProcessLayer.cs for a while without figuring out how effects are submitted for rendering in SRPs. My best guess is that HDRP and LWRP requests effects from PostProcessLayer on each camera. If that is the case, is there a way for custom MonoBehaviours with render commands to be picked up the same way?

    EDIT3: Found a workaround. Abandoned post processing. Rendered to a RenderTexture, used Canvas and made a custom MaskableGraphics object that applies the effect using a hidden material.
     
    Last edited: Oct 18, 2018
  4. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    31
    I cannot find information, does PP supported by Open GL 2? I'm asking because I want to use it on Android.
    If it is not supported, how can I exclude stack from Open GL 2 build, but include it in Open GL 3 build?
     
  5. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi i am getting HUGE spikes in a project which was first using the standard 3D pipeline and now it's switched to HDRP ( 4.1.0 ) and Unity 2018.3 b6... Also using 2.0.16 of the post processing

    I noticed all the time when i get the spikes it is related to RenderTexture.SetActive method like in the image.
    I was getting this with the AO when was using the standard 3D pipeline and not am getting this for the bloom effect.

    upload_2018-10-24_17-8-32.png
     
    Last edited: Nov 5, 2018
  6. Sentionaut

    Sentionaut

    Joined:
    Apr 27, 2015
    Posts:
    10
    Hi @Chman

    On April last year you mentioned that sunshafts were going to come eventually, and I just wanted to ask how is it going.
    Right now in our project (which will come out in just a few months) we're using the post-processing stack v2, and the performance boost and stability is noticeably better than using different scripts (certain platforms don't crash due to graphic memory overload anymore, hooray!). However, sunshafts are also an integral part of our art, and we're still stuck on the old script, which might be dragging the game's performance too much...
    Is this coming soon?

    Thanks!
     
  7. ElsaMengJ

    ElsaMengJ

    Joined:
    Aug 22, 2018
    Posts:
    2
    I have the same problem,so how do you fix it?I donnot want to quit the post process, but the arkit camera jittered so heavily.
     
  8. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
  9. ElsaMengJ

    ElsaMengJ

    Joined:
    Aug 22, 2018
    Posts:
    2
  10. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    Intro: Hello, I'm looking for a way to limit the screen area that a post effect is applied to.

    Considerations: The areas that I am masking are irregularly shaped, so a stencil mask would be useful.

    Problem I'm solving: My game draws multiple worlds to the screen at the same time. Each has unique lighting and colour requirements. It looks like this: https://twitter.com/LRGthunder/status/1058044420740861952
    As the worlds are drawn, I accumulate them in the final image. Currently, post effects are applied to the whole render and the desired section is copied out. This is slow. I'd rather accumulate my final image in a single target texture if possible, or at least save some time by ignoring areas that will never be show in the final render.

    Additional info: I'm currently in the process of re-lighting a bunch of scenes so I have the option of using the old stack or the new stack.

    Update1: I have also considered using oblique frustums (so that I can maintain perspective while rendering to smaller textures) and then composite them into a larger image. Unfortunately, I've found that many of the post effects do not play nicely with oblique frustums. Also, since the camera can zoom/move freely, this would require special texture management selecting the correct resolution based on world size.
     
    Last edited: Nov 12, 2018
  11. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
  12. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    @Chman I noticed that you've been working on HDRP's postfx branch, I'm curious what's the plan for this branch? Will the HDRP's upcoming PP remove ability to use PP stack v2 completely in the future?

    I merged postfx branch into latest SRP master and tried it on 2019.1.0a10 and did notice that regular pp stack didn't do anything anymore, even AA was moved to Camera. So this worries me a bit.

    Basically right now, asset providers are moving their PP stuff to be PP Stack v2 compatible so they can be used in SRPs but with this upcoming change, that will be short lived joy if HDRP's PP will not be compatible with these custom effects?

    Additionally, I noticed that postfx branch currently only supports FXAA and TAA, is SMAA still coming or will it be left behind? And will the HDRP's TAA be same as on PP stack v2 or will it have further improvements?
     
  13. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    Hi, I recent want to use the new post-processing framework, and add some my own shader. But I can not find an easy way to merge my effect into the uerb shader. And I can not write my own uerb shader in an easy way.
    Right now I write all my post-processing into one renderer, in order to use my own uerb shader. I don't think this is a right way to do this.
     
  14. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    872
    I have an issue where the post processing is disabled in the build, this is after changing build targets to windows as other builds did not do this.
     
  15. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi.
    For 2019.1 HDRP fully drop support of PPV2 and replace it by builtin postprocess(named PPV3) that is compliant with HDRP memory manager and other effects.
    There is a lot of change, visually and on parametrization side . No migration facility will be provided. All postprocess will need to be re-authored.

    SMAA have never been supported with HDRP (but we weren't able to hide it - but doesn't mean it was not doing something). So no SMAA for HDRP.
     
  16. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Is deferred fog included and does it actually work unlike v2's? =D
    would be nice not to have to go 3rd party, but we get zero response to problems here and on the git.
     
  17. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    Would be nice to get some sort of support on PPV2, 2019.x is probably a long time away from being production ready, and dropping support (if you count the number of issues on Github without a response it is getting worse and worse) for PPV2 is not optimal for providing a usable stack nowadays.
     
  18. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Afaik SRPs will keep using PP stack v2 for Unity 2018.x releases. @SebLagarde can probably confirm if there are any plans to backport PPv3 to 2018.3 / 2018.4 LTS in the future but I'd seriously doubt they'd do that at this point anymore. From the messages I've read, it seems like PPv3 is going to be a thing only from 2019.1 onwards.
     
  19. Kronnect

    Kronnect

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

    Unity 2018.3f1 is out and while checking some effects I noticed that the inclusion:

    Code (CSharp):
    1. #include "PostProcessing/Shaders/StdLib.hlsl"
    no longer works. It's now:

    Code (CSharp):
    1. #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"
    Is this correct? And is this change documented anywhere?

    Thank you.
     
  20. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Looks correct. They changed the shader inclusions to support "Packages" prefix on some late SRPs. In past this was a real issue since back then you couldn't before even put "full" paths while using packages, only relational paths worked.

    I don't know about docs but the idea is that you can now use "Packages/<package name without @versiontag>/<path inside package>" for shader inclusions without issues (like you already could with c# code).
     
  21. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    More info about it please?
     
  22. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,904
    Well, problem is that the new include path doesn't work with Unity 2018.1/2018.2 and #include directives cannot be used along UNITY_VERSION macro so that change forces either to have a custom script that modifies the include line or use two different packages... definitely not a friend of such small changes that break everything without notice.
     
  23. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    If you need to keep it compatible, keep using relative paths, they still work on all.

    You can find example of relative paths here https://github.com/0lento/Alloy/commit/67ebf5e5bbf5b1607b03bd37dafd0b6c37d8c306, just look some shader file from it, most of them needed removal for the Assets -path and moving these to relative paths. This was the only way to do it for 2018.1 and 2018.2 (that package should load fine on 2018.3 at least for those includes).
     
    Last edited: Dec 10, 2018
  24. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,904
    Relative paths may work within the same asset structure but unfortunately has nothing to do in this case. I just need to include the StdLib.hlsl file of Post Processing Stack from one of my packages. This package can be located anywhere in the project but definitely outside of the Packages internal Unity path because that's a private storage area. So the issue remains because in Unity 2013.3 (it worked in 2013.1-2) the usual include path "PostProcessing/Shaders/StdLib.hlsl" no longer works - I guess they stopped adding PPS path to the compiler path list so now it's required to use the fully-qualified path.
     
  25. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,904
    Should you update this paragraph to add a warn regarding HDRP since it's in flux ?

    "This framework allows you to write custom post-processing effects and plug them to the stack without having to modify the codebase. Of course, all effects written against the framework will work out-of-the-box with volume blending, and unless you need loop-dependent features they'll also automatically work with upcoming Scriptable Render Pipelines!"
     
  26. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Not really happy on losing SMAA, it really used to be great compromise for PP AA. Is there any chance you guys could still include it on PPv3?

    Worth noting that while SMAA wasn't officially supported in HDRP, it seems to work surprisingly well with it (it definitely works on my HDRP test scenes using HDRP 5.2.3 and PP 2.1.2). I ask about this because TAA doesn't work well in fast motion at all and FXAA mainly blurs things. I'd prefer MSAA for everything but atm HDRP doesn't support SSR with it (is this planned to change in the future?).
     
  27. BabouDev

    BabouDev

    Joined:
    Feb 3, 2015
    Posts:
    12
    I'm relatively new here and I've tried searching everywhere but it always ends up being a dead end.
    I'm trying to create post-process effects for a 2D game, where the background is blurred (it has to be runtime because objects are moving otherwise I have easier options).

    My first attempt is to apply a material OnRenderImage and that works fine. However I upgraded to LWRP and it no longer calls that function. I then figured I could use PPV2 to do it.

    So I made two seperate cameras, one that renders the background and then I intend to apply the post process effects on it and then render the foreground. Again, this doesn't work. Because LWRP doesn't support multiple cameras (works great without LWRP). Will LWRP eventually support multiple cameras or is there a specific way of doings things here? Can anyone give me a heads up on what to look up for to have more control over the render pipeline?

    I could apply a blur shader on each of the objects using shader graph but I want the entire background to blend. Is there another way of doings things are are efficient and supported by the latest PP and LWRP stack?

    TLDR : How to apply PP effects to individual render scenes or layers before the final rendered image in LWRP?
     
    Last edited: Dec 21, 2018
    Shorely likes this.
  28. I would put something between the background and the foreground and would give it a special shader. Something like this. Now, of course, you can tweak the shader properly to look like somewhat blurry instead of liquid, but that's another story.
     
  29. ifurkend

    ifurkend

    Joined:
    Sep 4, 2012
    Posts:
    350
    When I try to do something like cmd.SetGlobalTexture(ShaderIDs.SourceTex, context.source); I receive these errors and cannot proceed whatsoever:

    • error CS0122: `UnityEngine.Rendering.PostProcessing.ShaderIDs' is inaccessible due to its protection level
    • error CS0117: UnityEngine.Rendering.PostProcessing.ShaderIDs' does not contain a definition forSourceTex'
    I need to blend context.source with my already processed render texture in a pass. Is there any way around?
    Can you clarify if Unity will continue to support PPV2 for LWRP? The lack of troubleshooting and API does give me the impression that you guys are mentally dropping it completely.
     
  30. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, i am a bit confused. As i understand there should be another "PPv3" specificly designed for HDRP, and that PPv2 is dropper for 2019.x and HDRP. Where to find it !?
    I am using currently PPv2 in 2018.3f2 for a project which may get ported to 2019.1 at some point.
    What is the current situation with all these post processing stack things. Where to find the proper one for using with HDRP or should i be still using PPv2 ?

    Thanks !
     
  31. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I can't tell about the longer term changes but as user who's gone through a lot of SRP changes and followed the discussion, I can tell this for the very near future for sure:

    For the time being at least PPv3 is HDRP only thing and it already fully replaces PPv2 on latest HDRP master branch on SRP repo (which is Unity WIP branch for bigger HDRP changes they are working with now). This PPv3 fully embedded to the SRP and works more closely to renderer on the implementation (afaik also utilizing gpu compute capabilities of the system), no separate PP package needed for it and old PPv2 package doesn't even work with future 2019.1 HDRP versions. Also worth noting that in PPv3 settings have moved from PP volume to Scene volume which is specific thing to HDRP as well.

    Afaik, PPv2 will remain to work on LWRP (and standard renderer) as is at least for upcoming 2019.1 and probably for a long time as there's really no direct replacement for it for the time being. Unity hasn't communicated about LWRP PP changes on their roadmap talks either, only about HDRP.

    I also don't know why Unity calls the new HDRP PP as PPv3 as it seems really specific to HDRP alone and it doesn't look like a thing Unity would bring to LWRP but would love to hear a staff comment on this one.
     
    Kronnect and mcroswell like this.
  32. itsnottme

    itsnottme

    Joined:
    Mar 8, 2017
    Posts:
    129
    Hey, I am getting visual issue on an Ocean Shader I bought. After some testing I found that the issue is from temporal anti-aliasing, especially jitter spread.
    Anyone knows what could be the problem? I contacted the asset creator and he doesn't know.
     

    Attached Files:

    • 4.gif
      4.gif
      File size:
      937.4 KB
      Views:
      913
    • 5.gif
      5.gif
      File size:
      1 MB
      Views:
      928
    • 4.gif
      4.gif
      File size:
      937.4 KB
      Views:
      870
    • 5.gif
      5.gif
      File size:
      1 MB
      Views:
      892
  33. mishakozlov74

    mishakozlov74

    Joined:
    Aug 8, 2018
    Posts:
    143
    Guys, I've got two questions, please.

    1. Is it possible to get initial source texture right from Camera?
    I want to mask post-effect with texture, so in shader I need to return whether initial value or affected based on condition.

    2. What's wrong with custom effects?
    They disappear after Editor's restart and don't save in Stack. And they don't apply in build as well.
    https://github.com/Unity-Technologies/PostProcessing/issues/618

    UPD:
    I've figured out that we have to avoid "Effect" in our classes name, so instead of "MaskEffect" I had to name my class simple "Mask"
     
    Last edited: Jan 30, 2019
  34. bigbrainz

    bigbrainz

    Joined:
    Jul 21, 2015
    Posts:
    177
    Post-Processing 2 is adding a .25MB file to my build: Packages/com.unity.postprocessing/PostProcessing/Textures/SMAA/AreaTex.tga

    We really need to keep our build size down. Is there a way to get rid of this or crunch it?

    Similar question for all the other Post-Processing Textures it's including in the build that aren't compressed.
     
  35. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Is there any way to migrate a PostProcessing V1 PostProcessingProfile to V2, other than completely re-authoring the asset by hand?

    (Specifically there's one of Synty's Renderbox profiles from the assetstore that I'd like to bring over.)
     
  36. DTek

    DTek

    Joined:
    May 29, 2013
    Posts:
    15
    Hello and thanks for this !
    I'm trying to achieve a regular DoF effect, however, my camera is quite far away from the object, and the DoF doesn't apply on the objects nearby, although they are at a certain difference from the main target object ( a car ). What could I do to improve this ?
     
  37. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    This worked on Macs a few months ago, but now -- when I have TAA enabled, the screen is black, and this error appears in the console. This is in builds only, works fine in the editor. I wonder if one of the PPSv2 updates in the past few months introduced this problem -- anyone know?

    WARNING: Shader Unsupported: 'Hidden/PostProcessing/TemporalAntialiasing' - Pass '' has no vertex shader
    ERROR: Shader Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)WARNING: Shader Unsupported: 'Hidden/PostProcessing/TemporalAntialiasing' - Setting to default shader.

    EDIT: Ah, it looks like this known issue: https://forum.unity.com/threads/shaderincludepath-is-deprecated-what-to-use-instead.573910/
     
    Last edited: Mar 25, 2019
  38. DaveL99

    DaveL99

    Joined:
    Jul 5, 2018
    Posts:
    22
    I'm posting in the hope that something has secretly changed since the above quote, and also since this issue was closed ( https://github.com/Unity-Technologies/PostProcessing/issues/320 ), and that somehow it is now possible to disable final-pass dithering in an easy way that is also friendly towards future package downloads and collaborative development (i.e. not hacking the .hlsl file that's installed in the PackageCache folder...).

    I am trying to output per-pixel distance-from-camera encoded in a regular 4-channel 32bpp .TGA image file, which is all working great apart from the dithering is completely ruining it by adding unwanted and very-significant noise. I would love to be able to disable it somehow. Any suggestions?

    EDIT: On top of that, it also appears that regardless of my camera.targetTexture format, my post-process shader is always outputting to a RGBAHalf render buffer. That is also a bit of a problem...
     
    Last edited: Apr 5, 2019
  39. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    TAA doesn't seem to work on Macs (10.13 and 10.14 at least) -- the screen is black (except for GUI) when TAA is enabled in a build. Is this a known issue? Likely to be fixed?
     
  40. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,904
    Latest versions of PPS v2 come with the option "Directly To Camera Target" enabled by default which basically disables any other image effect on the camera in a non-obvious way which is causing many users to scratch their heads upon upgrading to 2019.1.
    Could this type of options come disabled by default if they're going to break existing configurations?
     
    GoGoGadget and nokijami like this.
  41. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    2.1.6 and 2019.1 produce unable to find shader errors and command buffer errors and black screens at runtime.

    And the github repo, you guys need to keep up on that open source projects do better then Unity does on monitoring and responding to bug reports.
     
    Kronnect likes this.
  42. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,904
    Custom image effects fail to load in build in 2019.1/LWRP. Case 1146719.
     
  43. nokijami

    nokijami

    Joined:
    Apr 4, 2019
    Posts:
    1
    I'm scratching my head with this one. I'm simply trying to have Ambient Occulusion on since upgrading from 2018.x to 2019.1, and if I run AO on 2019.1 with "directly to camera" set to false, the AO layer will (in VR) be overlayed in view like a plastic wrapper :(. Updated PPv2 to 2.1.6.


    Seems to have something to do with this:


    #if UNITY_2019_1_OR_NEWER //#if UNITY_2019_1_OR_NEWER
    // We always use a CommandBuffer to blit to the final render target
    // OnRenderImage is used only to avoid the automatic blit from the RenderTexture of Camera.forceIntoRenderTexture to the actual target
    [ImageEffectUsesCommandBuffer]
    void OnRenderImage(RenderTexture src, RenderTexture dst)
    {
    if (finalBlitToCameraTarget)
    RenderTexture.active = dst; // silence warning
    else
    Graphics.Blit(src, dst);
    }
    #endif
     
  44. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,904
    That OnRenderImage piece of code seems quite hacky.
     
  45. DaveL99

    DaveL99

    Joined:
    Jul 5, 2018
    Posts:
    22
    In case this is useful for anyone else, I found a workaround that doesn't involve locally hacking files in the installed package:
    - Find the "FinalPass" shader and duplicate it into your project's own Assets hierarchy somewhere. Edit it and remove the line that adds the "Dither".
    - In your post-processing C# script, it is possible to swap in your own shader in place of the built-in one:

    Code (CSharp):
    1.   public override void Render (PostProcessRenderContext context)
    2.   {
    3.     context.resources.shaders.finalPass = myFinalPassShader;
    4.  
     
  46. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    @SebLagarde Speaking as a post-processing asset developer, concerned about this comment:

    Will this change apply to LWRP and eventually break every third party asset when Unity decides it should? Or is it limited to HDRP only (which is totally fine in my opinion, as HDRP is in beta still, changes are to be expected). I would assume commonsense dictates that Unity aren't going to again break everything in LWRP after the API is finally nice to work with and stable, but given recent history, I feel the need to check these things :)

    Thanks,
     
  47. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,904
    Well, got a response from QA and this parameter will be disabled by default in future updates. Nice move Unity :)
     
    Stardog, hopeful and GoGoGadget like this.
  48. kinderpoke

    kinderpoke

    Joined:
    Apr 7, 2019
    Posts:
    13
    Sup, atm when I am starting the game the posprocessing simply do not appears, what can cause the problem?
     
  49. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Hey I'm looking at the PPS performance in the profiler and I can see about 0.5ms spent on refreshing command buffers. It seems to fetch and refresh all the fx parameters, which is cool but man, doing that every frame when they hardly ever change (in my context, they never do actually) seems like a waste of resource. I tried to add a refresh flag to the code, to only trigger this parameter refresh if needed and everything seemed to work fine. (I'm basically just bypassing PostProcessLayer.BuildCommandBuffers)

    So here is my question: is there any reason why this is all processed every frame, other than "in case someone changed a parameter in code or there needs to be blending between volumes..." ? From a design standpoint this looks a bit odd to me that all these parameter fetching would happen no matter what. Half a millisecond may not seem a lot, but as far as I can tell this part impacts the whole render time and is not run in parallel, so it's worth saving, especially in VR.
     
  50. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Is there a way to exclude certain layers from PPSv2 effects? (I have TAA set nicely for everything, except falling snowflakes get blurred in an ugly way)