T4M 2 TexturesBumped Mobile.shader 1.5 KB

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