Search Unity

HDRP multiple cameras.

Discussion in 'High Definition Render Pipeline' started by koirat, Sep 27, 2020.

  1. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    I was using second camera for GUI in built in pipeline.
    Now I switched my project to HDRP everything worked until I have turned on the fog, resulting in a very buggy result on screen.

    Is there a way to use multiple cameras in HDRP ?
     
  2. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,756
    No, HDRP only supports one camera, if you add in a second one, your performance will take a dump.
     
    koirat likes this.
  3. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Egad_McDad and warthos3399 like this.
  4. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    What's the best way currently to render UI to a render texture (for in-game displays etc.). I'm currently using multiple cameras which affects performance really badly.
     
    Egad_McDad and FerdowsurAsif like this.
  5. switchfoot

    switchfoot

    Joined:
    May 31, 2013
    Posts:
    1
    Did you find an answer to this?
     
  6. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Is it possible to render UGUI and TextMeshPro after postprocess (in a separate camera)?
     
  7. LostPanda

    LostPanda

    Joined:
    Apr 5, 2013
    Posts:
    173
    hi,did you find best way?thanks
     
  8. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    No...
     
  9. LostPanda

    LostPanda

    Joined:
    Apr 5, 2013
    Posts:
    173
  10. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    olavrv likes this.
  11. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,756
    Graphics Compositor is the only way at the moment, or wait for the updated shaders...
     
  12. FutureWang

    FutureWang

    Joined:
    May 24, 2018
    Posts:
    22
    @SebLagarde Hi, in unity 2020.3.3 HDRP , I want to add a camera to let the Lit Shader Mode to Forward and the base camera to Deferred .Is it possible?
    upload_2021-7-8_17-14-2.png
     
  13. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    In HDRP you can do this under custom frame settings \ rendering (on the camera). This works very well, I am using it.
     
  14. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
  15. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    I need a second camera to enable NPCs to sample light levels at places where player is not even looking. So there is no way around it I believe.

    And the performance hit is huge.
    Even though the camera is extremely small and has almost all frame settings disabled. I only need it to sample light levels on specific positions (both real-time and baked, lighting and shadows is all that matters).

    Can I improve performance any further?

    @SebLagarde <3 ?
     
    Last edited: Jan 16, 2022
  16. KCGames47

    KCGames47

    Joined:
    Nov 3, 2014
    Posts:
    39
    I'm trying to get FPS weapon camera clipping done in HDRP, If I understand correctly, to have an FPS weapon camera, I need to set the weapons to LayerX and set the Weapon Camera to only render LayerX, while the main camera renders all layers except LayerX, and in the compositor I should add 2 layers (one for main and one for weapon)?

    If that is the way, it's not working for me.. for some reason the weapons camera renders the entire frame (I can see it in the compositor preview) even though I set it to render the weapon layer only...

    Any help would be appreciated.
     
  17. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Compositor is not intended for games, so that way probably isn't going to work out for you.

    Take a look at this:
    https://github.com/alelievr/HDRP-Cu.../CustomPasses/FPS Foreground/FPSForeground.cs
     
  18. KCGames47

    KCGames47

    Joined:
    Nov 3, 2014
    Posts:
    39
    Thanks a lot!! That seems to work, there's only one issue.. the object the player carries have nested meshes, with this shader pass the internal meshes are showing on top of each other in a weird way. e.g. a picture frame, the edges of inside picture are not being culled by the wooden frame around it, because all of them are being set to the "AlwaysOnTop" layer. Any suggestions?
     
  19. KCGames47

    KCGames47

    Joined:
    Nov 3, 2014
    Posts:
    39
    Another issue, is that somehow I can see ghost like effect for anything behind the objects rendered on the custom pass
     
  20. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Changing the DepthTestOverride to be writeEnabled and use LessEqual for comparison might help with this. It may also have to do with how your materials are writing to the depth buffer. You're probably going to have to tweak the Custom Pass to really get the effects you want.

    You can try changing the injection point. This is probably SSGI or SSAO rendering after the custom pass is completed, which I haven't really found a solution for. Another thing you'll have to fiddle with, I think.
     
    KCGames47 likes this.
  21. KCGames47

    KCGames47

    Joined:
    Nov 3, 2014
    Posts:
    39

    You saved me days of work! it was SSAO causing the ghosting effect, and enabling write to DepthTestOverride to eliminate parts of the model showing on top of itself.

    Thanks a lot!!!!!!!

    Now I'm trying to figure out why Decals on other objects are showing on top of the FPS objects rendered with the custom pass

    Update: Distant decals are not showing on top of my objects anymore after disabling "Affect Normals" and "Affect Smoothness" on the decal material. I'm not sure why though
     
    Last edited: Feb 18, 2022
  22. Napriiihm

    Napriiihm

    Joined:
    Sep 15, 2020
    Posts:
    3
    Hello SebLagarde, can you explain more in detail how to use (rendering pass "after postprocess") in order to display UI on the second monirtot in HDRP ? I don't see how to do it ...

    Edit : I've use a second a second camera and set it's culling mask to UI, background type to color, and with this i'm able to use this second camera juste to display some UI
     
    Last edited: Mar 14, 2024