x


AlphaTest shader work slowly in Unity3.5?

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
       }
    }
}

}

}

more ▼

asked Apr 17 '12 at 06:28 PM

youmu gravatar image

youmu
-5 1 1

(comments are locked)
10|3000 characters needed characters left

0 answers: sort newest
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1650
x38

asked: Apr 17 '12 at 06:28 PM

Seen: 469 times

Last Updated: Apr 17 '12 at 06:28 PM