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

Reducing screen resolution by 50% (Mobile App)

Discussion in 'General Graphics' started by danUnity, Mar 14, 2021.

  1. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    Hi,

    I want to reduce the screen resolution of my mobile app to run at 50% of the original screen resolution but I'm not quite sure what the best method is...

    It's an AR application so I want to optimize as much as I can. After looking at the following article by unity:

    https://unity3d.com/how-to/fast-optimizations-for-AR

    I saw the following:

    "Generally your target resolution is fine at about half of what the native resolution is for a given mobile device."

    But their solution seems oversimplified since if you set a fixed custom resolution on mobile, it won't work since mobile phones have different resolution aspect ratios...

    So so far, my idea is to get the native resolution on Awake and then divide it by 2 and apply it using

    Screen.SetResolution(nativeRes.x/2, nativeRes.y/2, true)

    Does that even make sense? What happens if the mobile phone does not support that resolution? If the native resolution is too low to divide it by two then should I just keep it in that case?

    I feel this is a pretty basic question but I can't find anything on the how to actually do in production scenarios when you support over 400 phones with Android and then there's all the Iphones...

    Any idea how to do this properly to avoid issues down the road? Is it even a good idea to do that?
     
    FerdowsurAsif likes this.
  2. colin299

    colin299

    Joined:
    Sep 2, 2013
    Posts:
    176
  3. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    Thanks for the info!

    I tried using the resolution like that but the UI is too low quality in that case so I ended up using the RenderScale since I'm using URP:

    https://docs.unity3d.com/Packages/c...s.universal@7.1/manual/universalrp-asset.html

    Render Scale This slider scales the render target resolution (not the resolution of your current device). Use this when you want to render at a smaller resolution for performance reasons or to upscale rendering to improve quality. This only scales the game rendering. UI rendering is left at the native resolution for the device.
     
  4. ToshoDaimos

    ToshoDaimos

    Joined:
    Jan 30, 2013
    Posts:
    679
    The most flexible way to handle this is by using "render target" for your main camera. You render to a texture at ANY resolution you want and then you display a quad with the final image as your screen. This has many advantages which go WAY beyond resolution control.
     
    tree_arb likes this.
  5. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,750
    This can be actually slower on many mobile GPUs, because you're adding an additional store and load operation, plus the final store (which sends the fb to the compositor) will be in full resolution.
     
    AshwinTheGammer likes this.
  6. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    Like @KokkuHub said, Render Target with the Camera is expensive, especially for mobile!