NormalAlpha.shader 894 B

12345678910111213141516171819202122232425262728293031323334353637
  1. Shader "Custom/Alpha/NormalAlpha" {
  2. Properties{
  3. _Color("Color", Color) = (1,1,1,1)
  4. _MainTex("Albedo (RGB)", 2D) = "white" {}
  5. }
  6. SubShader{
  7. Tags { "RenderType" = "Opaque" "Queue" = "Transparent" }
  8. LOD 200
  9. CGPROGRAM
  10. //再最后添加alpha参数,就可以实现模型的透明设置
  11. #pragma surface surf Lambert alpha
  12. // Use shader model 3.0 target, to get nicer looking lighting
  13. #pragma target 3.0
  14. sampler2D _MainTex;
  15. struct Input {
  16. float2 uv_MainTex;
  17. };
  18. fixed4 _Color;
  19. void surf(Input IN, inout SurfaceOutput o) {
  20. // Albedo comes from a texture tinted by color
  21. fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
  22. o.Albedo = c.rgb;
  23. o.Alpha = c.a;
  24. }
  25. ENDCG
  26. }
  27. FallBack "Diffuse"
  28. }