Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Implementing Dual Camera Rendering for a Scope Effect with HDRP - Seeking Performance Advice

Discussion in 'High Definition Render Pipeline' started by Skokon, Jun 16, 2023.

  1. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Hello !

    I am currently working on a project where I need to implement a realistic scope effect for a weapon. My initial approach was to use two separate cameras, one for the general game view and another dedicated one for the scope view.

    Although this method technically works, it results in a significant performance impact, likely due to the overhead of rendering two separate cameras. Given that performance is crucial for my project, I am seeking advice on how to optimize this setup or if there's a better alternative approach that I could take.

    Is there a more performance-efficient way to implement this dual camera setup with Unity's HDRP? Or perhaps a different approach entirely that could achieve a similar scope effect without the need for two separate cameras? Any advice or suggestions would be greatly appreciated.

    Thank you in advance for your help and insights!
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,362
    Cameras are probably the most expensive option. Removing rendered layers, post processing, etc can help however.
    More performant way is to get some sort of texture in a shader where you zoom in

    Here are some methods:
     
  3. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    That’s not really the best way

    Because using shader to play with fov will give you bad look because of the resolution

    Lets wait for unity staff to answer
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,362
    Not sure what FoV has to do with this, but enjoy waiting
     
  5. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Its not about fov, what i meant is if you zoom in a lot then you will get pixelated look because of the resolution
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,362
    Yes, I didn't know how far you needed to zoom.
    For 2 cameras it's about reducing as much as possible. Disable layers which are not needed, disable volumetric effects where possible, etc
     
    Skokon likes this.
  7. cLick1338

    cLick1338

    Joined:
    Feb 23, 2017
    Posts:
    74
    I don't think dual camera will work well with current HDRP versions. It could work for a one-off project where you control the target hardware but not for a wide audience.

    Look at what the new Modern Warfare COD games do. They lower the FOV and also zoom in a little more using shaders. It does look silly especially on high/variable magnification scopes but millions play it every day and I haven't seen a single complaint.

    Escape From Tarkov uses dual camera, not even on HDRP (built in I think) and it's still a big hit on framerate on most machines.
     
    Skokon likes this.
  8. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Thank you so much, Its funny that all this time i haven't noticed that cod does lower the camera fov a lot
    When you told me now and i checked again I've noticed that they do lower the camera fov

    Thanks again! actually this is way better than rendering dual camera