Hey guys, last day I upgrade my unity to the version 3.5(from 3.4), but my projects performance on iPhone become very slowly since a shader is not working efficiently, it is very simple code to implement a shader with **ZWrite** and **AlphaTest**, I don't know why if I change the code "AlphaTest Greater [_Cutoff]" to "Blend SrcAlpha OneMinusSrcAlpha", then the fps change from 30 to 50, my scene contains about 100 objects which have the same texture and alpha channel.
In unity3.4, my shader's performance is OK but, I want to know if there exist any change about transparent/particles shader in version 3.5, or what is the best way to implement an efficiently transparent shader?
Here is my code:
Shader "Custom/Alpha" {
Properties {
_MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
_Cutoff ("Base Alpha cutoff", Range (0,.9)) = .5
}
Category {
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
ZWrite On
SubShader {
Pass {
AlphaTest Greater [_Cutoff] // this line cause my scene very slow
//Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] {
combine texture
}
}
}
}
}
↧