浏览代码

Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017

/main
Matt Dean 8 年前
当前提交
cf30e087
共有 40 个文件被更改,包括 1810 次插入249 次删除
  1. 989
      MaterialGraphProject/Assets/TestAssets/ColorGuide.tif
  2. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/TimeNode.cs
  3. 340
      MaterialGraphProject/Assets/Matt&Andre/CubemapNode.cs
  4. 13
      MaterialGraphProject/Assets/Brandon/ATan2Node.cs
  5. 12
      MaterialGraphProject/Assets/Brandon/ATan2Node.cs.meta
  6. 13
      MaterialGraphProject/Assets/Brandon/ArcCosNode.cs
  7. 12
      MaterialGraphProject/Assets/Brandon/ArcCosNode.cs.meta
  8. 13
      MaterialGraphProject/Assets/Brandon/ArcSinNode.cs
  9. 12
      MaterialGraphProject/Assets/Brandon/ArcSinNode.cs.meta
  10. 13
      MaterialGraphProject/Assets/Brandon/ArcTanNode.cs
  11. 12
      MaterialGraphProject/Assets/Brandon/ArcTanNode.cs.meta
  12. 65
      MaterialGraphProject/Assets/Brandon/CartesianToPolarNode.cs
  13. 12
      MaterialGraphProject/Assets/Brandon/CartesianToPolarNode.cs.meta
  14. 63
      MaterialGraphProject/Assets/Brandon/CheckerboardNode.cs
  15. 12
      MaterialGraphProject/Assets/Brandon/CheckerboardNode.cs.meta
  16. 13
      MaterialGraphProject/Assets/Brandon/CosNode.cs
  17. 12
      MaterialGraphProject/Assets/Brandon/CosNode.cs.meta
  18. 13
      MaterialGraphProject/Assets/Brandon/CrossNode.cs
  19. 12
      MaterialGraphProject/Assets/Brandon/CrossNode.cs.meta
  20. 13
      MaterialGraphProject/Assets/Brandon/DegreesToRadiansNode.cs
  21. 12
      MaterialGraphProject/Assets/Brandon/DegreesToRadiansNode.cs.meta
  22. 58
      MaterialGraphProject/Assets/Brandon/GradientRampNode.cs
  23. 12
      MaterialGraphProject/Assets/Brandon/GradientRampNode.cs.meta
  24. 58
      MaterialGraphProject/Assets/Brandon/HexNode.cs
  25. 12
      MaterialGraphProject/Assets/Brandon/HexNode.cs.meta
  26. 57
      MaterialGraphProject/Assets/Brandon/ParticleNode.cs
  27. 12
      MaterialGraphProject/Assets/Brandon/ParticleNode.cs.meta
  28. 13
      MaterialGraphProject/Assets/Brandon/RadiansToDegreesNode.cs
  29. 12
      MaterialGraphProject/Assets/Brandon/RadiansToDegreesNode.cs.meta
  30. 29
      MaterialGraphProject/Assets/Brandon/ReciprocalNode.cs
  31. 12
      MaterialGraphProject/Assets/Brandon/ReciprocalNode.cs.meta
  32. 13
      MaterialGraphProject/Assets/Brandon/SinCosNode.cs
  33. 12
      MaterialGraphProject/Assets/Brandon/SinCosNode.cs.meta
  34. 13
      MaterialGraphProject/Assets/Brandon/TanNode.cs
  35. 12
      MaterialGraphProject/Assets/Brandon/TanNode.cs.meta
  36. 56
      MaterialGraphProject/Assets/Brandon/UVTileNode.cs
  37. 12
      MaterialGraphProject/Assets/Brandon/UVTileNode.cs.meta
  38. 0
      /MaterialGraphProject/Assets/Matt&Andre/CubemapNode.cs
  39. 0
      /MaterialGraphProject/Assets/Matt&Andre/CubemapNode.cs.meta

989
MaterialGraphProject/Assets/TestAssets/ColorGuide.tif
文件差异内容过多而无法显示
查看文件

10
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/TimeNode.cs


public class TimeNode : AbstractMaterialNode, IRequiresTime
{
private const string kOutputSlotName = "Time";
private const string kOutputSlotNameX = "Time.x";
private const string kOutputSlotNameY = "Time.y";
private const string kOutputSlotNameZ = "Time.z";
private const string kOutputSlotNameW = "Time.w";
private const string kOutputSlotNameX = "Time/20";
private const string kOutputSlotNameY = "Time";
private const string kOutputSlotNameZ = "Time * 2";
private const string kOutputSlotNameW = "Time * 3";
public const int OutputSlotId = 0;
public const int OutputSlotIdX = 1;

protected int[] validSlots
{
get { return new[] {OutputSlotId, OutputSlotIdX, OutputSlotIdY, OutputSlotIdZ, OutputSlotId}; }
get { return new[] {OutputSlotId, OutputSlotIdX, OutputSlotIdY, OutputSlotIdZ, OutputSlotIdW}; }
}
public override string GetVariableNameForSlot(int slotId)

340
MaterialGraphProject/Assets/Matt&Andre/CubemapNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Input/Cubemap")]
public class CubemapNode : PropertyNode, IGeneratesBodyCode, IMayRequireMeshUV
{
protected const string kUVSlotName = "Refl";
protected const string kOutputSlotRGBAName = "RGBA";
protected const string kOutputSlotRName = "R";
protected const string kOutputSlotGName = "G";
protected const string kOutputSlotBName = "B";
protected const string kOutputSlotAName = "A";
[Title("Input/Cubemap")]
public class CubemapNode : PropertyNode, IGeneratesBodyCode, IMayRequireMeshUV
{
protected const string kUVSlotName = "Refl";
protected const string kOutputSlotRGBAName = "RGBA";
protected const string kOutputSlotRName = "R";
protected const string kOutputSlotGName = "G";
protected const string kOutputSlotBName = "B";
protected const string kOutputSlotAName = "A";
public const int UvSlotId = 0;
public const int OutputSlotRgbaId = 1;
public const int OutputSlotRId = 2;
public const int OutputSlotGId = 3;
public const int OutputSlotBId = 4;
public const int OutputSlotAId = 5;
public const int UvSlotId = 0;
public const int OutputSlotRgbaId = 1;
public const int OutputSlotRId = 2;
public const int OutputSlotGId = 3;
public const int OutputSlotBId = 4;
public const int OutputSlotAId = 5;
[SerializeField]
private string m_SerializedCube;
[SerializeField]
private string m_SerializedCube;
//private TextureType m_TextureType;
//private TextureType m_TextureType;
[Serializable]
private class CubemapHelper
{
[Serializable]
private class CubemapHelper
{
}
}
public override bool hasPreview { get { return true; } }
public override bool hasPreview { get { return true; } }
#if UNITY_EDITOR
#if UNITY_EDITOR
{
get
{
if (string.IsNullOrEmpty(m_SerializedCube))
return null;
{
get
{
if (string.IsNullOrEmpty(m_SerializedCube))
return null;
var tex = new CubemapHelper();
EditorJsonUtility.FromJsonOverwrite(m_SerializedCube, tex);
return tex.cube;
}
set
{
if (defaultCube == value)
return;
var tex = new CubemapHelper();
EditorJsonUtility.FromJsonOverwrite(m_SerializedCube, tex);
return tex.cube;
}
set
{
if (defaultCube == value)
return;
var tex = new CubemapHelper();
tex.cube = value;
m_SerializedCube = EditorJsonUtility.ToJson(tex, true);
var tex = new CubemapHelper();
tex.cube = value;
m_SerializedCube = EditorJsonUtility.ToJson(tex, true);
if (onModified != null)
{
onModified(this, ModificationScope.Node);
}
}
}
#else
if (onModified != null)
{
onModified(this, ModificationScope.Node);
}
}
}
#else
#endif
#endif
/*public TextureType textureType
{
get { return m_TextureType; }
set
{
if (m_TextureType == value)
return;
public CubemapNode()
{
name = "Cubemap";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(OutputSlotRgbaId, kOutputSlotRGBAName, kOutputSlotRGBAName, SlotType.Output, SlotValueType.Vector4, Vector4.zero));
AddSlot(new MaterialSlot(OutputSlotRId, kOutputSlotRName, kOutputSlotRName, SlotType.Output, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(OutputSlotGId, kOutputSlotGName, kOutputSlotGName, SlotType.Output, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(OutputSlotBId, kOutputSlotBName, kOutputSlotBName, SlotType.Output, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(OutputSlotAId, kOutputSlotAName, kOutputSlotAName, SlotType.Output, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(UvSlotId, kUVSlotName, kUVSlotName, SlotType.Input, SlotValueType.Vector3, Vector3.zero, false));
RemoveSlotsNameNotMatching(validSlots);
}
m_TextureType = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}*/
public CubemapNode()
{
name = "Cubemap";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(OutputSlotRgbaId, kOutputSlotRGBAName, kOutputSlotRGBAName, SlotType.Output, SlotValueType.Vector4, Vector4.zero));
AddSlot(new MaterialSlot(OutputSlotRId, kOutputSlotRName, kOutputSlotRName, SlotType.Output, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(OutputSlotGId, kOutputSlotGName, kOutputSlotGName, SlotType.Output, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(OutputSlotBId, kOutputSlotBName, kOutputSlotBName, SlotType.Output, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(OutputSlotAId, kOutputSlotAName, kOutputSlotAName, SlotType.Output, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(UvSlotId, kUVSlotName, kUVSlotName, SlotType.Input, SlotValueType.Vector3, Vector3.zero, false));
RemoveSlotsNameNotMatching(validSlots);
}
protected int[] validSlots
{
get { return new[] {OutputSlotRgbaId, OutputSlotRId, OutputSlotGId, OutputSlotBId, OutputSlotAId, UvSlotId}; }
}
// Node generations
public virtual void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
var uvSlot = FindInputSlot<MaterialSlot>(UvSlotId);
if (uvSlot == null)
return;
var uvName = string.Format("{0}.xyz", UVChannel.uv0.GetUVName());
var edges = owner.GetEdges(uvSlot.slotReference).ToList();
if (edges.Count > 0)
{
var edge = edges[0];
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(edge.outputSlot.nodeGuid);
uvName = ShaderGenerator.AdaptNodeOutput(fromNode, edge.outputSlot.slotId, ConcreteSlotValueType.Vector3, true);
}
string body = "texCUBE (" + propertyName + ", " + uvName + ")";
visitor.AddShaderChunk(precision + "4 " + GetVariableNameForNode() + " = " + body + ";", true);
}
public override PreviewMode previewMode {
get {
return PreviewMode.Preview3D;
}
}
public override string GetVariableNameForSlot(int slotId)
{
string slotOutput;
switch (slotId)
{
case OutputSlotRId:
slotOutput = ".r";
break;
case OutputSlotGId:
slotOutput = ".g";
break;
case OutputSlotBId:
slotOutput = ".b";
break;
case OutputSlotAId:
slotOutput = ".a";
break;
default:
slotOutput = "";
break;
}
return GetVariableNameForNode() + slotOutput;
}
protected int[] validSlots
{
get { return new[] {OutputSlotRgbaId, OutputSlotRId, OutputSlotGId, OutputSlotBId, OutputSlotAId, UvSlotId}; }
}
public override void CollectPreviewMaterialProperties(List<PreviewProperty> properties)
{
properties.Add(GetPreviewProperty());
}
// Node generations
public virtual void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
var uvSlot = FindInputSlot<MaterialSlot>(UvSlotId);
if (uvSlot == null)
return;
// Properties
public override void GeneratePropertyBlock(PropertyGenerator visitor, GenerationMode generationMode)
{
visitor.AddShaderProperty(
new CubemapPropertyChunk(
propertyName,
description,
defaultCube,
PropertyChunk.HideState.Visible,
exposedState == ExposedState.Exposed ?
CubemapPropertyChunk.ModifiableState.Modifiable
: CubemapPropertyChunk.ModifiableState.NonModifiable));
}
var uvName = string.Format("{0}.xyz", UVChannel.uv0.GetUVName());
var edges = owner.GetEdges(uvSlot.slotReference).ToList();
public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode)
{
visitor.AddShaderChunk("samplerCUBE " + propertyName + ";", true);
}
if (edges.Count > 0)
{
var edge = edges[0];
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(edge.outputSlot.nodeGuid);
uvName = ShaderGenerator.AdaptNodeOutput(fromNode, edge.outputSlot.slotId, ConcreteSlotValueType.Vector3, true);
}
/*
public override bool DrawSlotDefaultInput(Rect rect, Slot inputSlot)
{
var uvSlot = FindInputSlot(kUVSlotName);
if (uvSlot != inputSlot)
return base.DrawSlotDefaultInput(rect, inputSlot);
string body = "texCUBE (" + propertyName + ", " + uvName + ")";
visitor.AddShaderChunk(precision + "4 " + GetVariableNameForNode() + " = " + body + ";", true);
}
public override string GetVariableNameForSlot(int slotId)
{
string slotOutput;
switch (slotId)
{
case OutputSlotRId:
slotOutput = ".r";
break;
case OutputSlotGId:
slotOutput = ".g";
break;
case OutputSlotBId:
slotOutput = ".b";
break;
case OutputSlotAId:
slotOutput = ".a";
break;
default:
slotOutput = "";
break;
}
return GetVariableNameForNode() + slotOutput;
}
var rectXmax = rect.xMax;
rect.x = rectXmax - 70;
rect.width = 70;
public override void CollectPreviewMaterialProperties(List<PreviewProperty> properties)
{
properties.Add(GetPreviewProperty());
}
EditorGUI.DrawRect(rect, new Color(0.0f, 0.0f, 0.0f, 0.7f));
GUI.Label(rect, "From Mesh");
// Properties
public override void GeneratePropertyBlock(PropertyGenerator visitor, GenerationMode generationMode)
{
visitor.AddShaderProperty(
new CubemapPropertyChunk(
propertyName,
description,
defaultCube,
PropertyChunk.HideState.Visible,
exposedState == ExposedState.Exposed ?
CubemapPropertyChunk.ModifiableState.Modifiable
: CubemapPropertyChunk.ModifiableState.NonModifiable));
}
return false;
}
*/
public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode)
{
visitor.AddShaderChunk("samplerCUBE " + propertyName + ";", true);
}
public override PreviewProperty GetPreviewProperty()
{
return new PreviewProperty
{
m_Name = propertyName,
m_PropType = PropertyType.Cubemap,
m_Cubemap = defaultCube
};
}
public override PreviewProperty GetPreviewProperty()
{
return new PreviewProperty
{
m_Name = propertyName,
m_PropType = PropertyType.Cubemap,
m_Cubemap = defaultCube
};
}
public bool RequiresMeshUV(UVChannel channel)
{
if (channel != UVChannel.uv0)
{
return false;
}
public bool RequiresMeshUV(UVChannel channel)
{
if (channel != UVChannel.uv0)
{
return false;
}
var uvSlot = FindInputSlot<MaterialSlot>(UvSlotId);
if (uvSlot == null)
return true;
var uvSlot = FindInputSlot<MaterialSlot>(UvSlotId);
if (uvSlot == null)
return true;
var edges = owner.GetEdges(uvSlot.slotReference).ToList();
return edges.Count == 0;
}
}
var edges = owner.GetEdges(uvSlot.slotReference).ToList();
return edges.Count == 0;
}
}
}

13
MaterialGraphProject/Assets/Brandon/ATan2Node.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/ArcTan2 Node")]
public class ATan2Node : Function2Input
{
public ATan2Node()
{
name = "ATan2Node";
}
protected override string GetFunctionName() { return "atan2"; }
}
}

12
MaterialGraphProject/Assets/Brandon/ATan2Node.cs.meta


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

13
MaterialGraphProject/Assets/Brandon/ArcCosNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/ArcCos Node")]
public class ACosNode : Function1Input
{
public ACosNode()
{
name = "ACosNode";
}
protected override string GetFunctionName() { return "acos"; }
}
}

12
MaterialGraphProject/Assets/Brandon/ArcCosNode.cs.meta


fileFormatVersion: 2
guid: 455566eec6487b04e92c32110f05073a
timeCreated: 1495459453
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
MaterialGraphProject/Assets/Brandon/ArcSinNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/ArcSin Node")]
public class ASinNode : Function1Input
{
public ASinNode()
{
name = "ASinNode";
}
protected override string GetFunctionName() { return "asin"; }
}
}

12
MaterialGraphProject/Assets/Brandon/ArcSinNode.cs.meta


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

13
MaterialGraphProject/Assets/Brandon/ArcTanNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/ArcTan Node")]
public class ATanNode : Function1Input
{
public ATanNode()
{
name = "ATanNode";
}
protected override string GetFunctionName() { return "atan"; }
}
}

12
MaterialGraphProject/Assets/Brandon/ArcTanNode.cs.meta


fileFormatVersion: 2
guid: 9db0fbefda58761488455432f3133271
timeCreated: 1495459625
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

65
MaterialGraphProject/Assets/Brandon/CartesianToPolarNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("UV/Cartesian To Polar Node")]
public class CartesianToPolarNode : Function3Input, IGeneratesFunction
{
public CartesianToPolarNode()
{
name = "CartesianToPolarNode";
}
protected override string GetFunctionName()
{
return "unity_cartesiantopolar_" + precision;
}
protected override string GetInputSlot1Name()
{
return "UV";
}
protected override string GetInputSlot2Name()
{
return "HorizontalTileScale";
}
protected override string GetInputSlot3Name()
{
return "VerticalTileScale";
}
protected override MaterialSlot GetInputSlot1()
{
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero);
}
protected override MaterialSlot GetInputSlot2()
{
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero);
}
protected override MaterialSlot GetInputSlot3()
{
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero);
}
protected override MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector2, Vector2.zero);
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("uv", "horizontalTileScale", "verticalTileScale"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float radius = length(uv);", false);
outputString.AddShaderChunk("float angle = atan2(uv.x, uv.y);", false);
outputString.AddShaderChunk("return float2(radius, angle);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Brandon/CartesianToPolarNode.cs.meta


fileFormatVersion: 2
guid: 254f958f2febf5e42811f813c866bb2e
timeCreated: 1495464810
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

63
MaterialGraphProject/Assets/Brandon/CheckerboardNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Checkerboard Node")]
public class CheckerboardNode : Function3Input, IGeneratesFunction
{
public CheckerboardNode()
{
name = "CheckerboardNode";
}
protected override string GetFunctionName()
{
return "unity_checkerboard_" + precision;
}
protected override string GetInputSlot1Name()
{
return "UV";
}
protected override string GetInputSlot2Name()
{
return "HorizontalTileScale";
}
protected override string GetInputSlot3Name()
{
return "VerticalTileScale";
}
protected override MaterialSlot GetInputSlot1()
{
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero);
}
protected override MaterialSlot GetInputSlot2()
{
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero);
}
protected override MaterialSlot GetInputSlot3()
{
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero);
}
protected override MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero);
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("uv", "horizontalTileScale", "verticalTileScale"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return floor(fmod(floor(uv.x * horizontalTileScale) + floor(uv.y * verticalTileScale), 2.0)) * float4(1.0, 1.0, 1.0, 1.0);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Brandon/CheckerboardNode.cs.meta


fileFormatVersion: 2
guid: 33d3c277f991d6749b4a8ace52c6d7b9
timeCreated: 1495448360
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
MaterialGraphProject/Assets/Brandon/CosNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/Cos Node")]
public class CosNode : Function1Input
{
public CosNode()
{
name = "CosNode";
}
protected override string GetFunctionName() { return "cos"; }
}
}

12
MaterialGraphProject/Assets/Brandon/CosNode.cs.meta


fileFormatVersion: 2
guid: 27c8eab8410ea16418392d646ec92572
timeCreated: 1495446924
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
MaterialGraphProject/Assets/Brandon/CrossNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Vector/Cross Node")]
public class CrossNode : Function2Input
{
public CrossNode()
{
name = "CrossNode";
}
protected override string GetFunctionName() { return "cross"; }
}
}

12
MaterialGraphProject/Assets/Brandon/CrossNode.cs.meta


fileFormatVersion: 2
guid: 6a69c68bb4c22d840b464885246650a3
timeCreated: 1495446521
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
MaterialGraphProject/Assets/Brandon/DegreesToRadiansNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/Degrees To Radians Node")]
public class DegreesToRadiansNode : Function1Input
{
public DegreesToRadiansNode()
{
name = "DegreesToRadians";
}
protected override string GetFunctionName() { return "radians"; }
}
}

12
MaterialGraphProject/Assets/Brandon/DegreesToRadiansNode.cs.meta


fileFormatVersion: 2
guid: 30f44257fb54ebf48908aef7ecc9b285
timeCreated: 1495459878
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

58
MaterialGraphProject/Assets/Brandon/GradientRampNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Gradient Ramp Node")]
public class GradientRampNode : Function2Input, IGeneratesFunction
{
public GradientRampNode()
{
name = "GradientRampNode";
}
protected override string GetFunctionName()
{
return "unitygGradientramp_" + precision;
}
protected override string GetInputSlot1Name()
{
return "UV";
}
protected override string GetInputSlot2Name()
{
return "Stripe Count";
}
protected override MaterialSlot GetInputSlot1()
{
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector4.zero);
}
protected override MaterialSlot GetInputSlot2()
{
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero);
}
protected override MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero);
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("uv", "stripeCount"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float widthOfEachStripe = 1.0 / stripeCount;", false);
outputString.AddShaderChunk("float t = fmod(floor(uv.x / widthOfEachStripe), stripeCount);", false);
outputString.AddShaderChunk("return lerp(0.0, 1.0, t / (stripeCount - 1.0));", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Brandon/GradientRampNode.cs.meta


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

58
MaterialGraphProject/Assets/Brandon/HexNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Hex Node")]
public class HexNode : Function2Input, IGeneratesFunction
{
public HexNode()
{
name = "HexNode";
}
protected override string GetFunctionName()
{
return "unity_hex_" + precision;
}
protected override string GetInputSlot1Name()
{
return "UV";
}
protected override MaterialSlot GetInputSlot1()
{
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Dynamic, Vector4.zero);
}
protected override string GetInputSlot2Name()
{
return "Thickness";
}
protected override MaterialSlot GetInputSlot2()
{
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero);
}
protected override MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero);
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("uv", "thickness"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("uv.y += fmod(floor(uv.x), 2.0) * 0.5;", false);
outputString.AddShaderChunk("uv = abs(frac(uv) - 0.5);", false);
outputString.AddShaderChunk("return step(thickness, abs(max(uv.x * 1.5 + uv.y, uv.y * 2.0) - 1.0));", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Brandon/HexNode.cs.meta


fileFormatVersion: 2
guid: 98787001c1c5ac14588e5d2eb427aea8
timeCreated: 1495456895
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

57
MaterialGraphProject/Assets/Brandon/ParticleNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Particle Node")]
public class ParticleNode : Function2Input, IGeneratesFunction
{
public ParticleNode()
{
name = "ParticleNode";
}
protected override string GetFunctionName()
{
return "unity_particle_" + precision;
}
protected override string GetInputSlot1Name()
{
return "UV";
}
protected override string GetInputSlot2Name()
{
return "ScaleFactor";
}
protected override MaterialSlot GetInputSlot1()
{
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero);
}
protected override MaterialSlot GetInputSlot2()
{
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector2.zero);
}
protected override MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero);
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("uv", "scaleFactor"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("uv = uv * 2.0 - 1.0;", false);
outputString.AddShaderChunk("return abs(1.0/length(uv * scaleFactor));", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Brandon/ParticleNode.cs.meta


fileFormatVersion: 2
guid: 445f6145066270045930268f04f7f296
timeCreated: 1495470132
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
MaterialGraphProject/Assets/Brandon/RadiansToDegreesNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/Radians To Degrees Node")]
public class RadiansToDegreesNode : Function1Input
{
public RadiansToDegreesNode()
{
name = "RadiansToDegrees";
}
protected override string GetFunctionName() { return "degrees"; }
}
}

12
MaterialGraphProject/Assets/Brandon/RadiansToDegreesNode.cs.meta


fileFormatVersion: 2
guid: 3673593934a8a544294ca6398a7cc6cb
timeCreated: 1495460178
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

29
MaterialGraphProject/Assets/Brandon/ReciprocalNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Advanced/Reciprocal Node")]
public class ReciprocalNode : Function1Input, IGeneratesFunction
{
public ReciprocalNode()
{
name = "ReciprocalNode";
}
protected override string GetFunctionName()
{
return "unity_reciprocal_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return 1.0/arg1;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Brandon/ReciprocalNode.cs.meta


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

13
MaterialGraphProject/Assets/Brandon/SinCosNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/SinCos Node")]
public class SinCosNode : Function1Input
{
public SinCosNode()
{
name = "SinCosNode";
}
protected override string GetFunctionName() { return "cos"; }
}
}

12
MaterialGraphProject/Assets/Brandon/SinCosNode.cs.meta


fileFormatVersion: 2
guid: 61e8adbfbb5cd244fa9bb6dcc900b2bc
timeCreated: 1495447065
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
MaterialGraphProject/Assets/Brandon/TanNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/Tan Node")]
public class TanNode : Function1Input
{
public TanNode()
{
name = "TanNode";
}
protected override string GetFunctionName() { return "tan"; }
}
}

12
MaterialGraphProject/Assets/Brandon/TanNode.cs.meta


fileFormatVersion: 2
guid: 217bab274e1af304daceecaf52863882
timeCreated: 1495446976
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

56
MaterialGraphProject/Assets/Brandon/UVTileNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("UV/Tile Node")]
public class UVTileNode : Function2Input, IGeneratesFunction
{
public UVTileNode()
{
name = "UVTileNode";
}
protected override string GetFunctionName()
{
return "unity_uvtile_" + precision;
}
protected override string GetInputSlot1Name()
{
return "UV";
}
protected override MaterialSlot GetInputSlot1()
{
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero);
}
protected override string GetInputSlot2Name()
{
return "Tile Factor (X,Y)";
}
protected override MaterialSlot GetInputSlot2()
{
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero);
}
protected override MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector2, Vector2.zero);
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("uv", "tileFactor"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return uv * tileFactor;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Brandon/UVTileNode.cs.meta


fileFormatVersion: 2
guid: 9de1e3a9c41ab2e4d9547aa844abb327
timeCreated: 1495462112
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

/MaterialGraphProject/Assets/CubemapNode.cs → /MaterialGraphProject/Assets/Matt&Andre/CubemapNode.cs

/MaterialGraphProject/Assets/CubemapNode.cs.meta → /MaterialGraphProject/Assets/Matt&Andre/CubemapNode.cs.meta

正在加载...
取消
保存