Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

New standard shader performs weakly on Android

Discussion in 'Unity 5 Pre-order Beta' started by WendelinReich, Dec 2, 2014.

  1. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    228
    Hi guys,

    I've timed the performance of the new Standard Shader on Android (Pro) beta 15 on two high-end devices, the Nexus 5 (running Lollipop) and the LG G3 (running KitKat). I have a scene with about 200k polygons and 11 materials, all of which have a diffuse and a normal map, nothing else. No lightmaps, just Ambient light and one directional light without shadows, forward rendering. Results (in FPS) are averaged from several runs and measurements

    Nexus 5: 59 (New Standard Shader), 70 (Mobile/Bumbed Diffuse), 80-90 (Legacy/Bumped Diffuse)

    LG G3: 38 (New Standard Shader), 51 (Mobile/Bumbed Diffuse), 59 (Legacy/Bumped Diffuse)

    Results were similar on a Shield Tablet running Lollipop, but that device seems to have problems running Unity builds in general so I dont include the measurements.

    I do not program shaders and I am not able to dig further into this; I am just stating my measurements. Most confusing to me is the fact that the shader which performs best (i.e., legacy) is the one which is "deprecated" whenever one selects it in the inspector.

    PS: Yes, I've read about how the new shader works and I've made sure not to fill any other slots except diffuse (Albedo) and normal.

    Could anyone from Unity enlighten us about this? At the very least, with such results, the editor should not warn us against legacy shaders but encourage using them...

    /Wendelin
     
    Last edited: Dec 2, 2014
    oblivionkey21 and KhaledM like this.
  2. p87

    p87

    Joined:
    Jun 6, 2013
    Posts:
    318
    even with only albedo and normal... I think the standard shader still uses the specular and smoothness color values, whether they are the defaults or you changed them. The lighting model on the standard shader is more advanced than the bumped/diffuse shader. I think on mobile it falls back to simplified cook-torrance or something. In any case, it's heavier than the mobile/bumped diffuse because it's a more complicated shader. And enlighten may come into play with the standard shader, whereas I don't think enlighten GI affects the legacy shaders.

    This is just what I've read/heard about it in the past, I would love to hear from someone on the Unity team regarding exactly how the standard shader falls back on mobile.

    Shield tablet should be able to handle it fine, if the shield tablet is performing worse than Nexus 5 or LG G3, then you should file a bug report probably. The shield tablet should blow away those devices.
     
  3. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Besides specular and smoothness it probably also uses the reflection cubemaps
     
  4. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    228
    @philwinkel @Devil_Inside I'm sure you're right and its X-times more advanced. The problem is that this comes at something like a 30% performance cost with - in my simple landscape scene - no discernible increase in quality.

    The "standard shader" may be great for some people and projects on mobile, but hardly a majority, given that my test involved high-end devices. It definitely shouldnt be called "standard". The folks at Unity have often mentioned the simplicity of the standard shader in their talks ("optimizes itself if some slots are not used" / "this will be the preferred shader in 80-90% of use cases" etc.), and I do not find these claims hold up.

    The other problem is that when I use the legacy shaders, the editor gives the message, "Consider switching to a simpler shader, look in the mobile folder". Yet these performed worse than the legacy shaders on the two high-end devices. My point is just that Unity does itself a disservice if it shepherds shader-ignorant users like me in the wrong direction...
     
    oblivionkey21 and Ghopper21 like this.
  5. p87

    p87

    Joined:
    Jun 6, 2013
    Posts:
    318
    well, the standard shader optimizes them to an extent. For example if you don't put a height map in the standard shader, it'll skip the parallax mapping. So it's optimized in a sense. However, all of the variations of the standard shader are using new physically based lighting, global illumination, and so on, so regardless of what you're doing with the standard shader it's going to be heavier than legacy shaders.

    I think the "standard shader for 80-90% of use cases" thing will probably hold true for desktop, maybe not so much on mobile.

    yeah, I think the whole "standard shader" and "legacy" shader branding is kind of weird. The word "legacy", as a developer, is a very dirty word. I don't like legacy things. It makes them sound obsolete. And packing all the legacy shaders under the "legacy" category feels like they're trying to hide them under a rug or something.

    For highest performance on current mobile technology, you will probably want to continue using legacy shaders. There's nothing wrong with them; they can still look great. They just don't take advantage of some of the new features in Unity 5.

    It's also a beta, there are probably more optimizations in store, as well as better messaging.

    I see what you're saying though. I think when Unity 5 is released, there are going to be a lot of confused people.