T4M 3 TexturesBumped.shader 1.7 KB

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