6TexturesUnlit.shader 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 6 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. _Splat5 ("Layer6 (RGB)", 2D) = "white" {}
  12. _Control ("Control (RGBA)", 2D) = "white" {}
  13. _Control2 ("Control2 (RGBA)", 2D) = "white" {}
  14. _MainTex ("Never Used", 2D) = "white" {}
  15. }
  16. SubShader {
  17. Pass {
  18. CGPROGRAM
  19. #include "UnityCG.cginc"
  20. #pragma vertex vert
  21. #pragma fragment frag
  22. #pragma multi_compile LIGHTMAP_ON LIGHTMAP_OFF
  23. #pragma exclude_renderers xbox360 ps3 flash
  24. sampler2D _Splat0 ;
  25. sampler2D _Splat1 ;
  26. sampler2D _Splat2 ;
  27. sampler2D _Splat3;
  28. sampler2D _Splat4;
  29. sampler2D _Splat5;
  30. sampler2D _Control;
  31. sampler2D _Control2;
  32. struct v2f {
  33. float4 pos : SV_POSITION;
  34. #ifdef LIGHTMAP_ON
  35. float2 uv[8] : TEXCOORD0;
  36. #endif
  37. #ifdef LIGHTMAP_OFF
  38. float2 uv[7] : TEXCOORD0;
  39. #endif
  40. };
  41. float4 _Splat0_ST;
  42. float4 _Splat1_ST;
  43. float4 _Splat2_ST;
  44. float4 _Splat3_ST;
  45. float4 _Splat4_ST;
  46. float4 _Splat5_ST;
  47. float4 _Control_ST;
  48. #ifdef LIGHTMAP_ON
  49. //fixed4 unity_LightmapST;
  50. // sampler2D unity_Lightmap;
  51. #endif
  52. v2f vert (appdata_full v)
  53. {
  54. v2f o;
  55. o.pos = UnityObjectToClipPos (v.vertex);
  56. o.uv[0] = TRANSFORM_TEX (v.texcoord, _Splat0);
  57. o.uv[1] = TRANSFORM_TEX (v.texcoord, _Splat1);
  58. o.uv[2] = TRANSFORM_TEX (v.texcoord, _Splat2);
  59. o.uv[3] = TRANSFORM_TEX (v.texcoord, _Splat3);
  60. o.uv[4] = TRANSFORM_TEX (v.texcoord, _Splat4);
  61. o.uv[5] = TRANSFORM_TEX (v.texcoord, _Splat5);
  62. o.uv[6] = TRANSFORM_TEX (v.texcoord, _Control);
  63. #ifdef LIGHTMAP_ON
  64. o.uv[7] = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
  65. #endif
  66. return o;
  67. }
  68. fixed4 frag (v2f i) : COLOR
  69. {
  70. fixed4 Mask = tex2D( _Control, i.uv[6].xy );
  71. fixed3 Mask2 = tex2D( _Control2, i.uv[6].xy ).rgb;
  72. fixed3 lay1 = tex2D( _Splat0, i.uv[0].xy );
  73. fixed3 lay2 = tex2D( _Splat1, i.uv[1].xy );
  74. fixed3 lay3 = tex2D( _Splat2, i.uv[2].xy );
  75. fixed3 lay4 = tex2D( _Splat3, i.uv[3].xy );
  76. fixed3 lay5 = tex2D( _Splat4, i.uv[4].xy );
  77. fixed3 lay6 = tex2D( _Splat5, i.uv[5].xy );
  78. fixed3 c2;
  79. c2.xyz = (lay4.xyz * Mask2.r + lay5.xyz * Mask2.g + lay6.xyz * Mask2.b);
  80. fixed4 c;
  81. c.xyz = (lay1.xyz * Mask.r + lay2.xyz * Mask.g + lay3.xyz * Mask.b + c2.xyz * Mask.a);
  82. #ifdef LIGHTMAP_ON
  83. c.rgb *= DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv[7]));
  84. #endif
  85. c.w = 0;
  86. return c;
  87. }
  88. ENDCG
  89. }
  90. }
  91. }