(NGUI) display a charactor with a surface shader , on Android platform some mobile phone will shake the screen
there is a part of the surface shader,please help me find issue in this shader that create this question !!
Shader "ActionX/Actor" { Properties { //主纹理 _MainTex ("Base (RGB)", 2D) = "white" {} //主颜色(用于发色) _MainColor ("Main Color", Color) = (1,1,1,1) //纹理颜色置灰 [MaterialToggle] _ToGray ("ToGray", Float) = 0 //开启纹理叠加 [MaterialToggle] _OpenTO ("OpenTO", Float) = 0 //叠加的纹理 _TextureOverlay ("Texture Overlay", 2D) = "black" {} //开启颜色叠加(用于虚化) [MaterialToggle] _OpenCO ("OpenCO", Float) = 0 //叠加的颜色(用于虚化) _ColorOverlay ("Color Overlay", Color) = (1,1,1,1) //叠加的百分比值(用于虚化) _OverlayValue ("Overlay Value", Range(0,1)) = 0 //开启发光 [MaterialToggle] _OpenRI ("OpenRI", Float) = 0 //外发光颜色 _RimColor ("Rim Color", Color) = (0.5,0.5,0.5,0.5) //内发光颜色 _InnerColor ("Inner Color", Color) = (0.5,0.5,0.5,0.5) //发光强度 _Power ("Power(0-10)", Range(0,2)) = 2 //环境光颜色 _AmbientColor ("Ambient Color", Color) = (0.509,0.509,0.509,1) [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 } SubShader { Tags { "RenderType"="Opaque" "LightMode"="Always" } LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _MainColor;
half _ToGray;
half _OpenTO;
uniform sampler2D _TextureOverlay;uniform fixed4 _TextureOverlay_ST;
half _OpenCO;
fixed4 _ColorOverlay;
half _OverlayValue;
half _OpenRI;
fixed4 _RimColor;
fixed4 _InnerColor;
half _Power;
fixed4 _AmbientColor;
struct Input {
half3 viewDir;
half2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
if (_ToGray > 0.6)
{
c.rgb = c.r * 0.299 + c.g * 0.587 + c.b * 0.114;
}
o.Albedo = c.rgb * _MainColor * (1 - c.a) + c.rgb * c.a;
if (_OpenTO > 0.6)
{
fixed4 t = tex2D(_TextureOverlay, TRANSFORM_TEX(IN.uv_MainTex, _TextureOverlay));
o.Albedo = saturate(max(c.rgb, t.rgb));
}
o.Albedo = o.Albedo * _AmbientColor * 2;
if (_OpenCO > 0.6)
{
o.Albedo = o.Albedo + (_ColorOverlay * _OverlayValue);
}
else
{
if (_OpenRI > 0.6)
{
half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
half power = pow (rim, _Power);
o.Emission = (_RimColor.rgb + _InnerColor.rgb * 2) * power;
}
}
}
ENDCG
}
FallBack "Diffuse"
}
Shake the screen : when I Open a UI with a charator the screen will repeat open /close ui , only some moblie phone will show this
Your answer
Follow this Question
Related Questions
color array in Unity Surface Shader causing weird aliasing 0 Answers
How to add correct shadows in vertex deforming shader 0 Answers
Need help with Lightmapping and Surface shader 0 Answers
Realtime GI per vertex in surface shader 0 Answers
Fragment shader shows alpha, surface shader doesn't 0 Answers