Android: realtime lights alternative

Hello,

I’m currently working on a mobile game (Android only) where the player can control a drone in a tunnel but I’m facing performance issues mainly due to lighting.

About the drone:

  • The drone gameobject is a rigidbody which contains the main camera, three spot lights and a sphere (see attached screenshot).
  • The three spot lights are a prequisites as the goal is to reproduce the features of a real drone.
  • The center light is turned off by default.

About the environment:

  • The tunnel walls materials use built-in Mobile/Bumped diffuse shader (see attached screenshot).
  • On the demo scene, I have around 1k verts and tris.
  • No global directional light, no shadows.
  • Post processing volume but disabled by default

About project settings:

  • The project use default render pipeline.
  • Use the OpenGLES3 library, dynamic batching, static batching, incremental GC…
  • The Unity project is build as a library and included in an Android native app.
  • The game will essentialy run on Samsung Galaxy Tab Active2.
  • Editor version: 2019.4.36f

Currently the game is running around 16-18 FPS.
I found out that, when the lights are turned off, FPS comes close to 30 FPS, which is the expected framerate.

The realtime lights are mandatory as they are set on a moving object. The “diffuse” render is important too, as the lights are in a specific angles, only to light up specific zones, and there is features to turn off each of those lights (I tried vertex lights but it does not produce a good result).

I tried to increase performances by tuning lights settings and player settings, also combining meshes, using URP, per vertex lights… and didn’t get anything valuable yet.

I know that realtime lighting costs a lot, but is there any low-cost alternative on mobile?

Thanks a lot.



Try using just one light with a light cookie texture to fake the shape of three spotlights.

Hello, thank you, didn’t know about that.

So now I have only one spotlight in the scene. However, I didn’t notice a performance gain.

I searched more about deferred shading and find out here that:

So I setted a render texture for the camera and scaled down the resolution (from 1280x800 to 640x400 first).
With this change, the game is running at more than 30 FPS. I lose graphic quality but that’s still OK, that’s not the most important thing here.

(as another solution to reduce the resolution I’ve seen that I could simply use Screen.SetResolution but it completely breaks the UI so I will need some changes before using it)

You should avoid using the built-in deferred rendering pipeline on mobile. It’s really not well suited for mobile GPUs since it requires reading back the gbuffers from tile memory to main memory so they can be read during the lighting passes.

Mobile GPUs work best when everything is kept in tile memory, so you should avoid anything which needs to be stored in a render texture. For reducing the rendering resolution, use resolution scaling instead of a render texture

The only solution to have a good fps on any mobile device, is reducing the screen resolution
You can use the following asset to try different settings on your device:
Built-in pipeline:
Quality Settings Selector

URP:
Quality Settings Selector

Try my game for android with fully realtime lighting and terrain deformation system for URP:
Download for Android

** Performance tips and tricks **