浏览代码

Merge commit '0a54bdcf00befab61d3a0bbec18c543478eb086d' into fixing

/main
Tim Cooper 7 年前
当前提交
fc3caa89
共有 303 个文件被更改,包括 1429 次插入243 次删除
  1. 2
      MaterialGraphProject/Assets/NewNodes/Editor/Keep/ParallaxNode.cs
  2. 4
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/AACheckerBoard3dNode.cs
  3. 2
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/MultiLayerParallaxNode.cs
  4. 2
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/POMNode.cs
  5. 10
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/SphericalIndentationNode.cs
  6. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs
  7. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SamplerStateShaderProperty.cs
  8. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs
  9. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/PositionNode.cs
  10. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/UVNode.cs
  11. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/VertexColorNode.cs
  12. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/ViewDirectionNode.cs
  13. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix2Node.cs
  14. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix3Node.cs
  15. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix4Node.cs
  16. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Time/SinTimeNode.cs
  17. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Time/TimeNode.cs
  18. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/AbsoluteNode.cs
  19. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LengthNode.cs
  20. 70
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LogNode.cs
  21. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NegateNode.cs
  22. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NormalizeNode.cs
  23. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/PosterizeNode.cs
  24. 55
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalNode.cs
  25. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/AddNode.cs
  26. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/MultiplyNode.cs
  27. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/PowerNode.cs
  28. 14
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SquareRootNode.cs
  29. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SubtractNode.cs
  30. 14
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/InverseLerpNode.cs
  31. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/LerpNode.cs
  32. 14
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/ClampNode.cs
  33. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/FractionNode.cs
  34. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/RemapNode.cs
  35. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/SaturateNode.cs
  36. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/FloorNode.cs
  37. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/RoundNode.cs
  38. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/SignNode.cs
  39. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/StepNode.cs
  40. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/TruncateNode.cs
  41. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/DegreesToRadiansNode.cs
  42. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/RadiansToDegreesNode.cs
  43. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Procedural/NoiseNode.cs
  44. 32
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Procedural/VoronoiNoise.cs
  45. 21
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/SpherizeNode.cs
  46. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/SpherizeNode.cs.meta
  47. 98
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/RotateNode.cs
  48. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs
  49. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs
  50. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ConstantNode.cs.meta
  51. 24
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/RadialShearNode.cs
  52. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DNode.cs
  53. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/SamplerStateNode.cs
  54. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs
  55. 59
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ExponentialNode.cs
  56. 2
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/CheckerboardNode.cs
  57. 2
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/GradientRampNode.cs
  58. 4
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/LineNode.cs
  59. 2
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/PulseNode.cs
  60. 2
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVPannerNode.cs
  61. 4
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTileNode.cs
  62. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs
  63. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs
  64. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs
  65. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs
  66. 38
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/SpherizeNode.cs
  67. 12
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/SpherizeNode.cs.meta
  68. 74
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTransform.cs
  69. 11
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTransform.cs.meta
  70. 7
      MaterialGraphProject/Assets/SRP/PostProcessing/LICENSE.meta
  71. 8
      MaterialGraphProject/Assets/SRP/PostProcessing/PostProcessing.meta
  72. 7
      MaterialGraphProject/Assets/SRP/PostProcessing/README.md.meta
  73. 7
      MaterialGraphProject/Assets/SRP/PostProcessing/package.json.meta
  74. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic.meta
  75. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentVectorNode.cs
  76. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalVectorNode.cs
  77. 97
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/ScreenPositionNode.cs
  78. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentVectorNode.cs
  79. 83
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/TransformationMatrixNode.cs
  80. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Delete.meta
  81. 67
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DAssetNode.cs
  82. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DAssetNode.cs.meta
  83. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ModuloNode.cs
  84. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalSquareRootNode.cs
  85. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/DivideNode.cs
  86. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative.meta
  87. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/SmoothstepNode.cs
  88. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/MaximumNode.cs
  89. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/MinimumNode.cs
  90. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/OneMinusNode.cs
  91. 32
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/RandomRangeNode.cs
  92. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/CeilingNode.cs
  93. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArccosineNode.cs
  94. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcsineNode.cs
  95. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/Arctangent2Node.cs
  96. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArctangentNode.cs

2
MaterialGraphProject/Assets/NewNodes/Editor/Keep/ParallaxNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("UV/Parallax")]
[Title("OLD/Parallax")]
public class ParallaxNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireMeshUV, IMayRequireViewDirection
{
protected const string kInputSlot1ShaderName = "Depth";

4
MaterialGraphProject/Assets/NewNodes/Editor/Kill/AACheckerBoard3dNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Procedural/AACheckerboard3d")]
[Title("OLD/AACheckerboard3d")]
public class AACheckerboard3dNode : CodeFunctionNode
{
protected override MethodInfo GetFunctionToConvert()

float3 blend_out = saturate((scale - aaTweak.zzz) / (aaTweak.yyy - aaTweak.zzz));
float3 vectorAlpha = clamp(distance3 * scale.xyz * blend_out.xyz, -1.0f, 1.0f);
float alpha = saturate(0.5f + 0.5f * vectorAlpha.x * vectorAlpha.y * vectorAlpha.z);
result= lerp(colorA, colorB, alpha.xxxx);;
result= lerp(colorA, colorB, alpha.xxxx);
}";
}
}

2
MaterialGraphProject/Assets/NewNodes/Editor/Kill/MultiLayerParallaxNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("UV/MultiLayerParallax")]
[Title("OLD/MultiLayerParallax")]
public class MultiLayerParallaxNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireMeshUV, IMayRequireViewDirection
{
protected const string kInputDepthShaderName = "Depth";

2
MaterialGraphProject/Assets/NewNodes/Editor/Kill/POMNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("UV/ParallaxOcclusionMapping")]
[Title("OLD/ParallaxOcclusionMapping")]
public class ParallaxOcclusionMappingNode : CodeFunctionNode
{
protected override MethodInfo GetFunctionToConvert()

10
MaterialGraphProject/Assets/NewNodes/Editor/Kill/SphericalIndentationNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("UV/SphericalIndentation")]
public class SphericalIndentationNode : CodeFunctionNode
/*
[Title("UV/Spherize 3D")]
public class SphericalIndentationNode : CodeFunctionNode
public SphericalIndentationNode()
{
name = "Spherize 3D";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_SphericalIndentation", BindingFlags.Static | BindingFlags.NonPublic);

}";
}
}
*/
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs


{
fullName = "UnityEngine.MaterialGraph.NormalNode"
};
result[normalNode] = SerializationHelper.GetTypeSerializableAsString(typeof(NormalNode));
result[normalNode] = SerializationHelper.GetTypeSerializableAsString(typeof(NormalVectorNode));
var worldPosNode = new SerializationHelper.TypeSerializationInfo
{

float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR;
float4 texcoord0 : TEXCOORD0;
float4 lightmapUV : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SamplerStateShaderProperty.cs


public override string GetPropertyDeclarationString()
{
string ss = referenceName + "_"
+ Enum.GetName(typeof(TextureSamplerState.FilterMode), value.filter) + "_"
+ Enum.GetName(typeof(TextureSamplerState.WrapMode), value.wrap) + "_sampler;";
#endif", ss);
#endif", referenceName);
}
public override PreviewProperty GetPreviewMaterialProperty()

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs


var slot = FindSlot<MaterialSlot>(slotId);
if (slot == null)
throw new ArgumentException(string.Format("Attempting to use MaterialSlot({0}) on node of type {1} where this slot can not be found", slotId, this), "slotId");
return GetVariableNameForNode() + "_" + slot.shaderOutputName;
return "_" + GetVariableNameForNode() + "_" + GetHLSLSafeName(slot.shaderOutputName);
return name + "_" + GuidEncoder.Encode(guid);
return GetHLSLSafeName(name) + "_" + GuidEncoder.Encode(guid);
}
public static string GetHLSLSafeName(string input)
{
char[] arr = input.ToCharArray();
arr = Array.FindAll<char>(arr, (c => (char.IsLetterOrDigit(c))));
return new string(arr);
}
public sealed override void AddSlot(ISlot slot)

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/PositionNode.cs


public class PositionNode : GeometryNode, IMayRequirePosition
{
private const int kOutputSlotId = 0;
public const string kOutputSlotName = "Position";
public const string kOutputSlotName = "Out";
public PositionNode()

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/UVNode.cs


public class UVNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireMeshUV
{
public const int OutputSlotId = 0;
private const string kOutputSlotName = "UV";
private const string kOutputSlotName = "Out";
[SerializeField]
private UVChannel m_OutputChannel;

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/VertexColorNode.cs


public class VertexColorNode : AbstractMaterialNode, IMayRequireVertexColor
{
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "VertexColor";
private const string kOutputSlotName = "Out";
public override PreviewMode previewMode
{
get { return PreviewMode.Preview3D; }

{
name = "VertexColor";
name = "Vertex Color";
UpdateNodeAfterDeserialization();
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/ViewDirectionNode.cs


public class ViewDirectionNode : GeometryNode, IMayRequireViewDirection
{
private const int kOutputSlotId = 0;
public const string kOutputSlotName = "ViewDirection";
public const string kOutputSlotName = "Out";
name = "ViewDirection";
name = "View Direction";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix2Node.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input/Matrix/Matrix 2")]
[Title("Input/Matrix/Matrix 2x2")]
const string kOutputSlotName = "Value";
const string kOutputSlotName = "Out";
[SerializeField]
Vector2 m_Row0;

public Matrix2Node()
{
name = "Matrix2";
name = "Matrix 2x2";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix3Node.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input/Matrix/Matrix 3")]
[Title("Input/Matrix/Matrix 3x3")]
const string kOutputSlotName = "Value";
const string kOutputSlotName = "Out";
[SerializeField]
Vector3 m_Row0;

public Matrix3Node()
{
name = "Matrix3";
name = "Matrix 3x3";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix4Node.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input/Matrix/Matrix 4")]
[Title("Input/Matrix/Matrix 4x4")]
const string kOutputSlotName = "Value";
const string kOutputSlotName = "Out";
[SerializeField]
Vector4 m_Row0;

public Matrix4Node()
{
name = "Matrix4";
name = "Matrix 4x4";
UpdateNodeAfterDeserialization();
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Time/SinTimeNode.cs


namespace UnityEditor.ShaderGraph
{
/*
[Title("Input/Time/Sine Time")]
public class SinTimeNode : AbstractMaterialNode, IMayRequireTime
{

return true;
}
}
*/
}

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Time/TimeNode.cs


namespace UnityEditor.ShaderGraph
{
/*
private const string kOutputSlotNameX = "Time/20";
private const string kOutputSlotNameY = "Time";
private const string kOutputSlotNameZ = "Time * 2";
private const string kOutputSlotNameW = "Time * 3";
private const string kOutputSlotNameX = "T/20";
private const string kOutputSlotNameY = "T";
private const string kOutputSlotNameZ = "T*2";
private const string kOutputSlotNameW = "T*3";
public const int OutputSlotId = 0;
public const int OutputSlotIdX = 1;

return true;
}
}
*/
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/AbsoluteNode.cs


}
static string Unity_Absolute(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = abs(argument);
Out = abs(In);
}
";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LengthNode.cs


}
static string Unity_Length(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = length(argument);
Out = length(In);
}
";
}

70
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LogNode.cs


using System.Reflection;
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
public enum LogBase
{
BaseE,
Base2,
Base10
};
[Title("Math/Advanced/Log")]
public class LogNode : CodeFunctionNode
{

}
[SerializeField]
private LogBase m_LogBase = LogBase.BaseE;
[EnumControl("Base")]
public LogBase logBase
{
get { return m_LogBase; }
set
{
if (m_LogBase == value)
return;
m_LogBase = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
return GetType().GetMethod("Unity_Log", BindingFlags.Static | BindingFlags.NonPublic);
switch (m_LogBase)
{
case LogBase.Base2:
return GetType().GetMethod("Unity_Log2", BindingFlags.Static | BindingFlags.NonPublic);
case LogBase.Base10:
return GetType().GetMethod("Unity_Log10", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_Log", BindingFlags.Static | BindingFlags.NonPublic);
}
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = log(In);
}
";
}
static string Unity_Log2(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = log2(In);
}
";
}
static string Unity_Log10(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = log(argument);
Out = log10(In);
}
";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NegateNode.cs


}
static string Unity_Negate(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = -1 * argument;
Out = -1 * In;
}
";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NormalizeNode.cs


}
static string Unity_Normalize(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = normalize(argument);
Out = normalize(In);
}
";
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/PosterizeNode.cs


}
static string Unity_Posterize(
[Slot(0, Binding.None)] DynamicDimensionVector input,
[Slot(1, Binding.None)] DynamicDimensionVector stepsize,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] DynamicDimensionVector Steps,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = floor(input / stepsize) * stepsize;;
Out = floor(In / (1 / Steps)) * (1 / Steps);
}
";
}

55
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalNode.cs


using System.Reflection;
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
public enum ReciprocalMethod
{
Default,
Fast
};
[Title("Math/Advanced/Reciprocal")]
public class ReciprocalNode : CodeFunctionNode
{

}
[SerializeField]
private ReciprocalMethod m_ReciprocalMethod = ReciprocalMethod.Default;
[EnumControl("Method")]
public ReciprocalMethod reciprocalMethod
{
get { return m_ReciprocalMethod; }
set
{
if (m_ReciprocalMethod == value)
return;
m_ReciprocalMethod = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
return GetType().GetMethod("Unity_Reciprocal", BindingFlags.Static | BindingFlags.NonPublic);
switch (m_ReciprocalMethod)
{
case ReciprocalMethod.Fast:
return GetType().GetMethod("Unity_Reciprocal_Fast", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_Reciprocal", BindingFlags.Static | BindingFlags.NonPublic);
}
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = 1.0/In;
}
";
}
static string Unity_Reciprocal_Fast(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = 1.0/argument;
Out = rcp(In);
}
";
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/AddNode.cs


}
static string Unity_Add(
[Slot(0, Binding.None)] DynamicDimensionVector first,
[Slot(1, Binding.None)] DynamicDimensionVector second,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = first + second;
Out = A + B;
}
";
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/MultiplyNode.cs


}
static string Unity_Multiply(
[Slot(0, Binding.None)] DynamicDimensionVector first,
[Slot(1, Binding.None)] DynamicDimensionVector second,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = first * second;
Out = A * B;
}
";
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/PowerNode.cs


protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Pow", BindingFlags.Static | BindingFlags.NonPublic);
return GetType().GetMethod("Unity_Power", BindingFlags.Static | BindingFlags.NonPublic);
static string Unity_Pow(
[Slot(0, Binding.None)] DynamicDimensionVector first,
[Slot(1, Binding.None)] DynamicDimensionVector second,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Power(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = pow(first, second);
Out = pow(A, B);
}
";
}

14
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SquareRootNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Math/Basic/SquareRoot")]
[Title("Math/Basic/Square Root")]
name = "SquareRoot";
name = "Square Root";
return GetType().GetMethod("Unity_Sqrt", BindingFlags.Static | BindingFlags.NonPublic);
return GetType().GetMethod("Unity_SquareRoot", BindingFlags.Static | BindingFlags.NonPublic);
static string Unity_Sqrt(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
static string Unity_SquareRoot(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = sqrt(argument);
Out = sqrt(In);
}
";
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SubtractNode.cs


}
static string Unity_Subtract(
[Slot(0, Binding.None)] DynamicDimensionVector first,
[Slot(1, Binding.None)] DynamicDimensionVector second,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = first - second;
Out = A - B;
}
";
}

14
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/InverseLerpNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Math/Interpolation/InverseLerp")]
[Title("Math/Interpolation/Inverse Lerp")]
name = "InverseLerp";
name = "Inverse Lerp";
}
protected override MethodInfo GetFunctionToConvert()

static string Unity_InverseLerp(
[Slot(0, Binding.None)] DynamicDimensionVector inputA,
[Slot(1, Binding.None)] DynamicDimensionVector inputB,
[Slot(2, Binding.None)] DynamicDimensionVector t,
[Slot(3, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] DynamicDimensionVector T,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
result = (t - inputA)/(inputB - inputA);
Out = (T - A)/(B - A);
}";
}
}

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/LerpNode.cs


}
static string Unity_Lerp(
[Slot(0, Binding.None)] DynamicDimensionVector inputA,
[Slot(1, Binding.None)] DynamicDimensionVector inputB,
[Slot(2, Binding.None)] DynamicDimensionVector t,
[Slot(3, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] DynamicDimensionVector T,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
result = lerp(inputA, inputB, t);
Out = lerp(A, B, T);
}";
}
}

14
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/ClampNode.cs


protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Smoothstep", BindingFlags.Static | BindingFlags.NonPublic);
return GetType().GetMethod("Unity_Clamp", BindingFlags.Static | BindingFlags.NonPublic);
static string Unity_Smoothstep(
[Slot(0, Binding.None)] DynamicDimensionVector input,
[Slot(1, Binding.None)] DynamicDimensionVector min,
[Slot(2, Binding.None)] DynamicDimensionVector max,
[Slot(3, Binding.None)] out DynamicDimensionVector result)
static string Unity_Clamp(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] DynamicDimensionVector Min,
[Slot(2, Binding.None, 1, 1, 1, 1)] DynamicDimensionVector Max,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
result = clamp(input, min, max);
Out = clamp(In, Min, Max);
}";
}
}

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/FractionNode.cs


protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Frac", BindingFlags.Static | BindingFlags.NonPublic);
return GetType().GetMethod("Unity_Fraction", BindingFlags.Static | BindingFlags.NonPublic);
static string Unity_Frac(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
static string Unity_Fraction(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = frac(argument);
Out = frac(In);
}
";
}

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/RemapNode.cs


}
static string Unity_Remap(
[Slot(0, Binding.None)] DynamicDimensionVector input,
[Slot(1, Binding.None)] Vector2 inMinMax,
[Slot(2, Binding.None)] Vector2 outMinMax,
[Slot(3, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None, 0, 1, 0, 0)] Vector2 InMinMax,
[Slot(2, Binding.None, 0, 1, 0, 0)] Vector2 OutMinMax,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
result = outMinMax.x + (input - inMinMax.x) * (outMinMax.y - outMinMax.x) / (inMinMax.y - inMinMax.x);
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
}
";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/SaturateNode.cs


}
static string Unity_Saturate(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = saturate(argument);
Out = saturate(In);
}
";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/FloorNode.cs


}
static string Unity_Floor(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = floor(argument);
Out = floor(In);
}
";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/RoundNode.cs


}
static string Unity_Round(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = round(argument);
Out = round(In);
}
";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/SignNode.cs


}
static string Unity_Sign(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = sign(argument);
Out = sign(In);
}
";
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/StepNode.cs


}
static string Unity_Step(
[Slot(0, Binding.None)] DynamicDimensionVector first,
[Slot(1, Binding.None)] DynamicDimensionVector second,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = step(first, second);
Out = step(A, B);
}
";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/TruncateNode.cs


}
static string Unity_Truncate(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = truncate(argument);
Out = trunc(In);
}
";
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/DegreesToRadiansNode.cs


{
public DegreesToRadiansNode()
{
name = "DegreesToRadians";
name = "Degrees To Radians";
}
protected override MethodInfo GetFunctionToConvert()

static string Unity_DegreesToRadians(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = radians(argument);
Out = radians(In);
}
";
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/RadiansToDegreesNode.cs


{
public RadiansToDegreesNode()
{
name = "RadiansToDegrees";
name = "Radians To Degrees";
}
protected override MethodInfo GetFunctionToConvert()

static string Unity_RadiansToDegrees(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = degrees(argument);
Out = degrees(In);
}
";
}

9
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Procedural/NoiseNode.cs


}
static string Unity_Noise(
[Slot(0, Binding.MeshUV0)] Vector2 uv,
[Slot(1, Binding.None)] out Vector1 noise)
[Slot(0, Binding.MeshUV0)] Vector2 UV,
[Slot(1, Binding.None,500f,500f,500f,500f)] Vector1 Scale,
[Slot(2, Binding.None)] out Vector1 Out)
{
return
@"

{
float freq = pow(2.0, float(i));
float amp = pow(0.5, float(3-i));
t += unity_valueNoise(float2(uv.x/freq, uv.y/freq))*amp;
t += unity_valueNoise(float2(UV.x*Scale/freq, UV.y*Scale/freq))*amp;
noise = t;
Out = t;
}
";
}

32
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Procedural/VoronoiNoise.cs


namespace UnityEditor.ShaderGraph
{
[Title("Procedural/Voronoi Noise")]
[Title("Procedural/Voronoi")]
name = "VoronoiNoise";
name = "Voronoi";
}
protected override MethodInfo GetFunctionToConvert()

static string Unity_VoronoiNoise(
[Slot(0, Binding.MeshUV0)] Vector2 uv,
[Slot(1, Binding.None, 2.0f, 0, 0, 0)] Vector1 angleOffset,
[Slot(2, Binding.None)] out Vector1 n1,
[Slot(2, Binding.None)] out Vector1 n2,
[Slot(2, Binding.None)] out Vector1 n3)
[Slot(0, Binding.MeshUV0)] Vector2 UV,
[Slot(1, Binding.None, 2.0f, 0, 0, 0)] Vector1 AngleOffset,
[Slot(2, Binding.None,5.0f,5.0f,5.0f,5.0f)] Vector1 CellDensity,
[Slot(3, Binding.None)] out Vector1 Out,
[Slot(4, Binding.None)] out Vector1 Cells)
float2 g = floor(uv);
float2 f = frac(uv);
float2 g = floor(UV * CellDensity);
float2 f = frac(UV * CellDensity);
float t = 8.0;
float3 res = float3(8.0, 0.0, 0.0);

{
float2 lattice = float2(x,y);
float2 offset = unity_voronoi_noise_randomVector(lattice + g, angleOffset);
float2 offset = unity_voronoi_noise_randomVector(lattice + g, AngleOffset);
float d = distance(lattice + offset, f);
if(d < res.x)

n1 = res.x;
n2 = res.y;
n3 = 1.0 - res.x;
Out = res.x;
Cells = res.y;
}
";
}

var preamble = @"
inline float2 unity_voronoi_noise_randomVector (float2 uv, float offset)
inline float2 unity_voronoi_noise_randomVector (float2 UV, float offset)
uv = frac(sin(mul(uv, m)) * 46839.32);
return float2(sin(uv.y*+offset)*0.5+0.5, cos(uv.x*offset)*0.5+0.5);
UV = frac(sin(mul(UV, m)) * 46839.32);
return float2(sin(UV.y*+offset)*0.5+0.5, cos(UV.x*offset)*0.5+0.5);
}
";
visitor.AddShaderChunk(preamble, true);

21
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/SpherizeNode.cs


{
name = "Spherize";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Spherize", BindingFlags.Static | BindingFlags.NonPublic);

[Slot(0, Binding.MeshUV0)] Vector2 uv,
[Slot(1, Binding.None)] Vector2 position,
[Slot(2, Binding.None)] Vector2 radiusAndStrength,
[Slot(3, Binding.None)] out Vector2 result)
[Slot(0, Binding.MeshUV0)] Vector2 UV,
[Slot(1, Binding.None, 0.5f, 0.5f, 0.5f, 0.5f)] Vector2 Center,
[Slot(2, Binding.None, 10f, 10f, 10f, 10f)] Vector2 Strength,
[Slot(3, Binding.None)] Vector2 Offset,
[Slot(4, Binding.None)] out Vector2 Out)
result = Vector2.zero;
Out = Vector2.zero;
{precision}2 fromUVToPoint = position - uv;
{precision} dist = length(fromUVToPoint);
{precision} mag = ((1.0 - (dist / radiusAndStrength.x)) * radiusAndStrength.y) * step(dist, radiusAndStrength.x);
result = uv + (mag * fromUVToPoint);
float2 delta = UV - Center;
float delta2 = dot(delta.xy, delta.xy);
float delta4 = delta2 * delta2;
float2 delta_offset = delta4 * Strength;
Out = UV + delta * delta_offset + Offset;
}";
}
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/SpherizeNode.cs.meta


fileFormatVersion: 2
guid: 249d9b9165bdf234e84a85cdb8aca2aa
timeCreated: 1495555169
guid: dfd538e33eb01974fad49a2533f8cff8
timeCreated: 1495729511
licenseType: Pro
MonoImporter:
serializedVersion: 2

98
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/RotateNode.cs


using System.Reflection;
using UnityEngine;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEditor.Graphing;
[Title("UV/UV Rotator")]
public class UVRotatorNode : CodeFunctionNode
public enum RotationUnit
{
Radians,
Degrees
};
[Title("UV/Rotate")]
public class RotateNode : CodeFunctionNode
public UVRotatorNode()
[SerializeField]
private RotationUnit m_Unit = RotationUnit.Radians;
[EnumControl("Unit")]
public RotationUnit unit
{
get { return m_Unit; }
set
{
if (m_Unit == value)
return;
m_Unit = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
public RotateNode()
name = "UVRotator";
name = "Rotate";
return GetType().GetMethod("Unity_UVRotator", BindingFlags.Static | BindingFlags.NonPublic);
if(m_Unit == RotationUnit.Radians)
return GetType().GetMethod("Unity_Rotate_Radians", BindingFlags.Static | BindingFlags.NonPublic);
else
return GetType().GetMethod("Unity_Rotate_Degrees", BindingFlags.Static | BindingFlags.NonPublic);
static string Unity_UVRotator(
[Slot(0, Binding.MeshUV0)] Vector4 uv,
[Slot(1, Binding.None)] Vector1 rotation,
[Slot(2, Binding.None)] out Vector4 result)
static string Unity_Rotate_Radians(
[Slot(0, Binding.MeshUV0)] Vector2 UV,
[Slot(1, Binding.None, 0.5f, 0.5f, 0.5f, 0.5f)] Vector2 Center,
[Slot(2, Binding.None)] Vector1 Rotation,
[Slot(3, Binding.None)] out Vector2 Out)
result = Vector2.zero;
Out = Vector2.zero;
uv.xy -= 0.5;
{precision} s = sin(rotation);
{precision} c = cos(rotation);
UV -= Center;
{precision} s = sin(Rotation);
{precision} c = cos(Rotation);
//center rotation matrix
{precision}2x2 rMatrix = float2x2(c, -s, s, c);
rMatrix *= 0.5;
rMatrix += 0.5;
rMatrix = rMatrix*2 - 1;
//multiply the UVs by the rotation matrix
UV.xy = mul(UV.xy, rMatrix);
UV += Center;
Out = UV;
}";
}
static string Unity_Rotate_Degrees(
[Slot(0, Binding.MeshUV0)] Vector2 UV,
[Slot(1, Binding.None, 0.5f, 0.5f, 0.5f, 0.5f)] Vector2 Center,
[Slot(2, Binding.None)] Vector1 Rotation,
[Slot(3, Binding.None)] out Vector2 Out)
{
Out = Vector2.zero;
return @"
{
//rotation matrix
Rotation = Rotation * (3.1415926f/180.0f);
UV -= Center;
{precision} s = sin(Rotation);
{precision} c = cos(Rotation);
//center rotation matrix
{precision}2x2 rMatrix = float2x2(c, -s, s, c);

//multiply the UVs by the rotation matrix
uv.xy = mul(uv.xy, rMatrix);
uv.xy += 0.5;
result = uv;
UV.xy = mul(UV.xy, rMatrix);
UV += Center;
Out = UV;
}
}
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs


if (combinedRequierments.requiresVertexColor)
{
interpolators.AddShaderChunk(string.Format("float4 {0} : COLOR;", ShaderGeneratorNames.VertexColor), false);
vertexShader.AddShaderChunk(string.Format("o.{0} = color", ShaderGeneratorNames.VertexColor), false);
vertexShader.AddShaderChunk(string.Format("o.{0} = v.color;", ShaderGeneratorNames.VertexColor), false);
pixelShader.AddShaderChunk(string.Format("float4 {0} = IN.{0};", ShaderGeneratorNames.VertexColor), false);
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs


return new ColorControlView(null, node, propertyInfo);
if (typeof(Enum).IsAssignableFrom(propertyInfo.PropertyType))
return new EnumControlView(null, node, propertyInfo);
if (propertyInfo.PropertyType == typeof(Gradient))
return new GradientControlView(null, node, propertyInfo);
if (propertyInfo.PropertyType == typeof(Texture2D))
return new TextureControlView(null, node, propertyInfo);
if (MultiFloatControlView.validTypes.Contains(propertyInfo.PropertyType))
return new MultiFloatControlView(null, "X", "Y", "Z", "W", node, propertyInfo);
if (typeof(Object).IsAssignableFrom(propertyInfo.PropertyType))

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ConstantNode.cs.meta


fileFormatVersion: 2
guid: fea1e18ab449c174d91a3f41a220aa4e
timeCreated: 1495448829
licenseType: Pro
guid: f48f68efc30ae334098ff30e88fbf9db
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0

24
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/RadialShearNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("UV/RadialShearNode")]
[Title("UV/Radial Shear")]
public RadialShearNode()
{
name = "Radial Shear";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_RadialShear", BindingFlags.Static | BindingFlags.NonPublic);

[Slot(0, Binding.MeshUV0)] Vector2 uv,
[Slot(1, Binding.None, 0.5f, 0.5f, 0.5f, 0.5f)] Vector2 center,
[Slot(2, Binding.None, 1f, 1f, 1f, 1f)] Vector2 shearAmount,
[Slot(3, Binding.None)] Vector2 offset,
[Slot(4, Binding.None)] out Vector2 result)
[Slot(0, Binding.MeshUV0)] Vector2 UV,
[Slot(1, Binding.None, 0.5f, 0.5f, 0.5f, 0.5f)] Vector2 Center,
[Slot(2, Binding.None, 10f, 10f, 10f, 10f)] Vector2 Strength,
[Slot(3, Binding.None)] Vector2 Offset,
[Slot(4, Binding.None)] out Vector2 Out)
result = Vector2.zero;
Out = Vector2.zero;
float2 delta = uv - center;
float2 delta = UV - Center;
float2 delta_offset = delta2 * shearAmount;
result = uv + float2(delta.y, -delta.x) * delta_offset + offset;
float2 delta_offset = delta2 * Strength;
Out = UV + float2(delta.y, -delta.x) * delta_offset + Offset;
}
";
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Texture/Sample 2D")]
public class Sample2DTexture : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireMeshUV
[Title("Input/Texture/Texture 2D")]
public class Texture2DNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireMeshUV
{
public const int OutputSlotRGBAId = 0;
public const int OutputSlotRId = 4;

public override bool hasPreview { get { return true; } }
public Sample2DTexture()
public Texture2DNode()
name = "Sample2DTexture";
name = "Texture 2D";
UpdateNodeAfterDeserialization();
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/SamplerStateNode.cs


public SamplerStateNode()
{
name = "SamplerState";
name = "Sampler State";
UpdateNodeAfterDeserialization();
}

private const string kOutputSlotName = "Sampler Output";
private const string kOutputSlotName = "Out";
public sealed override void UpdateNodeAfterDeserialization()
{

{
overrideReferenceName = GetVariableNameForNode(),
generatePropertyBlock = false,
value = new TextureSamplerState()
{
filter = m_filter,

public override string GetVariableNameForNode()
{
string ss = name + "_"
+ Enum.GetName(typeof(TextureSamplerState.FilterMode), filter) + "_"
+ Enum.GetName(typeof(TextureSamplerState.WrapMode), wrap) + "_sampler;";
string ss = GetHLSLSafeName(name) + "_"
+ Enum.GetName(typeof(TextureSamplerState.FilterMode), filter) + "_"
+ Enum.GetName(typeof(TextureSamplerState.WrapMode), wrap) + "_sampler";
return ss;
}
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input/Color")]
[Title("Input/Basic/Color")]
public class ColorNode : AbstractMaterialNode, IGeneratesBodyCode, IPropertyFromNode
{
[SerializeField]

private const string kOutputSlotName = "Color";
private const string kOutputSlotName = "Out";
public ColorNode()
{

59
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ExponentialNode.cs


using System.Reflection;
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
[Title("Math/Basic/Exponential")]
public enum ExponentialBase
{
BaseE,
Base2
};
[Title("Math/Advanced/Exponential")]
public class ExponentialNode : CodeFunctionNode
{
public ExponentialNode()

[SerializeField]
private ExponentialBase m_ExponentialBase = ExponentialBase.BaseE;
[EnumControl("Base")]
public ExponentialBase exponentialBase
{
get { return m_ExponentialBase; }
set
{
if (m_ExponentialBase == value)
return;
m_ExponentialBase = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
return GetType().GetMethod("Unity_Exp", BindingFlags.Static | BindingFlags.NonPublic);
switch (m_ExponentialBase)
{
case ExponentialBase.Base2:
return GetType().GetMethod("Unity_Exponential2", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_Exponential", BindingFlags.Static | BindingFlags.NonPublic);
}
}
static string Unity_Exponential(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = exp(In);
}
";
static string Unity_Exp(
[Slot(0, Binding.None)] DynamicDimensionVector argument,
[Slot(1, Binding.None)] out DynamicDimensionVector result)
static string Unity_Exponential2(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
result = exp(argument);
Out = exp2(In);
}
";
}

2
MaterialGraphProject/Assets/NewNodes/Editor/Kill/CheckerboardNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Procedural/Checkerboard")]
[Title("OLD/Checkerboard")]
public class CheckerboardNode : CodeFunctionNode
{
public CheckerboardNode()

2
MaterialGraphProject/Assets/NewNodes/Editor/Kill/GradientRampNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Procedural/Gradient Ramp")]
[Title("OLD/Gradient Ramp")]
public class GradientRampNode : CodeFunctionNode
{
public GradientRampNode()

4
MaterialGraphProject/Assets/NewNodes/Editor/Kill/LineNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Procedural/Line")]
[Title("OLD/Line")]
public class LineNode : CodeFunctionNode
{
public LineNode()

{precision} t = dot(aTop, aTob) / dot(aTob, aTob);
t = clamp(t, 0.0, 1.0);
{precision} d = 1.0 / length(uv - (startPoint + aTob * t));
return clamp(d, 0.0, 1.0);
result = clamp(d, 0.0, 1.0);
}";
}
}

2
MaterialGraphProject/Assets/NewNodes/Editor/Kill/PulseNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Procedural/Pulse")]
[Title("OLD/Pulse")]
public class PulseNode : CodeFunctionNode
{
public PulseNode()

2
MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVPannerNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("UV/UV Panner")]
[Title("OLD/UV Panner")]
public class PannerNode : CodeFunctionNode
{
public PannerNode()

4
MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTileNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("UV/UV Tile")]
[Title("OLD/UV Tile")]
public class UVTileNode : CodeFunctionNode
{
public UVTileNode()

return
@"
{
result uv * tileFactor;
result = uv * tileFactor;
}";
}
}

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input/Vector/Vector 1")]
[Title("Input/Basic/Vector 1")]
public const int OutputSlotId = 0;
private const string kOutputSlotName = "Out";
/*[SerializeField]
private FloatPropertyChunk.FloatType m_floatType;*/

public const int OutputSlotId = 0;
private const string kOutputSlotName = "Value";
name = "Vector1";
name = "Vector 1";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input/Vector/Vector 2")]
[Title("Input/Basic/Vector 2")]
public class Vector2Node : AbstractMaterialNode, IGeneratesBodyCode, IPropertyFromNode
{
[SerializeField]

private const string kOutputSlotName = "Value";
private const string kOutputSlotName = "Out";
name = "Vector2";
name = "Vector 2";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input/Vector/Vector 3")]
[Title("Input/Basic/Vector 3")]
public class Vector3Node : AbstractMaterialNode, IGeneratesBodyCode, IPropertyFromNode
{
[SerializeField]

private const string kOutputSlotName = "Value";
private const string kOutputSlotName = "Out";
name = "Vector3";
name = "Vector 3";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input/Vector/Vector 4")]
[Title("Input/Basic/Vector 4")]
public class Vector4Node : AbstractMaterialNode, IGeneratesBodyCode, IPropertyFromNode
{
[SerializeField]

private const string kOutputSlotName = "Value";
private const string kOutputSlotName = "Out";
name = "Vector4";
name = "Vector 4";
UpdateNodeAfterDeserialization();
}

38
MaterialGraphProject/Assets/NewNodes/Editor/Kill/SpherizeNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
/*
[Title("OLD/SpherizeOLD")]
public class SpherizeNode : CodeFunctionNode
{
public SpherizeNode()
{
name = "Spherizeold";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Spherize", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Spherize(
[Slot(0, Binding.MeshUV0)] Vector2 uv,
[Slot(1, Binding.None)] Vector2 position,
[Slot(2, Binding.None)] Vector2 radiusAndStrength,
[Slot(3, Binding.None)] out Vector2 Out)
{
Out = Vector2.zero;
return
@"
{
{precision}2 fromUVToPoint = position - uv;
{precision} dist = length(fromUVToPoint);
{precision} mag = ((1.0 - (dist / radiusAndStrength.x)) * radiusAndStrength.y) * step(dist, radiusAndStrength.x);
Out = uv + (mag * fromUVToPoint);
}";
}
}
*/
}

12
MaterialGraphProject/Assets/NewNodes/Editor/Kill/SpherizeNode.cs.meta


fileFormatVersion: 2
guid: 249d9b9165bdf234e84a85cdb8aca2aa
timeCreated: 1495555169
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

74
MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTransform.cs


using System.Reflection;
using UnityEngine;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("OLD/Transform")]
public class UVTransform : CodeFunctionNode
{
[SerializeField]
private RotationUnit m_constant = RotationUnit.Radians;
[EnumControl("")]
public RotationUnit constant
{
get { return m_constant; }
set
{
if (m_constant == value)
return;
m_constant = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
public UVTransform()
{
name = "Transform";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ScaleOffsetRotate", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ScaleOffsetRotate(
[Slot(0, Binding.MeshUV0)] Vector2 uv,
[Slot(1, Binding.None, 1f, 1f, 1f, 1f)] Vector2 scale,
[Slot(2, Binding.None)] Vector2 offset,
[Slot(3, Binding.None)] Vector1 rotation,
[Slot(4, Binding.None)] out Vector2 result)
{
result = Vector2.zero;
return
@"
{
uv -= offset;
{precision} s = sin(rotation);
{precision} c = cos(rotation);
//center rotation matrix
{precision}2x2 rMatrix = float2x2(c, -s, s, c);
rMatrix *= 0.5;
rMatrix += 0.5;
rMatrix = rMatrix*2 - 1;
//multiply the UVs by the rotation matrix
uv.xy = mul(uv.xy, rMatrix);
uv += offset;
float4 xform = float4(scale, offset + offset - offset * scale);
result = uv * xform.xy + xform.zw;
}
";
}
}
}

11
MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTransform.cs.meta


fileFormatVersion: 2
guid: 24a04c4279e1baf46a98939f82dd7206
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

7
MaterialGraphProject/Assets/SRP/PostProcessing/LICENSE.meta


fileFormatVersion: 2
guid: 43962434dbfd3ea40af2ea7add0c2aa6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
MaterialGraphProject/Assets/SRP/PostProcessing/PostProcessing.meta


fileFormatVersion: 2
guid: dadb3ccc226c9c84a97777dbcbb0223f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

7
MaterialGraphProject/Assets/SRP/PostProcessing/README.md.meta


fileFormatVersion: 2
guid: 03a6615db00fb6043834d5363972c41f
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

7
MaterialGraphProject/Assets/SRP/PostProcessing/package.json.meta


fileFormatVersion: 2
guid: 9d96f64353b62874bbd5efae54087728
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic.meta


fileFormatVersion: 2
guid: b43ef3944c134a74995e6582de94d21b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentVectorNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Bitangent Vector")]
public class BitangentVectorNode : GeometryNode, IMayRequireBitangent
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public BitangentVectorNode()
{
name = "Bitangent Vector";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.BiTangent);
}
public NeededCoordinateSpace RequiresBitangent()
{
return space.ToNeededCoordinateSpace();
}
}
}

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalVectorNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Normal Vector")]
public class NormalVectorNode : GeometryNode, IMayRequireNormal
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public NormalVectorNode()
{
name = "Normal Vector";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.Normal);
}
public NeededCoordinateSpace RequiresNormal()
{
return space.ToNeededCoordinateSpace();
}
}
}

97
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/ScreenPositionNode.cs


using System.Reflection;
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
namespace UnityEditor.ShaderGraph
{
public interface IMayRequireScreenPosition
{
bool RequiresScreenPosition();
}
public enum ScreenSpaceType
{
Default,
Center,
Tiled
};
[Title("Input/Geometry/Screen Position")]
public class ScreenPositionNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireScreenPosition
{
public ScreenPositionNode()
{
name = "Screen Position";
UpdateNodeAfterDeserialization();
}
[SerializeField]
private ScreenSpaceType m_ScreenSpaceType = ScreenSpaceType.Default;
[EnumControl("")]
public ScreenSpaceType screenSpaceType
{
get { return m_ScreenSpaceType; }
set
{
if (m_ScreenSpaceType == value)
return;
m_ScreenSpaceType = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
string GetCurrentType()
{
return System.Enum.GetName(typeof(ScreenSpaceType), m_ScreenSpaceType);
}
private const int kOutputSlot1Id = 0;
private const string kOutputSlot1Name = "Out";
public override bool hasPreview { get { return true; } }
public override PreviewMode previewMode
{
get { return PreviewMode.Preview2D; }
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector2MaterialSlot(kOutputSlot1Id, kOutputSlot1Name, kOutputSlot1Name, SlotType.Output, Vector2.zero));
RemoveSlotsNameNotMatching(new[] { kOutputSlot1Id });
}
public override string GetVariableNameForSlot(int slotId)
{
return ShaderGeneratorNames.ScreenPosition;
}
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
switch (m_ScreenSpaceType)
{
case ScreenSpaceType.Center:
visitor.AddShaderChunk(string.Format("{0} = {1};", ShaderGeneratorNames.ScreenPosition, "float4((" + ShaderGeneratorNames.ScreenPosition + ".xy / " + ShaderGeneratorNames.ScreenPosition + ".w) * 2 - 1, 0, 0)"), false);
break;
case ScreenSpaceType.Tiled:
visitor.AddShaderChunk(string.Format("{0} = {1};", ShaderGeneratorNames.ScreenPosition, "float4((" + ShaderGeneratorNames.ScreenPosition + ".xy / " + ShaderGeneratorNames.ScreenPosition + ".w) * 2 - 1, 0, 0)"), false);
visitor.AddShaderChunk(string.Format("{0} = {1};", ShaderGeneratorNames.ScreenPosition, "float4(" + ShaderGeneratorNames.ScreenPosition + ".x * _ScreenParams.x / _ScreenParams.y, " + ShaderGeneratorNames.ScreenPosition + ".y, 0, 0)"), false);
break;
default:
visitor.AddShaderChunk(string.Format("{0} = {1};", ShaderGeneratorNames.ScreenPosition, "float4(" + ShaderGeneratorNames.ScreenPosition + ".xy / " + ShaderGeneratorNames.ScreenPosition + ".w, 0, 0)"), false);
break;
}
}
public bool RequiresScreenPosition()
{
return true;
}
}
}

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentVectorNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Tangent Vector")]
public class TangentVectorNode : GeometryNode, IMayRequireTangent
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public TangentVectorNode()
{
name = "Tangent Vector";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.Tangent);
}
public NeededCoordinateSpace RequiresTangent()
{
return space.ToNeededCoordinateSpace();
}
}
}

83
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/TransformationMatrixNode.cs


using System.ComponentModel;
using UnityEditor.Graphing;
using System.Collections.Generic;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
public enum TransformationMatrixType
{
ModelView,
View,
Projection,
ViewProjection,
TransposeModelView,
InverseTransposeModelView,
ObjectToWorld,
WorldToObject
};
[Title("Input/Matrix/Transformation Matrix")]
public class TransformationMatrixNode : AbstractMaterialNode
{
static Dictionary<TransformationMatrixType, string> m_matrixList = new Dictionary<TransformationMatrixType, string>
{
{TransformationMatrixType.ModelView, "UNITY_MATRIX_MV"},
{TransformationMatrixType.View, "UNITY_MATRIX_V"},
{TransformationMatrixType.Projection, "UNITY_MATRIX_P"},
{TransformationMatrixType.ViewProjection, "UNITY_MATRIX_VP"},
{TransformationMatrixType.TransposeModelView, "UNITY_MATRIX_T_MV"},
{TransformationMatrixType.InverseTransposeModelView, "UNITY_MATRIX_IT_MV"},
{TransformationMatrixType.ObjectToWorld, "unity_ObjectToWorld"},
{TransformationMatrixType.WorldToObject, "unity_WorldToObject"},
};
[SerializeField]
private TransformationMatrixType m_matrix = TransformationMatrixType.ModelView;
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "Out";
public override bool hasPreview { get { return false; } }
[EnumControl("")]
public TransformationMatrixType matrix
{
get { return m_matrix; }
set
{
if (m_matrix == value)
return;
m_matrix = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
public TransformationMatrixNode()
{
name = "Transformation Matrix";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Matrix4MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return m_matrixList[matrix];
}
public bool RequiresVertexColor()
{
return true;
}
}
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Delete.meta


fileFormatVersion: 2
guid: 394a8fe944cfd6b488bf5491e4622c7b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

67
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DAssetNode.cs


using System.Collections.Generic;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Texture/Texture 2D Asset")]
public class Texture2DAssetNode : AbstractMaterialNode
{
public const int OutputSlotId = 0;
const string kOutputSlotName = "Out";
public Texture2DAssetNode()
{
name = "Texture 2D Asset";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Texture2DMaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output));
RemoveSlotsNameNotMatching(new[] { OutputSlotId });
}
[SerializeField]
private SerializableTexture m_Texture = new SerializableTexture();
[TextureControl("")]
public Texture texture
{
get { return m_Texture.texture; }
set
{
if (m_Texture.texture == value)
return;
m_Texture.texture = value;
if (onModified != null)
{
onModified(this, ModificationScope.Node);
}
}
}
public override void CollectShaderProperties(PropertyCollector properties, GenerationMode generationMode)
{
properties.AddShaderProperty(new TextureShaderProperty()
{
overrideReferenceName = GetVariableNameForSlot(OutputSlotId),
generatePropertyBlock = true,
value = m_Texture,
modifiable = false
});
}
public override void CollectPreviewMaterialProperties(List<PreviewProperty> properties)
{
properties.Add(new PreviewProperty
{
m_Name = GetVariableNameForSlot(OutputSlotId),
m_PropType = PropertyType.Texture,
m_Texture = texture
});
}
}
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DAssetNode.cs.meta


fileFormatVersion: 2
guid: 9c629b78a2ec57749ab4f76f4f42f423
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ModuloNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Advanced/Modulo")]
public class ModuloNode : CodeFunctionNode
{
public ModuloNode()
{
name = "Modulo";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Modulo", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Modulo(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = fmod(A, B);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalSquareRootNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Advanced/Reciprocal Square Root")]
public class ReciprocalSquareRootNode : CodeFunctionNode
{
public ReciprocalSquareRootNode()
{
name = "Reciprocal Square Root";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Rsqrt", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Rsqrt(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = rsqrt(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/DivideNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Basic/Divide")]
public class DivideNode : CodeFunctionNode
{
public DivideNode()
{
name = "Divide";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Divide", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Divide(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return @"
{
Out = A / B;
}
";
}
}
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative.meta


fileFormatVersion: 2
guid: c10838deaed74574a94a340e53c2b229
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/SmoothstepNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Interpolation/Smoothstep")]
class SmoothstepNode : CodeFunctionNode
{
public SmoothstepNode()
{
name = "Smoothstep";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Smoothstep", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Smoothstep(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] DynamicDimensionVector T,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = smoothstep(A, B, T);
}";
}
}
}

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/MaximumNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Range/Maximum")]
public class MaximumNode : CodeFunctionNode
{
public MaximumNode()
{
name = "Maximum";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Maximum", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Maximum(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = max(A, B);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/MinimumNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Range/Minimum")]
public class MinimumNode : CodeFunctionNode
{
public MinimumNode()
{
name = "Minimum";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Minimum", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Minimum(
[Slot(0, Binding.None, 1, 1, 1, 1)] DynamicDimensionVector A,
[Slot(1, Binding.None, 1, 1, 1, 1)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = min(A, B);
};";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/OneMinusNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Range/One Minus")]
public class OneMinusNode : CodeFunctionNode
{
public OneMinusNode()
{
name = "One Minus";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_OneMinus", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_OneMinus(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = 1 - In;
}
";
}
}
}

32
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/RandomRangeNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Range/Random Range")]
public class RandomRangeNode : CodeFunctionNode
{
public RandomRangeNode()
{
name = "Random Range";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_RandomRange", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_RandomRange(
[Slot(0, Binding.None)] Vector1 Seed,
[Slot(1, Binding.None)] Vector1 Min,
[Slot(2, Binding.None, 1, 1, 1, 1)] Vector1 Max,
[Slot(3, Binding.None)] out Vector1 Out)
{
return
@"
{
{precision} randomno = frac(sin(dot({precision}2(Seed, Seed), float2(12.9898, 78.233)))*43758.5453);
Out = floor(randomno * (Max - Min + 1)) + Min;
}";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/CeilingNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Round/Ceiling")]
public class CeilingNode : CodeFunctionNode
{
public CeilingNode()
{
name = "Ceiling";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Ceiling", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Ceiling(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = ceil(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArccosineNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Arccosine")]
public class ArccosineNode : CodeFunctionNode
{
public ArccosineNode()
{
name = "Arccosine";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Arccosine", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Arccosine(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = acos(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcsineNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Arcsine")]
public class ArcsineNode : CodeFunctionNode
{
public ArcsineNode()
{
name = "Arcsine";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Arcsine", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Arcsine(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = asin(In);
}
";
}
}
}

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/Arctangent2Node.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Arctangent2")]
public class Arctangent2Node : CodeFunctionNode
{
public Arctangent2Node()
{
name = "Arctangent2";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Arctangent2", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Arctangent2(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = atan2(A, B);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArctangentNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Arctangent")]
public class ArctangentNode : CodeFunctionNode
{
public ArctangentNode()
{
name = "Arctangent";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Arctangent", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Arctangent(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = atan(In);
}
";
}
}
}

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存