Search Unity

How to do Camera stacking in LWRP

Discussion in 'Universal Render Pipeline' started by calpolican, Dec 17, 2019.

  1. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    425
    So, I just realized after switching to LWRP that camera stacking doesn't work. Think like shooting a 3D model with one camera and composite it over a GUI shot with another camera, doesn't work anymore. It's official that it's not available for the moment. Any ideas on how to overcome this? Maybe use a custom render pipeline to do the second pass?
     
  2. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    Render whatever you need into render texture and and just put it on gui image? Camera stacking is a really bad practice.
     
    Last edited: Dec 17, 2019
    calpolican likes this.
  3. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    How do you mean put in non gui image?
     
  4. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    Sorry, just miss keys on keyboard...:(
    i mean "put it no gui image"
     
  5. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    Heyhey,
    Since I was replying in another thread about Camera Stacking I thought I should also give a heads up here.

    The Camera Stacking feature for URP is almost ready. We were hoping to merge it this week but found a critical issue that needs solving before doing that. If all goes well it should be ready early January.
     
  6. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    425
    Yeah, that's a fair solution, I've been using it for quite a while in my inventory. Still I thought that stacking would be prefered: in the render texture solution it seems that you add another difficulty since not only it has to check the camera, but it has to also write the texture (I think). And also I have sometimes the feeling that the render texture looks a bit weird if you don't crank the resolution a lot.
     
  7. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    AFAIK in SRP there is no way to render anything after uGUI
     
  8. huzhangyang

    huzhangyang

    Joined:
    Sep 7, 2014
    Posts:
    25
    I just found that you can add a render feature to your pipeline render asset that render UI or any certain layer after post processing (or render opaque or anywhere you need), which solved my issue so that I don't need camera stacking anymore to solve UI issue.
     
  9. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    425
    I ended using the render texture, and bumping the res, thanks Battle Angel.
    you mean, like this?:
     
  10. huzhangyang

    huzhangyang

    Joined:
    Sep 7, 2014
    Posts:
    25
    Yes, Namely: (exclude UI layer from default layer mask)
    upload_2019-12-19_16-9-11.png
     

    Attached Files:

    calpolican likes this.
  11. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    425
    Yeah, that makes sense and is more related to what I was thinking of. For the case of 3D objects I guess you should be able to make a layer "renderInFrontOfGUI" and put a rule to render it after the gui was drawn. The thing I'm not so sure about this, is if it is going to render everything and then render the 3D object on top of that or if it will actually leave the hole (wich is of corse better). I have to play a bit more with this, it looks very interesting.
     
  12. AzizTitu

    AzizTitu

    Joined:
    Apr 25, 2015
    Posts:
    2
    Any updates on this?
     
  13. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    It's planned for 7.2, which is due in about 2 weeks if I'm not mistaken.

    After some great discussions here on the forum, we decided that some changes were needed so we're working really hard to make it happen for you all in 7.2.

    Fingers crossed we'll make it.
     
    AzizTitu and vetasoft like this.
  14. AzizTitu

    AzizTitu

    Joined:
    Apr 25, 2015
    Posts:
    2
    I see it is out on URP which is great. You guys are awesome!

    Any plans for this system to come out for HDRP??
     
  15. janhildebrand

    janhildebrand

    Joined:
    Jun 6, 2015
    Posts:
    4
    this does not work for LWRP, right?
     
  16. janhildebrand

    janhildebrand

    Joined:
    Jun 6, 2015
    Posts:
    4
    what about world space UI objects that should be rendered on top of everything else, but retain their world space scaling, such as health bars?
     
  17. weiping-toh

    weiping-toh

    Joined:
    Sep 8, 2015
    Posts:
    192
    Are you on legacy LWRP?


    You could use a separate RenderPass with a custom material that only renders UI instead of the objects.