So it’s been like 2+ years since I prepared a game for mobile release. Everything has changed now. Back when I last looked into this the built in mobile unity shaders were generally considered bad. Everyone was making a big deal about the CORE framework. But seems they stopped updating that at Unity 4.3.
I’ve been playing around with just the new standard built-in shader. Which looks fine on mobile, but runs very very slow.
I notice on the AssetStore there is now this:
Which looks good.
I assume though, now, a brand new current gen iPad or Android device can probably run the Unity standard shader just fine. So it seems to me like I want to somehow create scenes with the Unity Standard shader for high-end hardware. Then create scenes with a lower-end shader for low-end hardware. Or somehow write my own shader to switch between the standard unity shader and something less heavy when needed.
Just curious, anyone have any wisdoms to share when it comes to shaders on mobile now? What kind of systems are you using to now to take full advantage of and maintain good FPS on the full range of devices from iPad 2 to iPad Pro? What shader packs are good and up to date now? Are the built-in unity mobile shaders in a good state with the latest 5 release?
My (albeit limited) experience is that, if anything, there’s a greater divide between desktop and mobile devices now than there used to be. Shaders have become more complex with realtime GI etc. but, while mobile GPUs have become more powerful, the trend has been to expand pixel density and screen resolution at a greater rate than graphics capability. There are plenty of examples of complex pixel shaders that run slower on newer iPads than on older models because they are fillrate-bound on those big HD screens, and there are particular mobile hardware nuances regarding alpha blending and discarding, for example.
I think the Unity built-in mobile shaders are fine starting points, but you’ll probably end up needing to customise them or roll your own anyway - simply test, test, test, and cut out features one at a time until you get an acceptable performance on your target hardware.
Some ideas.
=> Maybe it is a little too early to use PBR on mobile platform.
=> I will not use build-in shaders when making game, since I need a totally comprehensive and accurate control of my shaders.
=> Most important, decrease transparent rendering as much as possible. Large cover area of transparent triangles will drop FPS heavy on mobile platform.
=> Also do NOT use dependent texture sample in your shader.
=> Test test test until you get a good blance between performance and quality.
Any hints on improving performance of transparent geometry? We have about 15 alpha blended UI controls on our UI - this I assume is hitting our performance a bit - what typical techniques are used to limit the hit on performance for scenarios like this?
– If you use a custom UI you should use custom meshes for your transparent objects to avoid wasting too much space covered by fully transparent objects.
– if possible split the transparent objects and use 2 materials in such a way that the fully opaqe areas don’t use blending at all. You can waste vertices as long as the vertex shader is simple, they are not expensive.
And as a bonus (beside less overdraw) if your then opaque parts of the UI fully cover a tile (on a TBDR GPU) it can be another optimization.
“assume”? Why don’t you just test that with and without UI?
Our UI is totally alpha blended (ie, all buttons are semi transparent and the user can adjust the alpha (so they can see through them to their liking)) so I’m not sure I could use that technique.
I know the UI pays some penalty, the assumption was that the cost of alpha blending all those UI buttons will be bad. I’m beginning to profile this now to see where the real costs are (only just moved the project from 4.6 to 5.2 so I finally have access to the profiler! )
I was hoping there is some way to handle the UI being transparent without such overhead (I’m sure there’s tricks I’m not aware of for this). But now I’m just hijacking this thread - I should probably start a separate thread.