Search Unity

Question How to improve performance of URP/ ShaderGraph on mobile, especially low-end?

Discussion in 'Shader Graph' started by backchocobo, Nov 15, 2020.

  1. backchocobo

    backchocobo

    Joined:
    Jul 16, 2015
    Posts:
    4
    Hello,
    I'm target on low-end mobile if possible, my project have like 100 objects on scene (appear in screen) , they can move & animate different so can't be merge. In previous, I use GPU instancing and the performance is pretty good. But because lack of shader code experience so I upgrade it to URP and trying using ShaderGraph. However it's slow down, and I try to improve it performance, but I do not know where to start so I really need your help:
    1. Does ShaderGraph compatible well with mobile in performance, or should I stick with built-in shader? (I'm current work with unlit only and custom light function cause I scare Lit will drop more in performance)
    2. I heard that GPU Instancing not work in URP, so I enable SPR Batcher instead. From what I read "these batches must be as large as possible...use as few Shader Variants as possible", does that mean if I able to merge all the shader into on big complicate one, the whole scene use only 1 shader and shader property will selection which path inside, does that mean better? Or should I still need to separate shader so the useless code does not need to be execute (like I merge shader with water effects and wind effect, then branch it inside I only have 1 shader?)
    3. Relate to SPR Batcher & mobile performance, how many shaders should I keep at low (1,5,10 or..)
    4. How bad is some built-in node in shader graph I should avoid to performance mobile performance? (like voronoi, noise, freshnel effect.., should I need to be worry?)
    The last thing, I want to improve performance on mobile, for now I really like shader graph because it help the inexperience like me can do a lot about shader and the look of the game. So if you have any tips to share, it will really help and thank you so much for sharing.
     
  2. shotttt

    shotttt

    Joined:
    Jun 6, 2017
    Posts:
    1
    I'm also facing the exact same issue, developing a game for low end mobile using URP.
    After I applied many optimization tips, I got around 50-60 FPS in one of Huawei's latest phones, 30FPS in Galaxy s7 which is ok but 7 FPS on Galaxy note 3 neo and Huawei p8 Lite which is horrible.

    -I have only 1 global light in my scene, turning it off or on, doesn't make any difference.
    -I have around 25-40 batches in my scene.
    -Around 80 - 160 B GC Alloc every frame.
    -The memory debugger shows that the game takes around 270MB in my laptop's RAM.
    I believe the problem lies in the URP.

    I can't really give up on URP, I've made many cool things like shaders with it, and also I'll use lights in my project for a pc version later. So any help is appreciated !
     
  3. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Mobile phones do not support anything in action for a real game .only a simple shader (diffuse shader) can be used for a real game
    You can use cubemaps (as specular) instead of smoothness with realtime lights

    - Your scene must be completely baked
    - Your materials must be without normal maps
    - You can use only a directional light and a pbr shader on small things like The Gun on the hands. Also for roads only in racing games

    Normal maps and AO maps can be baked. Specular can be simulated using cubemaps. Vertex animations can be recorded as animation in 3d software...
    So forget realtime solutions for mobile game

    Smoothness => cubemaps
    specular => cubemaps
    Details and normal maps => Baked into albedo texture
    Lighting => Fully baked
    Sky box => simple HDRI texture (simple shader) not procedural shader
    Volumetric Lighting => Distance fade particles as volumetric effects and light lens flares
    https://forum.unity.com/threads/unity-5-2018-2019-android-performance-tips.437695/
     
    Alverik and tonialatalo like this.
  4. jubaerjams8548

    jubaerjams8548

    Joined:
    Jun 8, 2020
    Posts:
    41
    but how to bake normal map into albedo texture? )