Search Unity

Question How to make custom post-processing effects with 2D Renderer Data.

Discussion in 'Universal Render Pipeline' started by VileGoo, May 21, 2020.

  1. VileGoo

    VileGoo

    Joined:
    Apr 29, 2017
    Posts:
    220
    Title says it all. I want to learn how to make my own custom post processing effects for my game which is using the 2D Renderer Data in URP. I've tried looking things up but I couldn't find anything for 2D Renderer Data specifically. I tried following this tutorial, but it did absolutely nothing for my game even after doing everything it showed.


    Seems like tutorials for writing your own post processing effects are insanely sparse, and I can't find anything that's recent. Even the official Unity Scripting API goes to dead links when I try finding things.
     
  2. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Same here
     
  3. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    49
    After much searching over the past year I finally found a solution for achieving full screen custom post processing with URP's 2D Renderer (that does not involve render textures), maybe this can help point you in the right direction:

    What ultimately allowed me to apply a full screen shader to the scene was camera stacking. Unfortunately as of URP-10.3.1 the 2D Renderer does not support Renderer Features (URP's Forward Renderer does support Renderer Features). Nor does the 2D Renderer support custom volume overrides (HDRP does support custom volume overrides). So what worked for me was to set my main camera (which is an orthographic camera) to have a render type of overlay, and to set my perspective camera to have a render type of base. The next, and crucial step was to set the main camera to use the forward renderer asset, while my perspective camera uses the 2D renderer asset (this provides the necessary support for 2D lighting). I could then add this blit renderer feature to the forward renderer asset, which in turn allowed me to select a material (in this case the shader I wanted applied to the entire screen) during the After Rendering render event.
     
    Olmi, ZachIsZef and DandecatLiang like this.
  4. DandecatLiang

    DandecatLiang

    Joined:
    Aug 22, 2017
    Posts:
    26
    Thanks a lot for the information and I think it will help to solve the problem in my projection.
    I'm currently using 2019 version of Unity to make a 2D game. And I use 2D light and some custom postprocessing effects. Due to the unsupporting of PPVE2 in Unity2020 and higher version, I cannot upgrade my project but only to wait urp 2d render to support custom render features.
    I create a simple project in Unity2021 adn test camera stack of combining forward render camera and 2d render camera and it seems work correctly. But what I do is a little different. I use 2d render camera as base camera and forward render camera as overlay camera(both are orthographic).
    Anyway I'm going to upgrade my project to 2021 or 2020, considering that the camera rendering in my 2d project is a little complex, it may still have some problems.

    I'm not a English speaker, hope you can understand what I say.
     
    zfh2773 and kayroice like this.