- Home /
Question by
zreek17 · Aug 29, 2016 at 09:22 AM ·
shadermobilegraphicsoptimization
Mobile: Diffuse Cutout shader with NormalMap. Very bad performance.
Good afternoon. I tried to use such a simple cutout+normalmap shader for my lianas: Shader "MyShaders/Light_CutOut_Color" { Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "white" {}
_BumpMap ("Bumpmap", 2D) = "bump" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
Lighting On
LOD 20
CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff
struct Input
{
fixed2 uv_MainTex;
fixed2 uv_BumpMap;
};
sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}
All textures are 512x512, poly count ~ 1000. So when I run near the model, FPS falls from 50 to 25.
Can you help, is it possible to use cutout + normalsMap in more optimised way? Thank you very much!
Comment