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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Official way to do custom post-processing with URP?

Discussion in 'Universal Render Pipeline' started by andybak, Sep 30, 2019.

  1. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    558
    Now HDRP officially supports custom post-processing effects - what's the plan for URP?

    Are custom renderers capable of doing this? If so - are there any guides as I'm not sure where to start?

    If not - what's the plan?
     
  2. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,426
    Where did you get the information that the latest 2019.3 HDRP has official custom post processing method? Afaik, there is still no official way to do that yet? Or have I missed on some news?
     
  3. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    558
    https://docs.unity3d.com/Packages/c....high-definition@7.1/changelog/CHANGELOG.html

    "Added Custom Post Processes with 3 injection points: Before Transparent, Before Post Process and After Post Process"

    I did a quick test here to confirm it was working: https://github.com/IxxyXR/HDRP-Custom-Post-Processing-Test
     
  4. superjayman

    superjayman

    Joined:
    May 31, 2013
    Posts:
    185
    Unity can you please clarify the official steps to do custom post effects? What on earth is going on?
     
    AlejUb and StartleDan like this.
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,113
    Last edited: Oct 8, 2019
  6. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,260
    It will come to URP too
     
  7. StartleDan

    StartleDan

    Joined:
    Apr 10, 2017
    Posts:
    11
    How do you know it will come to URP, and when?. Is this on a roadmap anywhere? I really need custom post processing on mobile VR, and at the moment I can't find a way to do that in Unity.
     
    Fi711 and AlejUb like this.
  8. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    778
    You should periodically check the branches and commits on the scriptable render pipeline GitHub if you’re in a rush. Could pop up there any day. Or it could be in a year. Who knows?
     
    StartleDan likes this.
  9. AlejUb

    AlejUb

    Joined:
    Mar 11, 2019
    Posts:
    25
    A bit confused over here too. The message seemed to point to the fact that URP is the new face LWRP and continue on it, but there seems to be an actual rewrite going on, I'm having a bunch of classes and extensions for QoL that I can't really find how to fix...
    what happened to PropertySheet, ParameterOverride's, etc? Are they not available (or will-be-changed) for the time being?
     
  10. unityuserunity85496

    unityuserunity85496

    Joined:
    Jan 9, 2019
    Posts:
    89
    After reading the above is it proper to say I should change my project back to standard mobile shaders and the post processing effects stack and or Blit effects if I want to do custom screen effects render passes for mobile devices?
     
    AlejUb likes this.
  11. AlejUb

    AlejUb

    Joined:
    Mar 11, 2019
    Posts:
    25
    For all things mobile where you have control of what to use, I would strongly suggest using Legacy Built-In pipeline... I'm stuck on it and have no leverage on deciding what to use.

    Can you point us to that GitHub?
    I don't fully get how URP works... can I choose LWRP and Post Processing Stack v2 on 2019.3? it's installed, but I just can't use it. The camera has changed completely and has post processing deeply embedded in it, seems to not accept Post Processing Volumes, just "Volumes" (the new ones).
    There are many things with less features and/or broken, for example, Post Processing doesn't respect the alpha channel anymore no matter what, so rendering 3D with post processing and then UI with fewer ones (say, only bloom) makes it impossible to mix them together afterwards because the alpha channel will be forced to full-on even if it is told to clear to a fully transparent color.
     
  12. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    778
    @AlejUb https://github.com/Unity-Technologies/ScriptableRenderPipeline

    If you're on 2019.3 you can either use URP or PostProcessing but not both. Ditch LWRP, it's not needed. URP replaces it. URP has its own version of PostProcessing but it's missing some important features. Unless you're starting a new project and aren't in any great rush for things such ambient occlusion then stick with the standard pipeline.
     
  13. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Wait, with custom render pass you can perform something very similar to old post process (in terms of results). It's just that the way to do pp is quite different than before, and it's only per command buffer.
    Inside of this project: https://github.com/Unity-Technologies/UniversalRenderingExamples
    you will find a Blit custom render pass, which is basically what any standard post process does.
     
  14. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    558
    I've suspected this to be the case but the lack of any official docs, comment or any examples from Unity has made it fairly unclear. The examples they do provide are quite specialist and the only comments have been "custom PP is not supported in URP" so it's not surprising that people have taken that statement at face value.
     
    transat and cAyouMontreal like this.
  15. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    I totally agree! If I wasn't forced to support old pp for our project (recently converted in URP) I wouldn't have bothered. And it took me 2 days to convert a simple motion blur pp...
     
  16. unityuserunity85496

    unityuserunity85496

    Joined:
    Jan 9, 2019
    Posts:
    89
    I gave up after getting builds working with the new pipelines. Nothing is stable or well documented and its more complex then it needs to be. So im back to learning the previous system cause it most resembles other systems in gl I have worked with with the Custom Buffers, but I still need to figure out its workflow still
     
  17. PuzzledBoy

    PuzzledBoy

    Joined:
    Sep 9, 2014
    Posts:
    23

    Attached Files:

    Skjalg and mbussidk like this.
  18. PuzzledBoy

    PuzzledBoy

    Joined:
    Sep 9, 2014
    Posts:
    23
  19. unityuserunity85496

    unityuserunity85496

    Joined:
    Jan 9, 2019
    Posts:
    89
    neat but looks like the deprecate the same year. NOT promising
     
  20. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    There is this post which has some additonal info:https://forum.unity.com/threads/post-processing-and-urp-the-plan.795456/page-3#post-5466441

    Our plan is the same as it has been which is to provide a nice template for custom post using the render feature/pass system. There is some work to be done before we are happy with saying 'This is how it is done' as there is a lack of a RT 'ping-pong' system, which is needed for perfomance.
    We are also needing to add some more capabilities to the render pass system to allow passes to request data and if not available, generate it(this will be for things like depth, normals, color copy, etc), another feature missing is additional injection points so that if you are simply wanting to blit a shader over the screen after PPv3's DOF and before it's colour-grading then it is possible.

    HDRP went down a different path becasue at an archetecture level they did not have a modular rendering system, which meant it was simpler for them to just copy the old system, but this is limiting once you get outside the realms of classic post processing.

    As for an estamate, I cannot give one, right this minute we are not working on custom postprocessing but we are working on features to help better support making it easier later(the things I mentioned earlier), and interms of being able to do custom post processing, it is entirely possible to do now, and poeple have been doing it and making some cool stuff, the information to do it just isnt documented and finding examples can be hard.
    We plan to have a simple sample shipped with the package in 7.4.0, it just missed 7.3.0 this week.

    This is very much close to what we will be doing, and right now this paried with a VolumeComponent script will be rthe same as the builtin URP PPv3

    PPv2 is only going in for the reason to provide custom PP now, like this instant, it was never intended to be part of URP and was designed for the Builtin renderer. We will depricate it and it will no longer be supported, but it will live in URP 19LTS for 2 years, we are hoping well before then that we have the work done to suppliment creating custom effects in URP.

    These are part of the old PPv2 (which now you can still use if you choose to) but the PPv2 was reimagined as the Volume system, this is a much better and generic system that can be used for much more than post processing, it's an intergral part of SRP and URP PPv3 uses it, HDRP uses it heavily for everything from lighting to skyboxes.
     
  21. unityuserunity85496

    unityuserunity85496

    Joined:
    Jan 9, 2019
    Posts:
    89
    SRP URP PPv3 HDRP PPv2
    Ya dont say
     
  22. kkrg001

    kkrg001

    Joined:
    Mar 6, 2019
    Posts:
    35
    Is custom post-processing officially supported?
    I may have overlooked some information, but I would like to know the progress.
     
    Minchuilla likes this.
  23. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,492
    I have to say that it's indeed not clear, but my current understanding is that custom pp can be done with RenderFeature implementation. Don't quote me. I will try to do something in the next few days.
     
  24. ZerinLabs

    ZerinLabs

    Joined:
    Mar 8, 2019
    Posts:
    31
    I've been able to create some custom URP post process on 2019.3 adding some render features
    ...but the very same code and system it's not working on unity 2020.1.6

    Quite annoying I must say...
     
    Andrewski0117 likes this.
  25. DawidMoza

    DawidMoza

    Joined:
    Nov 24, 2016
    Posts:
    216
    Still no official way?
     
  26. Deleted User

    Deleted User

    Guest

    It has been 'in progress' for months :(
     
  27. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,747
  28. Deleted User

    Deleted User

    Guest

    kayroice likes this.
  29. Gasimo

    Gasimo

    Joined:
    Mar 3, 2015
    Posts:
    33
    petey, DawidMoza and NotaNaN like this.
  30. DawidMoza

    DawidMoza

    Joined:
    Nov 24, 2016
    Posts:
    216
  31. Steven-1

    Steven-1

    Joined:
    Sep 11, 2010
    Posts:
    443
    I've never used URP, but I want to make my older custom post effects work in URP. According to what I read here that's no easy task.
    Is there still no official way to have custom post effects in URP, or has this been changed?
     
    kayroice likes this.
  32. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    596
    bump, is there a way to make custom VolumeComponents yet?
     
    kayroice likes this.
  33. ZerinLabs

    ZerinLabs

    Joined:
    Mar 8, 2019
    Posts:
    31
    Probably you could do it via scripting but as far as I know, no easy way to do it "by default".

    On my side still begging for postfx shader-graph support... :/
     
  34. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    1,900
    This has always been possible, but was simply never documented. The volume system comes from the "Core SRP" package and is merely a way to store and blend settings. It can technically be used for more than just post effects.

    A barebones component could look like:
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using UnityEngine.Rendering;
    4. using UnityEngine.Rendering.Universal;
    5.  
    6. [Serializable, VolumeComponentMenu("MySettings/Fog")]
    7. public sealed class FogSettings : VolumeComponent, IPostProcessComponent
    8. {  
    9.     public ClampedFloatParameter globalDensity = new ClampedFloatParameter(0f,0f,1f);
    10.  
    11.     //Can be used to skip rendering if false
    12.     public bool IsActive() => active && globalDensity.value > 0f;
    13.  
    14.     public bool IsTileCompatible() => false;
    15. }
    In any other script (such as a ScriptableRenderPass) you can retrieve the settings of a volume component as they are after all the volume blending is performed:
    Code (CSharp):
    1. FogSettings settings = VolumeManager.instance.stack.GetComponent<FogSettings>();
    2. //Doing something with it
    3. Shader.SetGlobalFloat("FogDensity", settings.globalDensity.value);
    This is also how it works for any of Unity's default effects: https://github.com/Unity-Technologi...versal/Runtime/Passes/PostProcessPass.cs#L286
     
    gmgannon, lilacsky824, noio and 3 others like this.
  35. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    596
    Oh man, thank you so much for this writeup. I was digging into it last night and saw the blending stuff and just could not find where they were actually doing the rendering haha. This is great, now I have a way forward. Thank you!
     
    StaggartCreations likes this.
  36. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    200
    I feel stupid, but even with this very minimal example, I only get the default (un-overridden) value when I print
    settings.globalDensity.value
    from
    Update()
    (value = 0). When I write an EditorWindow script to print the value outside of Play Mode, I do see the actual value set through the stack.

    Am I missing something? Is VolumeManager.instance.stack not returning the right reference during Play Mode?


    EDIT: Found the cause of my issue. I'm using a stack with 2 camera's. The 2nd (top) camera did not have PostFX applied, so the stack is in a reset state when you check values in Update(). There are other points in the frame where the stack has the proper state (e.g. in OnDrawGizmos), but I have to figure out where to hook into (maybe
    beginCameraRendering
    ) to get the state with overrides applied.
     
    Last edited: May 9, 2022
  37. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    596
    If you make a RenderFeature/RenderPass, the state is correct in there. It's where I'm using it.
     
  38. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    200
    Ah, yeah! That makes sense.

    But what if I'm trying to use the Volume stack for more general things, like setting the Environment/Ambient light colors.. It seems weird to do that in a RenderPass since it doesn't actually 'render' anything? (Does that even work? I'd have to enqueue it before any other rendering passes so the colors apply correctly?)

    FSTnh9gWUAEzAaA.png
     
  39. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    596
    Try setting the renderpass to render "before rendering"
     
  40. MarekRutkowski

    MarekRutkowski

    Joined:
    Apr 10, 2021
    Posts:
    3
    Hey, some progress on the topic. Because an awful lot of time has passed and nothing. This is one of the highly anticipated issues - we just don't spam the topic here and wait patiently. Please don't assume that the topic is dead because I check every version when it will finally be covered.
     
  41. MarekRutkowski

    MarekRutkowski

    Joined:
    Apr 10, 2021
    Posts:
    3
    With all due respect to the work of the rest of the creators, but for us programmers, the render feature is a solution. Not so for artists. Of course, we have working solutions - the problem is that the rest of the team is afraid to touch it, which makes it difficult for us to work. Regards.