5TexturesUnlit.shader 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. // Upgrade NOTE: commented out 'sampler2D unity_Lightmap', a built-in variable
  3. // Upgrade NOTE: replaced tex2D unity_Lightmap with UNITY_SAMPLE_TEX2D
  4. Shader "T4MShaders/ShaderModel2/Unlit/T4M 5 Textures Unlit LM" {
  5. Properties {
  6. _Splat0 ("Layer1 (RGB)", 2D) = "white" {}
  7. _Splat1 ("Layer2 (RGB)", 2D) = "white" {}
  8. _Splat2 ("Layer3 (RGB)", 2D) = "white" {}
  9. _Splat3 ("Layer4 (RGB)", 2D) = "white" {}
  10. _Splat4 ("Layer5 (RGB)", 2D) = "white" {}
  11. _Control ("Control (RGBA)", 2D) = "white" {}
  12. _Control2 ("Control2 (RGBA)", 2D) = "white" {}
  13. _MainTex ("Never Used", 2D) = "white" {}
  14. }
  15. SubShader {
  16. Pass {
  17. CGPROGRAM
  18. #include "UnityCG.cginc"
  19. #pragma vertex vert
  20. #pragma fragment frag
  21. #pragma multi_compile LIGHTMAP_ON LIGHTMAP_OFF
  22. #pragma exclude_renderers xbox360 ps3
  23. sampler2D _Splat0 ;
  24. sampler2D _Splat1 ;
  25. sampler2D _Splat2 ;
  26. sampler2D _Splat3;
  27. sampler2D _Splat4;
  28. sampler2D _Control;
  29. sampler2D _Control2;
  30. struct v2f {
  31. float4 pos : SV_POSITION;
  32. #ifdef LIGHTMAP_ON
  33. float2 uv[7] : TEXCOORD0;
  34. #endif
  35. #ifdef LIGHTMAP_OFF
  36. float2 uv[6] : TEXCOORD0;
  37. #endif
  38. };
  39. float4 _Splat0_ST;
  40. float4 _Splat1_ST;
  41. float4 _Splat2_ST;
  42. float4 _Splat3_ST;
  43. float4 _Splat4_ST;
  44. float4 _Control_ST;
  45. #ifdef LIGHTMAP_ON
  46. //fixed4 unity_LightmapST;
  47. // sampler2D unity_Lightmap;
  48. #endif
  49. v2f vert (appdata_full v)
  50. {
  51. v2f o;
  52. o.pos = UnityObjectToClipPos (v.vertex);
  53. o.uv[0] = TRANSFORM_TEX (v.texcoord, _Splat0);
  54. o.uv[1] = TRANSFORM_TEX (v.texcoord, _Splat1);
  55. o.uv[2] = TRANSFORM_TEX (v.texcoord, _Splat2);
  56. o.uv[3] = TRANSFORM_TEX (v.texcoord, _Splat3);
  57. o.uv[4] = TRANSFORM_TEX (v.texcoord, _Splat4);
  58. o.uv[5] = TRANSFORM_TEX (v.texcoord, _Control);
  59. #ifdef LIGHTMAP_ON
  60. o.uv[6] = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
  61. #endif
  62. return o;
  63. }
  64. fixed4 frag (v2f i) : COLOR
  65. {
  66. fixed4 Mask = tex2D( _Control, i.uv[5].xy );
  67. fixed2 Mask2 = tex2D( _Control2, i.uv[5].xy ).rg;
  68. fixed3 lay1 = tex2D( _Splat0, i.uv[0].xy );
  69. fixed3 lay2 = tex2D( _Splat1, i.uv[1].xy );
  70. fixed3 lay3 = tex2D( _Splat2, i.uv[2].xy );
  71. fixed3 lay4 = tex2D( _Splat3, i.uv[3].xy );
  72. fixed3 lay5 = tex2D( _Splat4, i.uv[4].xy );
  73. fixed3 c2;
  74. c2.xyz = (lay4.xyz * Mask2.r + lay5.xyz * Mask2.g);
  75. fixed4 c;
  76. c.xyz = (lay1.xyz * Mask.r + lay2.xyz * Mask.g + lay3.xyz * Mask.b + c2.xyz * Mask.a);
  77. #ifdef LIGHTMAP_ON
  78. c.rgb *= DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv[6]));
  79. #endif
  80. c.w = 0;
  81. return c;
  82. }
  83. ENDCG
  84. }
  85. }
  86. }