T4M 2 TexturesBumped.shader 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. Shader "T4MShaders/ShaderModel2/Bump/T4M 2 Textures Bumped" {
  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. CGPROGRAM
  16. #pragma surface surf T4M exclude_path:prepass noforwardadd
  17. #pragma exclude_renderers xbox360 ps3
  18. inline fixed4 LightingT4M (SurfaceOutput s, fixed3 lightDir, fixed atten)
  19. {
  20. fixed diff = dot (s.Normal, lightDir);
  21. fixed4 c;
  22. c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
  23. c.a = 0.0;
  24. return c;
  25. }
  26. struct Input {
  27. float2 uv_Control : TEXCOORD0;
  28. float2 uv_Splat0: TEXCOORD1;
  29. float2 uv_Splat1 : TEXCOORD2;
  30. };
  31. sampler2D _Control;
  32. sampler2D _Splat0, _Splat1;
  33. sampler2D _BumpSplat0,_BumpSplat1;
  34. void surf (Input IN, inout SurfaceOutput o) {
  35. fixed2 splat_control = tex2D (_Control, IN.uv_Control).rg;
  36. fixed3 lay1 = tex2D (_Splat0, IN.uv_Splat0);
  37. fixed3 lay2 = tex2D (_Splat1, IN.uv_Splat1);
  38. o.Alpha = 0.0;
  39. o.Albedo.rgb = (lay1 * splat_control.r + lay2 * splat_control.g);
  40. fixed3 lay1B = UnpackNormal (tex2D(_BumpSplat0, IN.uv_Splat0));
  41. fixed3 lay2B = UnpackNormal (tex2D(_BumpSplat1, IN.uv_Splat1));
  42. o.Normal = (lay1B * splat_control.r + lay2B * splat_control.g);
  43. }
  44. ENDCG
  45. }
  46. // Fallback to Diffuse
  47. //FallBack "Diffuse"
  48. }