Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

URP 2D Renderer custom feature

Discussion in 'Universal Render Pipeline' started by Erdroy, Nov 17, 2019.

  1. Erdroy

    Erdroy

    Joined:
    Jan 12, 2013
    Posts:
    19
    Hi!

    I am looking for an option to add custom pass (Custom Renderer Feature) to a 2D Renderer.
    Currently there are functions like EnqueuePass etc., but there is no way, to do it in the correct order
    (as 2D Renderer doesn't have any callbacks).

    With the Forward Renderer, we have the feature list, but with the 2D Renderer there is nothing like that.
    So, my question is - how to use Custom Renderer Feature with 2D Renderer?
     
    organick likes this.
  2. Erdroy

    Erdroy

    Joined:
    Jan 12, 2013
    Posts:
    19
    So, basically there is no way to use scriptable render pass in 2D renderer.
    I've implemented this by myself, and it works just like URP custom render features. It was just like 5 lines of code.
    You can find my SRP fork here https://github.com/Erdroy/ScriptableRenderPipeline
    Also PR went live right now, and it's waiting for approval.
     
  3. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    Hi! Thanks for creating this PR!

    The reason why we haven't added custom render feature support to the 2D Renderer is we want our users' feedback to focus on the 2D lighting system itself, as it's still experimental. After we get the 2D Renderer ready for production, we'll then allow user customization.
     
    HuldaGnodima and berkza like this.
  4. rboerdijk

    rboerdijk

    Joined:
    Aug 4, 2018
    Posts:
    96
    Any chance this changes soon? Also where can we read up on the timeline/development of the 2D renderer (getting it out of the experimental status)?
     
    Last edited: Apr 23, 2020
    Tyrameia and CDF like this.
  5. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,329
    Would love an update on this too. Currently wanting to make an underwater effect using a GrabPass. Need renderer feature do to that though :(
     
  6. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,915
    This capability is becoming more and more requested as render features are showing very useful in URP (for instance to make full-screen custom effects). Is there any update on this? /cc @yuanxing_cai
     
    Storm4_ and Tyrameia like this.
  7. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    Our sole focus right now for the 2D Renderer is performance, especially mobile performance. This is of paramount importance for us to be production ready. That's why everything else needs to take a back seat at the moment.
     
    rboerdijk likes this.
  8. joan_stark

    joan_stark

    Joined:
    Jul 24, 2018
    Posts:
    58
    Any news since may on this topic?
     
    Tyrameia, Cardinal90 and organick like this.
  9. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    The work on this has officially started.
     
    berkza, NotaNaN, Erdroy and 4 others like this.
  10. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,329
    tenor (7).gif
     
    NotaNaN, Erdroy and Tyrameia like this.
  11. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,329
    Any chance this might make into urp 11?
     
    NotaNaN and kayroice like this.
  12. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    51
    @yuanxing_cai or @Chris_Chu, can either of you give an update as to when either Custom Volume Overrides or Custom Renderer Features will be available in URP's 2D Renderer? I'm using URP-10.3.1 (Unity 2020.2.5f1) and need some way to apply a full screen custom post processing effect when using URP and the 2D Renderer (not the Forward Renderer) that doesn't rely on render textures. Thanks.
     
    MarsCode113 likes this.
  13. Ragueel

    Ragueel

    Joined:
    Jun 2, 2018
    Posts:
    39
    Hey, what is the current state of custom renderer features? I am currently developing a lot of stuff by myself with render textures, but I wonder if I should wait a bit. I also found this GitHub link that adds renderer features to the 2D renderer if anybody is interested. I really liked how it all works in the HDRP and expect it to be similar.

    https://github.com/InitialPrefabs/UGUIDots/issues/44

    I also don't see any updates on the roadmap page for the URP.

    https://portal.productboard.com/8ufdwj59ehtmsvxenjumxo82/tabs/3-universal-render-pipeline
     
  14. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    Any progress with custom Volume overrides or Custom render features?
     
    berkza and kayroice like this.
  15. DonFaddoul

    DonFaddoul

    Joined:
    Feb 2, 2020
    Posts:
    6
    I'm curious to know too if there are any updates regarding Render Features for the 2D renderer?
    Also, side question: why are we limited to only 4 Light Blend Styles in the renderer? Thanks!
     
  16. DonFaddoul

    DonFaddoul

    Joined:
    Feb 2, 2020
    Posts:
    6
    Well well, looks like the renderer features for the 2D renderer are there in the 2021.2.0a16 version.. it's coming!
     

    Attached Files:

  17. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    That is a great news.
     
  18. anhadrs

    anhadrs

    Joined:
    Feb 9, 2022
    Posts:
    2
    Heya, just tested with 2021.2.10, it seems that I can put in the CustomRender Feature but there seems to be no effect on the Sprite Renderers and the feature only affects the camera background. I'm trying to use URP and make a shader for post-processing on the camera. Is it just incomplete in this version of Unity and if so, what is an alternative that I can pursue. I am using Cinemachine so I dont know how effective Camera Stacking would be. I might be missing something but there should be an easy way to add shaders to the camera? I know there used to exist ways to accomplish this on LWRP.
     
  19. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    51
    @anhadrs , so the good news is that you can apply a custom shader to a camera for a full screen post-processing effect, which sounds like what you are trying to accomplish. I can also confirm that if you want to use camera stacking that'll work just fine (not required though afaik), and if you also are using Cinemachine that'll work as well (also not required). I'm assuming that since you are on 2021.2.10 that you're also using URP-12.x, which are the versions I'm using.

    The way that I'm doing this is to use URP_BlitRenderFeature to create a render feature that I can then assign an arbitrary material to. I use the Before Rendering Post Processing event, and apply the effect to Camera Color. You can try different events though, that's just the one that worked for me (I think there was a bug in URP_BlitRenderReature preventing the two After Rendering events from working that has since been fixed; I haven't tested the latest commit though). Just make sure that after you add the custom render feature to your 2D Renderer Asset Data (or the Forward Renderer Asset Data if that's what you're using) that your camera is also configured to use that particular renderer. You'll be able to select the renderer under Camera -> Rendering -> Renderer in the inspector.

    Might be worth mentioning that on versions of URP prior to URP-12.x I couldn't get the 2D Renderer to work with custom render features (I believe that functionality wasn't supported), and instead had to use the Forward Renderer along with camera stacking as outlined here.

    Having said all this, it'd be great to know if(?) or when URP will support custom volume overrides as that should make this process a little more straightforward.
     
    anhadrs likes this.
  20. anhadrs

    anhadrs

    Joined:
    Feb 9, 2022
    Posts:
    2
    Brilliant mate, I just had my event as After Rendering Post Processing instead of before, Thanks!
     
    kayroice likes this.
  21. cpthindsight

    cpthindsight

    Joined:
    Feb 6, 2022
    Posts:
    7
    I am pretty much trying to do what @kayroice outlined above but for some reason Blit.cs (or any custom renderer feature, even if created via right click -> Create -> Rendering -> URP Renderer Feature) is accepted by the Renderer Features list of the 2D Renderer data asset or the URP Pipeline Asset.

    I am struggling to find any trouble shooting for what to do when customer render features aren't showing up. Does anyone have any experience with this? Is there any other set up that I have completely missed?

    Using Unity 2021.3.1f1 with URP 12.1.6.

    How did you do it @anhadrs?

    I read somewhere that the feature file/script has to be in the same folder as the renderer/data but that doesn't seem to help.
     
    Last edited: Apr 29, 2022
  22. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    51
    @cpthindsight , it sounds like you've created your 2D Renderer Asset Data which is the first step, so that's good. Now, when you select your new 2D Renderer Asset Data in the inspector, and click on Add Renderer Feature do you see Blit listed as an option? If you do, what happens when you click on it? Does a new Renderer Feature get added to your 2D Renderer Asset Data? If you've gotten this far, which Renderer does the camera that is rendering the scene use? You should check that your camera is set to use your 2D Renderer Asset Data by checking the Camera -> Rendering -> Renderer option (of your Camera in the scene).

    You don't need to have the Blit.cs script in a specific directory, anywhere in your Assets dir should work just fine. Mine is located at $Assets/Standard Assets/URP_BlitRenderFeature/.
     
  23. cpthindsight

    cpthindsight

    Joined:
    Feb 6, 2022
    Posts:
    7
    @kayroice - thanks you. Yes, I had created the asset data but Blit (or any other custom renderer features) didn't show up as options. I also wasn't able to drag and drop Blit or other customer renderer features.

    However, the problem has now been fixed. Unity now detects Blit and the other ones as custom renderer features. I have no idea if I accidentally changed anything anywhere now - I cannot explain why it works now but it didn't work a few hours ago and now it does. It now accepts any new custom renderer features as it should. But unfortunately I cannot say why/what's different.

    Either way, thank you for your reply @kayroice.