Too many texture interpolators would be used for ForwardBase pass

Unityのシェーダーで

Shader error in '':
Too many texture interpolators would be used for ForwardBase pass (11 out of max 10) at line xx

のようなエラーが出る場合は

#pragma target 4.0

を追加すると動くようになることがあるみたいです。

リンク

Terrain Transparency – Too many text interpolators – Unity Answers
https://answers.unity.com/questions/1077032/terrain-transparency-too-many-text-interpolators.html

Unityでshaderを書くときに参考になる公式リンク

Surface Shaderのサンプル集

Unity – Manual: Surface Shader examples
https://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html

SurfaceOutputSurfaceOutputStandardの定義と#pragma surfaceディレクティブに書けるキーワード

Unity – Manual: Writing Surface Shaders
https://docs.unity3d.com/Manual/SL-SurfaceShaders.html

Surface Shadersでlighting modelsを自作するサンプル集

Unity – Manual: Surface Shader lighting examples
https://docs.unity3d.com/Manual/SL-SurfaceShaderLightingExamples.html

vertex shader、fragment shaderのサンプル集

Unity – Manual: Vertex and fragment shader examples
https://docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html

vertex shader、fragment shaderのサンプル集
appdata_baseappdata_tanappdata_fullについて

Unity – Manual: Providing vertex data to vertex programs
https://docs.unity3d.com/Manual/SL-VertexProgramInputs.html

UNITY_MATRIXunity_ObjectToWorld_TimeなどのBuilt-in変数

Unity – Manual: Built-in shader variables
https://docs.unity3d.com/Manual/SL-UnityShaderVariables.html

??演算子(null合体演算子)

C#には??演算子(null合体演算子)という便利な演算子があるそうです。

x ?? y

のようにして、xnullでない場合はxを返し、xnullの場合はyを返す演算子になっています。

使い方はこんな感じです。

using System;

public class Example
{
  static public void Main ()
  {
    int? a = null;
    int? b = 10;
    int x = (a ?? b).Value;
    Console.WriteLine("x = " + x);
  }
}

実行結果

x = 10

これまで?:演算子で

int x = ((a != null) ? a : b).Value;

のようにしていたのが簡単に書けるみたいです。

リンク

C# 演算子 | Microsoft Docs
https://docs.microsoft.com/ja-jp/dotnet/csharp/language-reference/operators/