Search Unity

Question GPU usage is too big

Discussion in 'General Graphics' started by rautudenis, May 6, 2021.

  1. rautudenis

    rautudenis

    Joined:
    Dec 30, 2019
    Posts:
    21
    Hello,

    Know anyone why my game use a lot of gpu and if I close the game and I open it my fps is 25 and GPU is 50%. I use URP and my game has just a car, a road and simple terrain with texture.

    Unity:
    Capture.PNG
    Samsung S20:
    Screenshot_20210506-142150_Road Race.jpg
     
  2. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,875
    You have 87 fps on your phone
    It's ok
     
    LaneFox and rautudenis like this.
  3. rautudenis

    rautudenis

    Joined:
    Dec 30, 2019
    Posts:
    21
    The problem is that after 2 minute my fps and gpu decreases. Screenshot_20210506-211046_Road Race.jpg
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    Maybe you probably have a leak somewhere in your code?

    Probably though, your device is thermal throttling.
     
  5. rautudenis

    rautudenis

    Joined:
    Dec 30, 2019
    Posts:
    21
    I don't know, how can I verify that thing?
     
  6. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    It's the OS handling it, and I don't think there's any direct API to look. Typically it will reduce hardware usage because its generating more heat than it can dissipate and has reached a threshold which requires throttling back.

    Is the device hot after 2 minutes?

    https://source.android.com/devices/architecture/hidl/thermal-mitigation
     
    rautudenis likes this.
  7. rautudenis

    rautudenis

    Joined:
    Dec 30, 2019
    Posts:
    21
    Yes, my phone is hot when the game is broken, but in other games phone works fine. What is wrong with my game? Actually how can I solve this?
     
  8. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    171
    You’re hit with thermal throttling, that’s why the game slows down.

    Drop the resolution: mobile phone screens resolution are incredibly high, you won’t be able to render at native resolution even with a simple 3d game.
     
    rautudenis likes this.
  9. rautudenis

    rautudenis

    Joined:
    Dec 30, 2019
    Posts:
    21
    What is the maximum resolution that I can use?
     
  10. If you have time and patience you can play around w/ the adaptive performance package too. In theory that would allow you to lower and raise the quality based on device data on the fly in runtime.
    Disclaimer: I only know the existence of it, I'm not developing for mobile, so I have exactly zero idea if it works and how well if it does.
     
    Last edited by a moderator: May 7, 2021
    rautudenis likes this.
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    1. The Adaptive Performance package was a mess a year ago and it only worked properly on very select few devices. Maybe things have changed (I doubt it).

    2. Consider moving away from the Standard Shader (or whatever it is you're using), it's very expensive and from that screenshot I don't really see you using its features.

    Dropping resolution so you can run inefficient shaders you don't need seems like a bad thing to me.

    3. Disable Vulkan, it has for the last years only caused problems and / or worse performance.

    4. Fake shadows instead of using real time ones. (just create a car blob and place it next to the car on the ground)
     
    rautudenis likes this.
  12. rautudenis

    rautudenis

    Joined:
    Dec 30, 2019
    Posts:
    21
    So... The problem is that the resolution is too big or is something wrong with my game? Because I saw games that use full resolution on Samsung Galaxy S20 and the game works fine.
     
  13. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    rautudenis likes this.
  14. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    171
    There’s no simple answer for that, and it’s not that easy: you can’t just say ‘do this and it’ll work’ based on a couple of screenshots.

    You have to profile on the device and see where your bottlenecks are and, depending on the kind of game, you can do a lot of different things to mitigate the problem.

    Dropping the resolution is one thing and it’s almost a must on mobile: there’s no point in rendering at a crazy high native resolution on a mobile device, you’re just wasting performances and you hardly see the difference. It’s one of the best trade-off you can make.

    Then there’s a ton of other stuff you can do: use simpler shader, don’t use realtime shadows, don’t use terrains and so on…

    There’s no silver bullet, optimizing on mobile is made of a ton of profiling and a ton of work, especially if you want to have great graphics with the right performances and without incurring in thermal throttling…
     
    rautudenis likes this.