T4M 4 TexturesBumped.shader 2.0 KB

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