Download

How can I work out which part of a Shader doesn't compile for Android?

So I have a bit of a monstrosity for a planetary surface shader which does a bunch of neat things, which works just fine on PC. However, when I build our project for Android and deploy it, the planet surface doesn’t ever load in, and instead I’m graced with the not-quite-as-pretty default material. I’ve tried swapping out the textures just in case, but it definitely seems to be the Shader.

It’s not the only thing doing it either. Some of my Volumetric-like materials are also struggling to render correctly. We’re targetting nVidia Shield, so we could try to enable the Desktop Renderer on the device but I can’t do that at the moment. In the meantime, how can I get the Engine to tell me what isn’t working on Mobile?

The Shader networks, for some indication as to how big the Earth one is:
5590cbe08c9d4e0d8f83592ffb689c2ff93b4bef.jpeg

And this one doesn’t load on Tablet properly either:
DatMaterial.JPG

Looking at your shader i would say whole of it does not compile.
If you exceed 50 instructions you need to be cautious over 100 is no go territory.
And you are at 300. Also 13 textures for mobile.
Maybe in 10 years this will run on newest Tegra.

This second one is for particles, additive (ie simple transparent) where android loves to overdraw and waste cycles.

I would say first one is way over what android can handle.
Second you need to test each branch, this is for particles, i never tried that big particle shader even for nvidia shiled.
I had quite a bit problems with particle parameters on mobiles, while they work fine on pc they love to be just zero (default) on mobiles.

color over life as a parameter seems to be bugged. you’ll want to use initial color and scale color over life. that’s at least for packaged games, not sure if it helps with mobile as well.

As Nawrot pointed out, you are out of textures (max 8). Did you try mobile preview?

Yep, textures was the answer to problem #1 it seems, there are no mobile errors now. I assume that enabling the Desktop renderer on the Shield will enable me to go over 8 textures, regardless of building for Android? It still sits at around 200+ instructions, but the Tegra K1 should be able to handle that without issues.

Solved it by turning on ‘Mobile Stats’, which soon told me the problem for the Surface shader. The second problem with the volumetric material still remains, I have 100% alpha on the material in the packaged game, at least I think that’s it. Are Dynamic Parameters not compatible or something?

For me dynamic parameters worked fine in editor preview but my particles were always black on devices.
Moment i changed parameters for static values all was rendered correctly (but without variation).
I tried to use them for changing color of each particle in runtime. Hue shift passed as parameter also didn’t work.
This may be fixed now however, last time i tried particles it was with 4.2, as medium range android devices dislike sprites.
So i moved for very low poly bullets for now, until much later when i know how much power i can waste on particles.