Guest User

Vertex Color Transparent Specular

a guest
Jun 13th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. Shader "VertexColor Transparent Specular" {
  2. Properties {
  3. _Shininess ("Shininess", Range (0.03, 1)) = 0.078125
  4. _SpecularColor("_SpecularColor", Color) = (1,1,1,0)
  5. _MainTex ("Base (RGBA)", 2D) = "white" {}
  6. _GlossColor ("_GlossColor", Color) = (1,1,1,0)
  7. }
  8. SubShader {
  9. Tags { "Queue"="Transparent" }
  10. ZWrite On
  11. Alphatest Greater 0
  12. Blend SrcAlpha OneMinusSrcAlpha
  13. ColorMask RGB
  14. LOD 250
  15.  
  16. CGPROGRAM
  17. #pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap noforwardadd alpha
  18. half4 _GlossColor;
  19. half4 _SpecularColor;
  20.  
  21. inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten)
  22. {
  23. fixed diff = max (0, dot (s.Normal, lightDir));
  24. fixed nh = max (0, dot (s.Normal, halfDir));
  25. fixed spec = pow (nh, s.Specular*128) * _GlossColor;
  26.  
  27. fixed4 c;
  28. c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec * _SpecularColor.rgb) * (atten*2);
  29. c.a = 0.0;
  30. return c;
  31. }
  32.  
  33. sampler2D _MainTex;
  34. half _Shininess;
  35.  
  36. struct Input {
  37. float2 uv_MainTex;
  38. float4 color : COLOR;
  39. };
  40.  
  41. void surf (Input IN, inout SurfaceOutput o) {
  42. fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
  43. o.Albedo = tex.rgb * IN.color.rgb;
  44. o.Alpha = IN.color.a;
  45. o.Specular = _Shininess;
  46. }
  47. ENDCG
  48. }
  49.  
  50. FallBack "Mobile/VertexLit"
  51. }
Advertisement
Add Comment
Please, Sign In to add comment