Search Unity

Feature Request Post Processing with multiple cameras is currently very problematic

Discussion in 'Universal Render Pipeline' started by dev_34Disorder, Dec 26, 2020.

  1. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    233
  2. Ekalawen

    Ekalawen

    Joined:
    Aug 3, 2017
    Posts:
    1
  3. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    OP here, after managing to avoid this issue for half a year i'm finally stuck because of this again LOL.
    And we've reached second page, woohoo! Thanks for the involvement everyone!

    Also, i just realized i've never mentioned what i even need this feature for; my game is a 2D platformer with 3D graphics where most of the visuals are rendered in perspective while the level objects, enemies and characters are rendered orthographicaly (to maintain consistent perspective across the screen). The orthographic view is sandwiched between a camera rendering what's in the back and a camera rendering what's in front. I want to have one set of PP effects for the visuals and one for the level but cannot do that because of the topic at hand ;_;
     
    hkalterkait likes this.
  4. osherdvir

    osherdvir

    Joined:
    Feb 9, 2021
    Posts:
    1
  5. romi-fauzi

    romi-fauzi

    Joined:
    Aug 16, 2013
    Posts:
    161
  6. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    +1
     
    dev_34Disorder likes this.
  7. Jzubah

    Jzubah

    Joined:
    Jan 26, 2018
    Posts:
    4
    This is so disappointing, this possibility is what made camera stacking even remotely exciting, and it doesn't work?
    We need this feature asap unity.
     
  8. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    +1
     
    dev_34Disorder likes this.
  9. itadakiass

    itadakiass

    Joined:
    Nov 11, 2017
    Posts:
    21
    I need my second camera to retain transparency when rendering to the texture while using post process. So it's also a big +1 from me!
     
    hkalterkait and dev_34Disorder like this.
  10. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    44
    Big +1
     
    dev_34Disorder likes this.
  11. hatless

    hatless

    Joined:
    Dec 15, 2010
    Posts:
    48
    Godot engine does this for free, and is similar enough to unity that you could pick it up in a weekend.

    Just saying.
     
    SherryFall, ExtraCat and Riffar like this.
  12. goncalo-vasconcelos

    goncalo-vasconcelos

    Joined:
    May 24, 2017
    Posts:
    8
  13. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,092
    +1's don't help. Bug reports do. If you have an issue tracker, link those. There people can +1 to show importance.
    Some of those bug reports end up already being internally known and handled, hence no issue tracker is known publically. But yeah the least you can do is report the issue with a simple reproduction project.
    It might also be that the issue has already been solved in a later version of the render pipeline.

    Both issues I reported are closed and supposedly fixed. I was waiting for a backport but instead I've updated to Unity 2021.1 since most of the fixes land in the newer versions of Unity first.

    So take your time to report the bugs and if it ain't a bug but a missing feature, there's the roadmap
     
  14. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    Since this is more of a feature (so no bug reports), and there is no way to create a item on the roadmap and share it to gain votes anymore, all we really can do is just share why we want the feature on this forum, with +1's acting as as simple voting system. Does it work? Probably not. But it's better than nothing.
     
  15. Vader87

    Vader87

    Joined:
    Feb 8, 2017
    Posts:
    2
  16. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    I too was hoping to be able to control the order in which post effects are applied and cameras in the stack are merged together. It kind of seems like a graph interface would be the best solution for this to serve the various different configurations people have described here, and still deliver the best performance.
     
    dev_34Disorder likes this.
  17. ddreams_anne

    ddreams_anne

    Joined:
    Dec 13, 2020
    Posts:
    18
    I added the Feature Request today!
     
  18. starfckr1

    starfckr1

    Joined:
    Apr 11, 2021
    Posts:
    24
    +1 on this topic. Really needed feature, there are so many things in my backlog for my game that is impossible to do before i can apply different post processing to different cameras.
     
    hkalterkait likes this.
  19. ddreams_anne

    ddreams_anne

    Joined:
    Dec 13, 2020
    Posts:
    18
    I looked into this myself as I thought I'd had to create one Camera with a Post-Processing effect to grey-out my complete scene and than have another Camera with another Post-Processing effect that would render some of GameObjects in colour on top of the greyed-out scene. But as stated here, that just doesn't work in URP.

    But I found another solution, which actually gives me more control and even only needs one Camera. Using Renderer Features gave me the ability to use a Shader to render my scene completely grey during the After Rendering Opaques event and then render my GameObjects with colour during the Before Rendering Skybox event, by putting the GameObjects in a specific Layer. It actually gave me more possibilities than I could accomplish with the Multiple Camera setup.

    Renderer Features were introduced in URP 10.1.0, but is still getting more powerful (and useful)

    Here's an example of my current setup:

    https://i.imgur.com/FRXCb5j.jpg

    Of course this doesn't mean I still don't want the multiple camera feature, I just thought I'd provide a different solution to the problem :D
     
    Last edited: Sep 7, 2021
    hkalterkait and univepro like this.
  20. emran_17

    emran_17

    Joined:
    Dec 10, 2014
    Posts:
    2
  21. moonlightgames2021

    moonlightgames2021

    Joined:
    May 30, 2021
    Posts:
    3
  22. MiguelBest

    MiguelBest

    Joined:
    Oct 22, 2018
    Posts:
    17
    I'd really like this feature as well.
     
  23. giggioz

    giggioz

    Joined:
    May 11, 2017
    Posts:
    52
  24. H0EY

    H0EY

    Joined:
    Jul 11, 2018
    Posts:
    1
  25. ASDF_alpha

    ASDF_alpha

    Joined:
    Aug 25, 2020
    Posts:
    29
    +1 this is happening to me too,i am trying to make a neon effect,Unity please to something about it,it's not a bug so i cannot submit a bug report and have to suggest it here.
     
  26. nathanAjacobs

    nathanAjacobs

    Joined:
    Feb 18, 2019
    Posts:
    9
    Honestly surprised this hasn't been fixed/implemented yet, I originally ran into this problem a year ago.

    Really would like to be able to have post processing only apply to a specific camera in a stack.
     
    ASDF_alpha likes this.
  27. ASDF_alpha

    ASDF_alpha

    Joined:
    Aug 25, 2020
    Posts:
    29
    yes indeed,i hope a unity staff would look into this problem and stop ignoring it.IT IS INPORTANT!!!
     
  28. ASDF_alpha

    ASDF_alpha

    Joined:
    Aug 25, 2020
    Posts:
    29
  29. Dark-Codex

    Dark-Codex

    Joined:
    Nov 3, 2014
    Posts:
    3
    +1
    for my sake, I want bloom on my UI to simulate a neon glow, and also be able to animate a chromatic aberration on my UI post process.
    The problem (as many others have pointed out), is that this will also apply the bloom and chr.abr. to my 3D scene, which I dont want.
     
  30. Babiole

    Babiole

    Joined:
    May 7, 2016
    Posts:
    17
    Hello, you can achieve such effect with URP but it require some work.
    In the end I had to create a custom camera stack in order to do such thing, but it's properly working now :
    Capture d’écran 2021-11-04 131607.jpg
    In this view there is actually 4 cameras rendering in this order (I use culling mask to select what to render for each cam):

    - Background -> PP + AA
    - Dices -> PP without AA for crisp looking, and good looking texture
    - Foreground (Player 2) -> PP + AA
    - UICam -> No PP, No AA

    As you can understand there is multiple cam with PP and AA, but still I'm able to control each one individualy without affecting the others.

    For this to work properly you need to combine each cam with transparancy, so first step is to make PP compliant with transparency which is not by default, so you have to modify at least UberPost.shader and FinalPost.shader to handle transparency.

    Here is how my frame debugger looks likes :
    Capture d’écran 2021-11-04 132207.png
    If we look camera Dices and Foreground Alpha Only, we can see this
    Capture d’écran 2021-11-04 131902.png
    and Capture d’écran 2021-11-04 131848.png
    Since I have modified PP shader to support Alpha that's mean that PP is also done on these intermediate renders.
    This mean that we can basicaly use the alpha of each render to combine them properly.
    Which is made possible by a ScriptableRenderPass, that take the output of each camera in right order and then merge them with alpha blending.
    The script GenerateRenderTexture do the trick to setup properly camera, and rendering order :
    Capture d’écran 2021-11-04 132051.png

    Each camera in the stack will be setup by the script to output to a render texture that support alpha, and will have this priority property setup accordingly with the order in the stack.

    There is some limitation to this :
    - You can't use premultiply alpha for particule or effect because premultiply alpha by definition doesn't write in the alpha texture. So all your effect have to be alpha blended if you want to see them.
     
    Last edited: Nov 4, 2021
    Kirsche and PutridEx like this.
  31. Babiole

    Babiole

    Joined:
    May 7, 2016
    Posts:
    17
    These image explain this limitation :
    Capture d’écran 2021-11-04 131805.png
    When I'm selecting a dice in the game view the shader as to write in the alpha so I can't use premultiply alpha on this effect otherwise, it will not be visible in the final render.
    upload_2021-11-4_13-53-14.png

    Here are all the camera config in term of PP and AA (the three first one priority and rendertexture are configured by the script GenerateRenderTexture of the fourth one which handle the stacking) :
    cams.png

    Edit :
    I can explain further and share script if needed, but you should have a basic understanding of how it can be done, and the limitation of this approach.
    You can see it as compositing, where each cam render it's image with PP and AA, and later in Photoshop you combine each image with layer stacking using the alpha.
     
    Last edited: Nov 4, 2021
    yongjog33 likes this.
  32. ssavilamp

    ssavilamp

    Joined:
    Jun 7, 2021
    Posts:
    5
  33. ASDF_alpha

    ASDF_alpha

    Joined:
    Aug 25, 2020
    Posts:
    29
    camera stacking make things look wierd upload_2021-11-13_7-42-45.png the turret is on the platform and not inside it but when it rendered that's what it shows in the game view when i stacked cameras it's supposed to look like this upload_2021-11-13_7-44-1.png my cameras look like this upload_2021-11-13_7-44-42.png upload_2021-11-13_7-45-1.png
     

    Attached Files:

  34. IsobelShasha

    IsobelShasha

    Joined:
    Sep 19, 2018
    Posts:
    11
    thank you so much for sharing this workaround! Can you go into more detail about how to modify the post processing shaders, and add the scriptable render pass? And/or share your code if that's something you're willing to do? No worries if not it just seems like this is the closest viable workaround right now.

    I'm really kind of caught off guard with this issue, it's something that could be done with the built-in render pipeline and seems like a major missing feature
     
    ASDF_alpha likes this.
  35. ASDF_alpha

    ASDF_alpha

    Joined:
    Aug 25, 2020
    Posts:
    29
    I agree,a video on how to do this may be helpful too :)
     
  36. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    Is this problem already fixed?
     
  37. ASDF_alpha

    ASDF_alpha

    Joined:
    Aug 25, 2020
    Posts:
    29
    no,not yet
     
  38. altkey_ca

    altkey_ca

    Joined:
    Nov 2, 2014
    Posts:
    8
  39. Billythekidzz1

    Billythekidzz1

    Joined:
    Jan 24, 2020
    Posts:
    3
  40. nabergh

    nabergh

    Joined:
    Jun 22, 2019
    Posts:
    7
  41. SearchTree

    SearchTree

    Joined:
    Feb 16, 2020
    Posts:
    1
  42. HofiOne

    HofiOne

    Joined:
    Apr 19, 2021
    Posts:
    68
  43. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    ali_mohebali likes this.
  44. Kjalarr

    Kjalarr

    Joined:
    Oct 19, 2018
    Posts:
    3
  45. FranFyrhart

    FranFyrhart

    Joined:
    Jun 8, 2018
    Posts:
    11
  46. Slyrae

    Slyrae

    Joined:
    Aug 28, 2017
    Posts:
    4
    All post processing is being applied twice. Once for each camera. This is really irritating.
    +1

    Edit 02/20/22 1:42 AM EST: I'll be investigating further, but I seem to be having trouble with Bloom seeming to deactivate after entering play mode. It might be post effects in general. Both in scene view and in game view it looks fine, but as soon as I hit play it only works for a fraction of second then disappears. If I toggle the global volume off and on again, same thing. It only works very briefly. And yes, all my settings are configured properly. Am running Unity 2021.2.7f1 on URP. Have a pipeline asset, Post effects enabled, HDR enabled, every possible setting seems to be in order. Have no idea what's going on. Only potential issue (seems) to be that I am using camera stacking for FPS view anti-clipping. Will edit post with solution if I manage to find one myself.
     
    Last edited: Feb 20, 2022
  47. josefgrunig

    josefgrunig

    Joined:
    Jan 23, 2017
    Posts:
    62
    Same here. In my mobile app HoppAR, I need both the features discussed here:
    1. Individual Overlay Camera PostProcessing
    2. Keep Alpha while Post Processing
    Cannot find this proposal on the Unity Product Board, can someone point me there in order to vote this up to Unity's team attention. Thank you!
     
  48. Hinkle

    Hinkle

    Joined:
    Sep 10, 2013
    Posts:
    8
  49. NotaNaN

    NotaNaN

    Joined:
    Dec 14, 2018
    Posts:
    325
    @ali_mohebali not 100% sure if you're the right dev to ping, but is this issue on the Unity Team's radar, or is it already being addressed by this Product Board Proposal?

    Whatever the case, (speaking for many) it would be great if you could provide information or clarification on this topic.
    Thanks!
     
  50. ali_mohebali

    ali_mohebali

    Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    119
    Hi everyone and @GliderGuy

    This thread is on our radar. We have also received the feedbacks sent on Product Board. We are discussing and looking at the use cases you have mentioned internally. Give us some time and we will get back on this thread.
     
    Last edited: Feb 18, 2022