1
\$\begingroup\$

I have multiple 3d objects in my scenes. These are without any graphics and have different colors and some lights.

I was building all of the scenes with a standard shader and now, when running on an Android device, FPS drops to 30-50. I've already fixed the particles with Mobile shaders, these work well now but I have some problems with normal cubes, spheres etc.

As I read, Standard shader == death on mobiles and here comes my question. I read that I should use one of these from Mobiles tab or Legacy ones.

Which one is better in my case? Which one should I use when I only want to adjust the color of the object ( + support a lightmap ) ?

\$\endgroup\$
  • 1
    \$\begingroup\$ Legacy Standard Shader is going to perform than the current (PBR) shader. But for optimal efficiency you should use a mobile shader. They're very limited and you may wish to create your own shaders in order to gain back some functionality, just be aware that some shader features will absolutely murder a mobile device's CPU/GPU/RAM usage; basically anything that uses multiple passes. \$\endgroup\$ – Draco18s Apr 24 '17 at 21:28
  • 1
    \$\begingroup\$ It seems to me this is something you could answer for yourself by testing each combination on your target hardware. That way you'll know for sure how it looks and what its performance characteristics are when running on your target hardware, without any internet hearsay or risk of outdated/misleading information. Do you really need anything from us here? \$\endgroup\$ – DMGregory Apr 24 '17 at 22:02
3
\$\begingroup\$

There is no Mobile shader which will only adjust the color of the object, you must write your own custom shader or modify Unity's build-in shaders. If you only want that "color shader" here is the code for that shader.

Shader "Custom/ColorShader" {
Properties {
    _Color("Color", Color) = (1.000000,1.000000,1.000000,1.000000)
}
SubShader {
    Tags 
{ 
    "RenderType"="Opaque"
}
    LOD 150

    CGPROGRAM
    // Physically based Standard lighting model, and enable shadows on all light types
    #pragma surface surf Lambert noforwardadd

    float4 _Color;

    struct Input {
        half color : COLOR;
    };
    void surf (Input IN, inout SurfaceOutput o) {
        o.Albedo = _Color;
    }
    ENDCG
}
FallBack "Diffuse"  }

To create that shader you need to go to Create->Shader->Standard Surface Shader.Open it in some code editor ,delete all existing code and paste this code. Now you can use this shader for your materials choosing it from Custom menu.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.