Search Unity

Android Performance Issues with Spotlights in 3D Scene

Discussion in 'Android' started by XeeD, Mar 11, 2020.

  1. XeeD

    XeeD

    Joined:
    Oct 29, 2015
    Posts:
    2
    We are developing a game in which a player has to try to avoid light, represented by (moving/rotating) surveillance cameras.
    See example screenshot right here:


    We have up to 3 surveillance cameras in a scene and varies other ambient lights. Now in editor mode there are no performance issues whatsoever. When played on Android devices the performance varies drastically between different devices, and drops down to 12 fps in some cases.

    Device with good performance, no issues: Pixel 4
    Devices with really bad performance: Nexus 5, Moto G5+
    Unity 2019.2.13f1

    We tried to narrow it down:
    (Moto G5+ with free fps counter prefab from asset store)
    1. started with an empty scene, no lights (~46 fps)
    2. added 1 spotlight with a cube that drops shadows (~32 fps)
    3. added another spotlight, that moves, with a cube that drops shadows (~27 fps)
    4. added volumetric light to better visualize the light-ray of the surveillance cameras (~23 fps)
    5. removed light detection script for the player, which works with raycasting in Update() function (~23 fps, no change)
    The fps further drops down to ~12 fps when the scene becomes bigger, more primitives/decorations are added and more light-sources (e.g. small ambient lights to illuminate the room) are added.
    We had a look at optimized settings für lighting on mobile devices and made some adjustments.

    Things we tried:
    • could not get gpu profiler in unity to work with devices (not supported by graphics card driver, tried on two separate win 10 with 1x Nexus5 & 1x Moto G5+), cpu says "gfx waitforpresent" as most consuming ressource
    • baked the lighting
    • set hard shadows with close fit
    • turned off vsync (minor fps boost)
    • limited fps to 30 and now 45 (minor fps boost)
    • disabled anti aliasing
    • lowered pixel light count, but cannot go under 5 due to number of light sources in scenes (seemed to boost the fps a little bit)
    • lightmap encoding set to "low quality"
    All these changes still lead to a laggy gameplay and delayed controles at around 18-20 fps at best.
    My questions are: Is it possible that the gpu in Nexus 5 and Moto G5+ is just not good enough? Are there any other settings we have to take a look at?

    I feel like we are missing some basic settings, cause i refuse to believe a 2017 smartphone cannot handle 3 to 5 lights in a 3d scene.

    If this thread is the wrong place to post sth. like this, please let me know. I posted this on Answers before and got no response.
    Cheers and thank you in advance!
     
    schlenger likes this.
  2. schlenger

    schlenger

    Joined:
    Jul 13, 2016
    Posts:
    7
    I've also experienced similar issues while developing multiple projects. The easiest way was mostly to avoid too much dynamic lighting - but the game is pretty fast looking "boring" then. I've tried to stay with best practices like e.g. stated in this article: https://medium.com/ironequal/android-optimization-with-unity-3504b34f00b0 but in most of the cases it doesn't provide the improvement I hoped it will do. I hope that anyone has some input for this question, would be stocked to have some useful tips here.