Search Unity

Performance drops down when using MSAA and with setting camera.setRenderTarget = null

Discussion in 'General Graphics' started by LihyAndyDenost, Feb 1, 2021.

  1. LihyAndyDenost

    LihyAndyDenost

    Joined:
    Jan 14, 2021
    Posts:
    4
    Hi Everyone,
    I accidentally find a strange thing when I keep MSAA*4 Open and set the camera's render target to null.
    It drops down the fps from 30 to 20, and GPU Usage from 80% to 100%.
    I detected this problem from two android mobiles.
    I can't figure it out, so anyone willing to help me?
    Thank you so much!
     
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    What render pipeline are you using?

    MSAA is pretty expensive. Just guessing here, but perhaps you're changing from a configuration where it's not supported and doesn't do anything to one where it is supported and you're paying its performance penalty?
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    If you’ve set a render target manually, it’ll be using the MSAA settings of the render texture assigned and ignores the MSAA settings of the project. Setting it to null sets it back to the default render target, which MSAA does affect.
     
  4. LihyAndyDenost

    LihyAndyDenost

    Joined:
    Jan 14, 2021
    Posts:
    4
    Hi,
    Thanks for the reply!
    Let me provide more details.
    The render pipeline is unity's built-in pipeline.
    If I don't set the camera's render target to null, which means there is nothing script attach to the camera, the fps is keeping 30. But if I just set the camera's render target to null, which means the attached script only has one line of code in the Awake() that "camera.renderTarget = null", it makes the fps drop to 20. I can't understand why...
     
  5. LihyAndyDenost

    LihyAndyDenost

    Joined:
    Jan 14, 2021
    Posts:
    4
    Hi,
    Thanks for the reply!
    Let me provide more details.
    The render pipeline is unity's built-in pipeline.
    If I don't set the camera's render target to null, which means there is nothing script attach to the camera, the fps is keeping 30. But if I just set the camera's render target to null, which means the attached script only has one line of code in the Awake() that "camera.renderTarget = null", it makes the fps drop to 20. I can't understand why...