T4M 2 TexturesUnified.shader 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Shader "T4MShaders/ShaderModel2/MobileLM/T4M 2 Textures for Mobile" {
  2. Properties {
  3. _Splat0 ("Layer 1", 2D) = "white" {}
  4. _Splat1 ("Layer 2", 2D) = "white" {}
  5. _Control ("Control (RGBA)", 2D) = "white" {}
  6. _MainTex ("Never Used", 2D) = "white" {}
  7. }
  8. SubShader {
  9. Tags {
  10. "SplatCount" = "2"
  11. "RenderType" = "Opaque"
  12. }
  13. CGPROGRAM
  14. #pragma surface surf T4M exclude_path:prepass noforwardadd
  15. #pragma exclude_renderers xbox360 ps3
  16. inline fixed4 LightingT4M (SurfaceOutput s, fixed3 lightDir, fixed atten)
  17. {
  18. fixed diff = dot (s.Normal, lightDir);
  19. fixed4 c;
  20. c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
  21. c.a = 0.0;
  22. return c;
  23. }
  24. struct Input {
  25. float2 uv_Control : TEXCOORD0;
  26. float2 uv_Splat0 : TEXCOORD1;
  27. float2 uv_Splat1 : TEXCOORD2;
  28. };
  29. sampler2D _Control;
  30. sampler2D _Splat0,_Splat1;
  31. void surf (Input IN, inout SurfaceOutput o) {
  32. fixed2 splat_control = tex2D (_Control, IN.uv_Control).rgba;
  33. fixed3 lay1 = tex2D (_Splat0, IN.uv_Splat0);
  34. fixed3 lay2 = tex2D (_Splat1, IN.uv_Splat1);
  35. o.Alpha = 0.0;
  36. o.Albedo.rgb = (lay1 * splat_control.r + lay2 * splat_control.g);
  37. }
  38. ENDCG
  39. }
  40. //FallBack "Diffuse"
  41. }