Search Unity

Too many texture interpolators would be used for forward base...

Discussion in 'Shaders' started by Myrmidou, Oct 6, 2016.

  1. Myrmidou

    Myrmidou

    Joined:
    Jun 7, 2014
    Posts:
    30
    Hi there!

    A few months back I used this shader I've found on a forum which hide everything behind the object it's applied to.

    Today I need it again but when I import it in my project I have this error message "too many texture interpolators would be used for forward base pass (11 out of max 10)".

    Does anyone know how to fix this issue? I have absolutely no knowledge about shader coding.

    That would be really helpfull.

    Code (CSharp):
    1. // Compiled shader for PC, Mac & Linux Standalone, uncompressed size: 7.0KB
    2.  
    3. // Skipping shader variants that would not be included into build of current scene.
    4.  
    5. Shader "Nature/Terrain/Diffuse" {
    6. Properties {
    7. [HideInInspector]  _Control ("Control (RGBA)", 2D) = "red" { }
    8. [HideInInspector]  _Splat3 ("Layer 3 (A)", 2D) = "white" { }
    9. [HideInInspector]  _Splat2 ("Layer 2 (B)", 2D) = "white" { }
    10. [HideInInspector]  _Splat1 ("Layer 1 (G)", 2D) = "white" { }
    11. [HideInInspector]  _Splat0 ("Layer 0 (R)", 2D) = "white" { }
    12. [HideInInspector]  _MainTex ("BaseMap (RGB)", 2D) = "white" { }
    13. [HideInInspector]  _Color ("Main Color", Color) = (1,1,1,1)
    14. }
    15. SubShader {
    16. Tags { "QUEUE"="Geometry+1" "RenderType"="Transparent" "SplatCount"="4" }
    17.  
    18.  
    19. // Stats for Vertex shader:
    20. //       d3d11 : 4 math
    21. //    d3d11_9x : 4 math
    22. //        d3d9 : 7 math
    23. // Stats for Fragment shader:
    24. //        d3d9 : 1 math
    25. Pass {
    26.   Tags { "QUEUE"="Geometry+1" "RenderType"="Transparent" "SplatCount"="4" }
    27.   ZWrite Off
    28.   Cull Off
    29.   Blend SrcAlpha OneMinusSrcAlpha
    30.   GpuProgramID 27799
    31. Program "vp" {
    32. SubProgram "d3d9 " {
    33. // Stats: 7 math
    34. Bind "vertex" Vertex
    35. Bind "color" Color
    36. Matrix 0 [glstate_matrix_mvp]
    37. "//
    38. // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
    39. //
    40. // Parameters:
    41. //
    42. //   row_major float4x4 glstate_matrix_mvp;
    43. //
    44. //
    45. // Registers:
    46. //
    47. //   Name               Reg   Size
    48. //   ------------------ ----- ----
    49. //   glstate_matrix_mvp c0       4
    50. //
    51.  
    52.    vs_2_0
    53.    def c4, 0, 1, 0, 0
    54.    dcl_position v0
    55.    dcl_color v1
    56.    max r0, v1, c4.x
    57.    min oD0, r0, c4.y
    58.    mad r0, v0.xyzx, c4.yyyx, c4.xxxy
    59.    dp4 oPos.x, c0, r0
    60.    dp4 oPos.y, c1, r0
    61.    dp4 oPos.z, c2, r0
    62.    dp4 oPos.w, c3, r0
    63.  
    64. // approximately 7 instruction slots used
    65. "
    66. }
    67. SubProgram "d3d11 " {
    68. // Stats: 4 math
    69. Bind "vertex" Vertex
    70. Bind "color" Color
    71. ConstBuffer "UnityPerDraw" 352
    72. Matrix 0 [glstate_matrix_mvp]
    73. BindCB  "UnityPerDraw" 0
    74. "//
    75. // Generated by Microsoft (R) D3D Shader Disassembler
    76. //
    77. //
    78. // Input signature:
    79. //
    80. // Name                 Index   Mask Register SysValue  Format   Used
    81. // -------------------- ----- ------ -------- -------- ------- ------
    82. // POSITION                 0   xyz         0     NONE   float   xyz
    83. // COLOR                    0   xyzw        1     NONE   float   xyzw
    84. //
    85. //
    86. // Output signature:
    87. //
    88. // Name                 Index   Mask Register SysValue  Format   Used
    89. // -------------------- ----- ------ -------- -------- ------- ------
    90. // COLOR                    0   xyzw        0     NONE   float   xyzw
    91. // SV_POSITION              0   xyzw        1      POS   float   xyzw
    92. //
    93.      vs_4_0
    94.      dcl_constantbuffer cb0[4], immediateIndexed
    95.      dcl_input v0.xyz
    96.      dcl_input v1.xyzw
    97.      dcl_output o0.xyzw
    98.      dcl_output_siv o1.xyzw, position
    99.      dcl_temps 1
    100.   0: mov_sat o0.xyzw, v1.xyzw
    101.   1: mul r0.xyzw, v0.yyyy, cb0[1].xyzw
    102.   2: mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw
    103.   3: mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw
    104.   4: add o1.xyzw, r0.xyzw, cb0[3].xyzw
    105.   5: ret
    106. // Approximately 0 instruction slots used
    107. "
    108. }
    109. SubProgram "d3d11_9x " {
    110. // Stats: 4 math
    111. Bind "vertex" Vertex
    112. Bind "color" Color
    113. ConstBuffer "UnityPerDraw" 352
    114. Matrix 0 [glstate_matrix_mvp]
    115. BindCB  "UnityPerDraw" 0
    116. "//
    117. // Generated by Microsoft (R) D3D Shader Disassembler
    118. //
    119. //
    120. // Input signature:
    121. //
    122. // Name                 Index   Mask Register SysValue  Format   Used
    123. // -------------------- ----- ------ -------- -------- ------- ------
    124. // POSITION                 0   xyz         0     NONE   float   xyz
    125. // COLOR                    0   xyzw        1     NONE   float   xyzw
    126. //
    127. //
    128. // Output signature:
    129. //
    130. // Name                 Index   Mask Register SysValue  Format   Used
    131. // -------------------- ----- ------ -------- -------- ------- ------
    132. // COLOR                    0   xyzw        0     NONE   float   xyzw
    133. // SV_POSITION              0   xyzw        1      POS   float   xyzw
    134. //
    135. //
    136. // Constant buffer to DX9 shader constant mappings:
    137. //
    138. // Target Reg Buffer  Start Reg # of Regs        Data Conversion
    139. // ---------- ------- --------- --------- ----------------------
    140. // c1         cb0             0         4  ( FLT, FLT, FLT, FLT)
    141. //
    142. //
    143. // Runtime generated constant mappings:
    144. //
    145. // Target Reg                               Constant Description
    146. // ---------- --------------------------------------------------
    147. // c0                              Vertex Shader position offset
    148. //
    149. //
    150. // Level9 shader bytecode:
    151. //
    152.    vs_2_0
    153.          def c5, 0, 1, 0, 0
    154.          dcl_texcoord v0
    155.          dcl_texcoord1 v1
    156.   0:     max r0, v1, c5.x
    157.   1:     min oT0, r0, c5.y
    158.   2:     mul r0, v0.y, c2
    159.   3:     mad r0, c1, v0.x, r0
    160.   4:     mad r0, c3, v0.z, r0
    161.   5:     add r0, r0, c4
    162.   6:     mad oPos.xy, r0.w, c0, r0
    163.   7:     mov oPos.zw, r0
    164.  
    165. // approximately 8 instruction slots used
    166.      vs_4_0
    167.      dcl_constantbuffer cb0[4], immediateIndexed
    168.      dcl_input v0.xyz
    169.      dcl_input v1.xyzw
    170.      dcl_output o0.xyzw
    171.      dcl_output_siv o1.xyzw, position
    172.      dcl_temps 1
    173.   0: mov_sat o0.xyzw, v1.xyzw
    174.   1: mul r0.xyzw, v0.yyyy, cb0[1].xyzw
    175.   2: mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw
    176.   3: mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw
    177.   4: add o1.xyzw, r0.xyzw, cb0[3].xyzw
    178.   5: ret
    179. // Approximately 0 instruction slots used
    180. "
    181. }
    182. }
    183. Program "fp" {
    184. SubProgram "d3d9 " {
    185. // Stats: 1 math
    186. "//
    187. // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
    188.    ps_2_0
    189.    dcl v0
    190.    mov_pp oC0, v0
    191.  
    192. // approximately 1 instruction slot used
    193. "
    194. }
    195. SubProgram "d3d11 " {
    196. "//
    197. // Generated by Microsoft (R) D3D Shader Disassembler
    198. //
    199. //
    200. // Input signature:
    201. //
    202. // Name                 Index   Mask Register SysValue  Format   Used
    203. // -------------------- ----- ------ -------- -------- ------- ------
    204. // COLOR                    0   xyzw        0     NONE   float   xyzw
    205. // SV_POSITION              0   xyzw        1      POS   float      
    206. //
    207. //
    208. // Output signature:
    209. //
    210. // Name                 Index   Mask Register SysValue  Format   Used
    211. // -------------------- ----- ------ -------- -------- ------- ------
    212. // SV_Target                0   xyzw        0   TARGET   float   xyzw
    213. //
    214.      ps_4_0
    215.      dcl_input_ps linear v0.xyzw
    216.      dcl_output o0.xyzw
    217.   0: mov o0.xyzw, v0.xyzw
    218.   1: ret
    219. // Approximately 0 instruction slots used
    220. "
    221. }
    222. SubProgram "d3d11_9x " {
    223. "//
    224. // Generated by Microsoft (R) D3D Shader Disassembler
    225. //
    226. //
    227. // Input signature:
    228. //
    229. // Name                 Index   Mask Register SysValue  Format   Used
    230. // -------------------- ----- ------ -------- -------- ------- ------
    231. // COLOR                    0   xyzw        0     NONE   float   xyzw
    232. // SV_POSITION              0   xyzw        1      POS   float      
    233. //
    234. //
    235. // Output signature:
    236. //
    237. // Name                 Index   Mask Register SysValue  Format   Used
    238. // -------------------- ----- ------ -------- -------- ------- ------
    239. // SV_Target                0   xyzw        0   TARGET   float   xyzw
    240. //
    241. //
    242. // Level9 shader bytecode:
    243. //
    244.    ps_2_0
    245.          dcl_pp t0
    246.   0:     mov_pp oC0, t0
    247.  
    248. // approximately 1 instruction slot used
    249.      ps_4_0
    250.      dcl_input_ps linear v0.xyzw
    251.      dcl_output o0.xyzw
    252.   0: mov o0.xyzw, v0.xyzw
    253.   1: ret
    254. // Approximately 0 instruction slots used
    255. "
    256. }
    257. }
    258. }
    259. }
    260. Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Lightmap-AddPass"
    261. Dependency "BaseMapShader" = "Diffuse"
    262. Fallback "Diffuse"
    263. }
    Thanks! :)
     
  2. LangTao92

    LangTao92

    Joined:
    May 13, 2017
    Posts:
    15
    reference TerrainSplatmapCommon.cginc