Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Glitching with multiple cameras LWRP

Discussion in 'Graphics Experimental Previews' started by RecursiveRuby, Dec 4, 2018.

  1. RecursiveRuby

    RecursiveRuby

    Joined:
    Jun 5, 2013
    Posts:
    163
    Hey so I use 3 camera with 2 being Depth only and the last being a solid color. This worked fine up until I started using the LWRP. I've tried searching a few topics about this and trying a few things but I can't figure it out. If anyone else has any ideas regarding this I'd really appreciate it

    https://drive.google.com/file/d/1ezqy8IUmW2uLHEholuIaHK-UnCjV4Gat
     
  2. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    LWRP and HDRP don't support multiple layered cameras. Github Changelog

    This was changed/updated for SRP versions 4.2.0 and above.
    upload_2018-12-4_8-46-53.png
     
    Newtori and RecursiveRuby like this.
  3. RecursiveRuby

    RecursiveRuby

    Joined:
    Jun 5, 2013
    Posts:
    163
    Ah okay I guess that explains it. I appreciate the reply :)
     
    Grimreaper358 likes this.
  4. Ehredt

    Ehredt

    Joined:
    Jun 20, 2018
    Posts:
    79
    Does that mean I also won't be able to use cameras with different Viewport Rects, like an extra camera rendering an object in a corner? Also, are they taking that out for good or do they plan to bring it back in at some point?
     
    Desoxi likes this.
  5. Ehredt

    Ehredt

    Joined:
    Jun 20, 2018
    Posts:
    79
  6. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    wait, what? this breaks known rendering techniques for post fx in AR. weird decision...
     
  7. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    Kaldrin, jq911, Pacosmico and 2 others like this.
  8. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    Let me know what you need in terms of postfx in AR so I can provide you a workflow that works.
     
  9. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
    What about rendering of huge worlds in the space simulators? For example I have three cameras one with near/far clip planes 1 - 5000, second - 5000-100000, and the third one is rendering scaled space. So, how to properly implement this in the LWRP?
     
    PrimalCoder, Bendixer, pmot and 3 others like this.
  10. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    What about if I want to use a orhto camera on top of a perspective camera for a 2.5D game?

    Is that still possible without camera stacking?
     
    paulomuggler likes this.
  11. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
  12. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
  13. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Why would you actually need multiple cameras for that?

    Can't you just make those further out planet offset their locations with the camera so they follow it and don't get any closer. I'd suggest faking the planet scale so you can have planets closer to camera in scene to avoid floating point issues. You should be able to achieve similar result as with multiple cameras but more efficiently.
     
    Last edited: Jan 5, 2019
  14. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
    If you launch your spaceship from the surface of planet with 600km radius (1/10 of the actual Earth and almost 1/2 of the Moon), even 50 km far clip plane is not enough for distant view and you already have z-buffer precision issues like z-fighting or inaccurate results when calculating atmospheric scattering. 2 cameras solved this very easily. I want to know how to solve this with one camera setup.
     
  15. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521

    How to render geometry that requires special camera setup

    Users need to create a ScriptableRenderPass and inject in LWRP code to render things that require different camera matrices/fov. These vary on a case by case scenario, f.ex, rendering weapons in an FPS.


    This is worrying me, it sounds so complicated, that the end result is that will not be using LWRP but stay with unity classic render pipeline, is that not backwards of the goal of helping users get better performance?

    I need two cameras with different perspectives on top of each other. and I don't like it if the option is talken away.

    Just keep it in there with a warning use at your own risk.

    Or make the requered injected render pass for us, because I can't program a render pass but I can stack two cameras.

    Please put my worries to rest, and clarify how it will work for someone who is not a programmer
     
    Last edited: Jan 11, 2019
  16. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    thanks for sharing your cases and concerns. We are taking them very seriously. We agree we have to provide an alternative that's about as easy to setup as an additional camera. We are discussing about it atm.

    I'll also want to reassure you that we are still leaving the built-in render pipelines as options for games that require features not supported by SRP.
     
  17. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    Thanks thats good to hear! really appreaciate that these use cases are taken in consideration.
     
    Last edited: Jan 11, 2019
  18. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,967
    Thanks thats brilliant!
     
  19. Holy-Manfred

    Holy-Manfred

    Joined:
    Nov 30, 2013
    Posts:
    15
    I man not sure if I understand the issue correctly. Does that mean with the current LWRP we cannot do things such as a split-screen with two cameras or an inventory window that renders 3d obejcts over the regular game camera?
    If not, would rendering the cameras to a render texture serve as a work-around?
     
    paulomuggler and Lars-Steenhoff like this.
  20. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    @Holy-Manfred Split-screens should work the same as before, issue here is mainly stacking multiple cameras into same view. In splitscreen you just render the camera views side by side, the whole setup is different.
     
  21. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Split screen didn't work when I tested it (at least in HDRP). Forced 1 camera (whatever was selected in editor, not sure what will happen when building) to take the full view rect regardless of what you set it as.
     
    paulomuggler and Lars-Steenhoff like this.
  22. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Lars-Steenhoff likes this.
  23. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Only 1 camera rendered the entire screen. Didn't matter what I set view rect to it'd render whatever camera I had selected to the whole screen. Was back in December on 2018.3
     
  24. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    I'm not sure what's the state of HDRP and multicamera rendering. What I can say for LWRP is:
    Split Screens or rendering any other cameras that render on top without needing the background of a previous camera are supported.
    Screen Space - Camera mode doesn't work atm. We are planning to support it in 19.2. Then you can use that for your 3D UI inventory window.
     
    Last edited: Jan 14, 2019
    rz_0lento and Lars-Steenhoff like this.
  25. Delphic_

    Delphic_

    Joined:
    Apr 23, 2018
    Posts:
    39
    Hi there, since the update i have some problems..
    If stacking isnt possible anymore... how can i achieve sepperating post-processing effects?
    I.e. i had a camera for my "main stuff" wich had a bloom (and more).
    And i had a camera just for particles (weather effects) and one for UI wich should not be affected from post-processing. Now that i need to put them all into one camera i dont find a solution. Would be great if you could (at least) exclude layers from post processing stack, and even better to have different effects applied to different layers ? maybe its possible?
     
    Taurdenga, Morbeavus and Shorely like this.
  26. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    You can have multiple cameras in LWRP. You just can't use them to stack effects.
     
    hippocoder likes this.
  27. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    What about common techniques used in first person games to display the gun ontop of everything?

    Any work around besides using shaders, which would be hell.
     
    Last edited: Jan 22, 2019
    noio and Shorely like this.
  28. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    We are working on exposing a custom render pass to render with camera matrices/fov for things like that.
     
  29. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    Wouldn't it have been better to have these fixes/alternatives in place before removing camera stacking? And only having Screen Space Camera UI working in 2019.2? That's April / May?

    I totally get that we have to break things to move forward, but this seems a bit quick.
     
    Kolyasisan and Shorely like this.
  30. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    That's why we still offer Built-in pipelines. LWRP is not yet completed in terms of features. It's also not the case that LWRP supported camera stacking at one point and removed it, it was not supported from the beginning.
     
  31. tspk91

    tspk91

    Joined:
    Nov 19, 2014
    Posts:
    131
    Hi. In our use case, we utilize layered cameras because VR requires submillimiter accuracy. It is a vehicle game where you can be 100km from origin (we could not use the floating origin technique where you offset everything because hiccups are not acceptable), so to keep accuracy we have a cockpit camera that renders a stationary cockpit at the origin, and a exterior/world camera that moves around. I understand with the new system in SRP, the view distance jitter problem is mostly solved, but it does not solve the floating point accuracy of transforms etc. How could we adapt to it? Also, if we inject a render pass with different view matrices etc, will lights work correctly for that space? Thanks!
     
  32. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    If it is due to precision only I guess Camera Relative rendering work in your case. https://github.com/Unity-Technologies/ScriptableRenderPipeline/wiki/Camera-Relative-Rendering
     
  33. kilijouli

    kilijouli

    Joined:
    Aug 16, 2014
    Posts:
    7
    hello, what about using multiple cameras for large fields of view? like a 180d and beyond for simulators, i don't suppose there is a workaround other than going back to built-in pipeline?
     
    paulomuggler likes this.
  34. tspk91

    tspk91

    Joined:
    Nov 19, 2014
    Posts:
    131
    Yes, I know about that. But it only solves the jitter of far geometry. My issue is that for VR, you need submillimiter accuracy in transforms, or else for example the flight yoke would move in a jittery way. When you are more than 5km or so away from the origin the positions are only accurate to the cm scale; we solved that by keeping the cockpit at the origin and overlaying it over the moving camera. A bit off-topic, but are there any plans to support 64bit transforms in the long term?
     
    paulomuggler likes this.
  35. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    Hi all,

    Regarding the lack of Camera Stacking in LWRP and the Render Pass architecture. We are working on a solution with the goal to release with 2019.1.

    There's a lot of feedback we received regarding this and we shifted our roadmap to tackle these issues and work on a set of examples on how to do rendering in LWRP.

    We are trying to cover most scenarios. To make sure we cover them, we greatly need your help. If you rely on camera stacking please send a message to me directly with what you are doing and the camera setup that you use to achieve that in built-in.

    Thanks
     
  36. evans_unity187

    evans_unity187

    Joined:
    Sep 19, 2017
    Posts:
    5
    Yes it is if you render the ortho camra to a render texture and then assign that render texture to a raw image.
     
    chrismarch likes this.
  37. JacketPotatoeFan

    JacketPotatoeFan

    Joined:
    Nov 23, 2016
    Posts:
    34
    Hi,

    Is this the same in HDRP?

    I need to render an object (sword, gun, tool etc) on top to prevent it clipping into geometry in the world. I've relied on camera stacking to do this in the past and now I am completely lost at how to solve it.
     
    sebastiansgames likes this.
  38. OtakuD

    OtakuD

    Joined:
    Apr 24, 2014
    Posts:
    49
    Losing this feature really hurts! Creating parallax/depth in 2D games is something I'll have to go back and restructure now. Not to mention no UI particles since screen space camera isn't supported.
     
  39. liukeyuan

    liukeyuan

    Joined:
    Jul 4, 2014
    Posts:
    2
    2019.2.b4 the second camera not work·············
     
  40. tahir_ali

    tahir_ali

    Joined:
    Jan 6, 2018
    Posts:
    119
    Is there any solution for 2nd Camera in LWRP?
    I am using UI camera. UI has particles and 3d object for character selection.
    Not upgrading to latest LWRP. Currently using LWRP 4.6.
     
  41. ZoeyDove

    ZoeyDove

    Joined:
    Nov 12, 2018
    Posts:
    11
    Hello!

    I don't have any locked-in production use cases or anything, but I'm very interested in experimenting with stacking cameras combined with shader graph. This seems like it could produce some really interesting results!

    I understand that Unity is working to bring something like camera stacking to LWRP, but there was also some talk about adding a custom render pass on your own. Is there a code sample going around for doing this (here or at Unity)?

    For people looking to experiment with graphics, I feel like the "stack an additional view" use case would be a wonderful entry point to getting into SRP coding.

    Thanks~
     
    Voronoi likes this.
  42. LucyBW

    LucyBW

    Joined:
    Jan 11, 2016
    Posts:
    5
    Did stacking cameras and depth-only clearing get into 2019.1beta ???
     
  43. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    190
    I may be wrong but I think they said 2019.2. I tested my project this week in the latest 2019.1.0b9 with the latest LWRP package and Screen Space UI cameras (with transparent backgrounds) are not working yet, so I believe it's still scheduled for 2019.2.
     
    LucyBW likes this.
  44. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    Delphic_ and LucyBW like this.
  45. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    Do we have clarification as to whether this is in 2019.1 or 2019.2?
     
  46. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    584
    This. Many years ago I shifted my artwork away from Processing because I like the tools Unity provides for experimentation and all of the SDK's that provide support for Unity. Also, stability and performance has been getting better. That said, closing down a common rendering technique (Don't Clear) to create experimental graphics is not a good thing.

    I understand that I have two choices, inject my own SRP pass or use the built-in renderer. It's a disappointing choice, as someone experimenting with the engine, I would really like to get more into Shadergraph or use the VFX graph, but if I do that I lose out in terms of rendering options. If I knew how to write a SRP pass, that would be the solution but I would not know where to begin!
     
  47. SharkDance

    SharkDance

    Joined:
    Dec 22, 2013
    Posts:
    1
    I was actually fine with the removal of camera stacking - I've seen it used too often as a work around for issues which could be better solved by other means.
     
  48. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,276
    I'm also having this issue, but not using LWRP: I'm using the built-in legacy pipeline. Is this supposed to be the case?
     
  49. sebastiansgames

    sebastiansgames

    Joined:
    Mar 25, 2014
    Posts:
    114
    This is the equivalent of removing layers from photoshop. I'm sure it is more performant to remove camera stacking. It'd also be more performant to remove the ability to render colors. In fact let's just render a black screen -- that will be amazing for frame rate! I think this decision sounds crazy. And the reply that oh just write your own SRP pass is absurd. I pay money to a game engine to render depth passes for me -- that's what the game engine is supposed to do. Imagine if photoshop said hey if you want layers sure just write some code to make that happen. Unity is a tool that is supposed to empower development by making artistic choices quick and easy to iterate on and execute. This choice is the opposite of that. The worst part is, you guys are trying to solve a problem no one is asking you to solve. We've been developing games with stacked cameras using Unity for years on much older devices and they work fine. So the notion that non-depth cameras is some vital performance feature that we suddenly need in 2019 doesn't hold water.

    One approach could be a super optimized single layer camera as an option that those who decide they need the extra performance can choose to use. Locking the entire Unity developer community out of stacked cameras with no alternative solution aside from writing SRP passes ourselves is extremely frustrating, and for me personally, broken.

    Someone will surely make the point that the default render pipeline still works with stacked cameras. But how long will default be supported? None of the new features like shader graph or vfx graph are supported with the default render pipeline. It sure feels like it's being phased out. ECS and burst are a great model for how to add performance to an engine: they are optional.
     
  50. sebastiansgames

    sebastiansgames

    Joined:
    Mar 25, 2014
    Posts:
    114
    I’m AcTuAlLy FiNe WiTh THe ReMOvAl of 2D functionality because I’m making a 3D game.

    Here are some examples of where camera stacking is imperative:
    - I want particles in my UI. UI cameras can’t render particles
    - I want my FPS gun to not intersect that bush - the only solution is a layer
    - I purchased a super complicated asset store asset that is totally the wrong scale - either spend 3 months refactoring at the right scale or drop it into a different camera
    - I want a character to flash on a black background when they get hit: new camera overlay makes this possible
    - I want to add 3D graphics (is rotating coins) to my 2D UI: add an orthographic camera
    - I want to experiment with some visuals the pipeline render team hasn’t thought of