浏览代码

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

/main
Florent Guinier 8 年前
当前提交
ec474be5
共有 253 个文件被更改,包括 2360 次插入139 次删除
  1. 11
      MaterialGraphProject/Assets/Andre/New Material.mat
  2. 2
      MaterialGraphProject/Assets/Andre/New Shader Graph.ShaderGraph
  3. 106
      MaterialGraphProject/Assets/Rinaldo/BlendModeNode.cs
  4. 16
      MaterialGraphProject/Assets/Rinaldo/BlendModesEnum.cs
  5. 2
      MaterialGraphProject/Assets/Rinaldo/Editor/BlendModeNodePresenter.cs
  6. 2
      MaterialGraphProject/Assets/TestGraph.ShaderGraph
  7. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
  8. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/NodePreviewPresenter.cs
  9. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/LevelsNodePresenter.cs
  10. 21
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader
  11. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader.meta
  12. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Interfaces/IMasterNode.cs
  13. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/AbstractMasterNode.cs
  14. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/CartesianToPolarNode.cs
  15. 49
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/UVRotatorNode.cs
  16. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/SubGraphNode.cs
  17. 50
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/AbstractSurfaceMasterNode.cs
  18. 48
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Util/ShaderGenerator.cs
  19. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Trigonometry/DegreesToRadiansNode.cs
  20. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Trigonometry/RadiansToDegreesNode.cs
  21. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/ReciprocalNode.cs
  22. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Normal/UnpackNormalNode.cs
  23. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/AddNode.cs
  24. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Legacy/LegacyBlendNode.cs
  25. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/DivNode.cs
  26. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Vector/DotNode.cs
  27. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Vector/FresnelNode.cs
  28. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/MultiplyNode.cs
  29. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Vector/ReflectNode.cs
  30. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/SubtractNode.cs
  31. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments/LevelsNode.cs
  32. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/HSVtoRGBNode.cs
  33. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments/HueNode.cs
  34. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/RGBtoHSVNode.cs
  35. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Range/RemapNode.cs
  36. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments/ContrastNode.cs
  37. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/RGBtoLuminanceNode.cs
  38. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments/SaturationNode.cs
  39. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/LinearToRGBNode.cs
  40. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/RGBtoLinearNode.cs
  41. 9
      MaterialGraphProject/Assets/Andre/Editor.meta
  42. 1
      MaterialGraphProject/Assets/Andre/FlowMap.ShaderGraph
  43. 9
      MaterialGraphProject/Assets/Andre/FlowMap.ShaderGraph.meta
  44. 83
      MaterialGraphProject/Assets/Andre/ToggleNode.cs
  45. 8
      MaterialGraphProject/Assets/Andre/ToggleNode.cs.meta
  46. 104
      MaterialGraphProject/Assets/Brandon/NoiseNode.cs
  47. 12
      MaterialGraphProject/Assets/Brandon/NoiseNode.cs.meta
  48. 50
      MaterialGraphProject/Assets/Eduardo/Editor/AddManyNodePresenter.cs
  49. 12
      MaterialGraphProject/Assets/Eduardo/Editor/AddManyNodePresenter.cs.meta
  50. 1
      MaterialGraphProject/Assets/Eduardo/EduardoTestGraph.ShaderGraph
  51. 9
      MaterialGraphProject/Assets/Eduardo/EduardoTestGraph.ShaderGraph.meta
  52. 70
      MaterialGraphProject/Assets/Eduardo/FunctionNAddNode.cs
  53. 12
      MaterialGraphProject/Assets/Eduardo/FunctionNAddNode.cs.meta
  54. 142
      MaterialGraphProject/Assets/Eduardo/FunctionNInNOut.cs
  55. 12
      MaterialGraphProject/Assets/Eduardo/FunctionNInNOut.cs.meta
  56. 56
      MaterialGraphProject/Assets/Rinaldo/FractalNode.cs
  57. 12
      MaterialGraphProject/Assets/Rinaldo/FractalNode.cs.meta
  58. 643
      MaterialGraphProject/Assets/TestAssets/flowmap.png
  59. 84
      MaterialGraphProject/Assets/TestAssets/flowmap.png.meta
  60. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art.meta
  61. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Legacy.meta
  62. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math.meta
  63. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs
  64. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs.meta
  65. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixTransposeNode.cs
  66. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixTransposeNode.cs.meta
  67. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Normal.meta
  68. 56
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/RepeatingDotNode.cs
  69. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/RepeatingDotNode.cs.meta
  70. 101
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/VoronoiNoise.cs
  71. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/VoronoiNoise.cs.meta
  72. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorProjectionNode.cs
  73. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorProjectionNode.cs.meta
  74. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorRejectionNode.cs
  75. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorRejectionNode.cs.meta
  76. 12
      MaterialGraphProject/Assets/Andre/Editor/ToggleNodePresenter.cs.meta
  77. 46
      MaterialGraphProject/Assets/Andre/Editor/ToggleNodePresenter.cs
  78. 122
      MaterialGraphProject/Assets/NewNodes/WIP/ParallaxNode.cs
  79. 12
      MaterialGraphProject/Assets/NewNodes/WIP/ParallaxNode.cs.meta
  80. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments.meta
  81. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion.meta
  82. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced.meta
  83. 13
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/AbsoluteNode.cs
  84. 13
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/LengthNode.cs
  85. 13
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/NormalizeNode.cs
  86. 26
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/PosterizeNode.cs
  87. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic.meta
  88. 13
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/PowerNode.cs
  89. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Interpolation.meta

11
MaterialGraphProject/Assets/Andre/New Material.mat


m_Texture: {fileID: 8900000, guid: f7111c407ddfe4109af9703cb740eaf9, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- Texture_02e4013b_5c99_456a_a8d8_cafbb1dfc0da_Uniform:
m_Texture: {fileID: 2800000, guid: 5a5e07ee958edbd468227e1d9ac4726a, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 2800000, guid: 6e8d12f68bae2294da814f9d4c81b29a, type: 3}
m_Texture: {fileID: 10305, guid: 0000000000000000f000000000000000, type: 0}
m_Offset: {x: 0, y: 0}
- Texture_7e044bc6_b639_4457_83f6_752bfaedcb11_Uniform:
m_Texture: {fileID: 2800000, guid: 330f42016073a97418a4aae5517e32c8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Toggle_bda28932_b1ab_4b0b_ba54_ca5db612047a_Uniform: 0
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1

2
MaterialGraphProject/Assets/Andre/New Shader Graph.ShaderGraph
文件差异内容过多而无法显示
查看文件

106
MaterialGraphProject/Assets/Rinaldo/BlendModeNode.cs


protected override string GetFunctionName()
{
return "unity_blendmode_" + precision;
return "unity_blendmode_" + System.Enum.GetName(typeof(BlendModesEnum), m_BlendMode);
}
protected override string GetInputSlot1Name()
{
return "A|Blend/Src";
}
protected override string GetInputSlot2Name()
{
return "B|Base/Dest";
}
[SerializeField]

}
}
}
/*This is to overide input to be vector 3, not really necessary anymore*/
/*
*/
// var vector3one = precision+ "3(1.0, 1.0, 1.0);
switch (m_BlendMode)
{
case BlendModesEnum.Burn:

// outputString.AddShaderChunk("return "+precision+ "3(1.0,1.0,1.0) - (" + precision + "3(1.0,1.0,1.0) - arg2)/arg1;", false);
outputString.AddShaderChunk("return 1.0 - (1.0 - arg2)/arg1;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);

outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg2 / (" + precision + "3(1.0,1.0,1.0) - arg1);", false);
outputString.AddShaderChunk("return arg2 / (1.0 - arg1);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
case BlendModesEnum.Divide:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg2 / (arg1 + 0.000000000001);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;

outputString.Indent();
outputString.AddShaderChunk("return arg2 + arg1 - (" + precision + "3(2.0,2.0,2.0)*arg2*arg1);", false);
// outputString.AddShaderChunk("return arg2 + arg1 - (" + precision + "3(2.0,2.0,2.0)*arg2*arg1);", false);
outputString.AddShaderChunk("return arg2 + arg1 - (2.0 *arg2*arg1);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;

outputString.AddShaderChunk(precision + outputDimension + " result2 = 2.0 * arg1 * arg2;", false);
outputString.AddShaderChunk(precision + outputDimension + " zeroOrOne = step(arg1, 0.5);", false);
outputString.AddShaderChunk("return result2 * zeroOrOne + (1 - zeroOrOne) * result1;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
case BlendModesEnum.HardMix:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return step(1-arg1, arg2);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;

outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
case BlendModesEnum.LinearBurn:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg1 + arg2 - 1.0;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
case BlendModesEnum.LinearDodge:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg1 + arg2;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
case BlendModesEnum.LinearLight:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg2 + 2.0 * arg1 - 1.0;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
case BlendModesEnum.Multiply:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);

outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
/* case BlendModesEnum.Overlay:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk(precision + outputDimension + " result1 = 2.0 * arg1 * arg2;", false);
outputString.AddShaderChunk(precision + outputDimension + " result2 = 1.0 - 2.0 * (1.0 - arg1) * (1.0 - arg2);", false);
outputString.AddShaderChunk(precision + outputDimension + " zeroOrOne = step(arg2, 0.5);", false);
outputString.AddShaderChunk("return result2 * zeroOrOne + (1 - zeroOrOne) * result1;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
*/
case BlendModesEnum.PinLight:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk(precision + outputDimension + " check = step (0.5, arg1);", false);
outputString.AddShaderChunk(precision + outputDimension + " result = check * max(2.0*(arg1 - 0.5), arg2);", false);
outputString.AddShaderChunk("return result += (1.0 - check) * min(2.0 * arg1,arg2);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
// outputString.AddShaderChunk("return " + precision + "3(1.0, 1.0, 1.0) - ((" + precision + "3(1.0, 1.0, 1.0)-arg2) * (" + precision + "3(1.0, 1.0, 1.0) - arg1));", false);
outputString.AddShaderChunk("return 1.0 - (1.0-arg2) * (1.0 - arg1);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);

outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk(precision + outputDimension + " result2= 2.0 * arg2 * arg1 + arg2*arg2 - 2.0 * arg2*arg2*arg1;", false);
outputString.AddShaderChunk(precision + outputDimension + " result1= 2.0* sqrt(arg2) * arg1 - sqrt(arg2) + 2.0 * arg2 - 2.0 * arg2*arg1;", false);
outputString.AddShaderChunk(precision + outputDimension + " zeroOrOne = step(arg2, 0.5);", false);
outputString.AddShaderChunk(precision + outputDimension + " result1= 2.0 * arg2 * arg1 + arg2*arg2 - 2.0 * arg2*arg2*arg1;", false);
outputString.AddShaderChunk(precision + outputDimension + " result2= 2.0* sqrt(arg2) * arg1 - sqrt(arg2) + 2.0 * arg2 - 2.0 * arg2*arg1;", false);
outputString.AddShaderChunk(precision + outputDimension + " zeroOrOne = step(0.5, arg1);", false);
outputString.AddShaderChunk("return result2 * zeroOrOne + (1 - zeroOrOne) * result1;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);

outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg1 - arg2;", false);
outputString.AddShaderChunk("return arg2 - arg1;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;
case BlendModesEnum.VividLight:
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk(precision + outputDimension + " result1= 1.0-(1.0-arg2)/(2.0*arg1);", false);
outputString.AddShaderChunk(precision + outputDimension + " result2= arg2/(2.0*(1.0-arg1));", false);
outputString.AddShaderChunk(precision + outputDimension + " zeroOrOne = step(0.5, arg1);", false);
outputString.AddShaderChunk("return result2 * zeroOrOne + (1 - zeroOrOne) * result1;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
break;

16
MaterialGraphProject/Assets/Rinaldo/BlendModesEnum.cs


public enum BlendModesEnum
{
Burn,
Dodge,
// Divide,
Dodge,
Divide,
// HardMix,
HardMix,
// LinearDodge,
// LinearLight,
// LinearBurn,
LinearBurn,
LinearDodge,
LinearLight,
// PinLight,
PinLight,
// VividLight
VividLight
/* Old Order

2
MaterialGraphProject/Assets/Rinaldo/Editor/BlendModeNodePresenter.cs


if (cNode == null)
return;
cNode.blendMode = (BlendModesEnum)EditorGUILayout.EnumPopup("Mode", cNode.blendMode);
cNode.blendMode = (BlendModesEnum)EditorGUILayout.EnumPopup("", cNode.blendMode);
}
/* public override float GetHeight()

2
MaterialGraphProject/Assets/TestGraph.ShaderGraph
文件差异内容过多而无法显示
查看文件

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs


typeMapper[typeof(TextureNode)] = typeof(TextureNodePresenter);
typeMapper[typeof(TextureLODNode)] = typeof(TextureLODNodePresenter);
typeMapper[typeof(CubemapNode)] = typeof(CubeNodePresenter);
typeMapper[typeof(ToggleNode)] = typeof(ToggleNodePresenter);
typeMapper[typeof(UVNode)] = typeof(UVNodePresenter);
typeMapper[typeof(Vector1Node)] = typeof(Vector1NodePresenter);
typeMapper[typeof(Vector2Node)] = typeof(Vector2NodePresenter);

typeMapper[typeof(MasterRemapInputNode)] = typeof(RemapInputNodePresenter);
typeMapper[typeof(AbstractSubGraphIONode)] = typeof(SubgraphIONodePresenter);
typeMapper[typeof(AbstractSurfaceMasterNode)] = typeof(SurfaceMasterPresenter);
typeMapper[typeof(LevelNode)] = typeof(LevelNodePresenter);
typeMapper[typeof(LevelsNode)] = typeof(LevelsNodePresenter);
typeMapper[typeof(AddManyNode)] = typeof(AddManyNodePresenter);
}
}
}

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/NodePreviewPresenter.cs


List<PropertyGenerator.TextureInfo> defaultTextures;
var resultShader = ((IMasterNode) m_Node).GetFullShader(GenerationMode.Preview, out defaultTextures);
m_GeneratedShaderMode = PreviewMode.Preview3D;
if (((IMasterNode)m_Node).has3DPreview())
{
m_GeneratedShaderMode = PreviewMode.Preview3D;
}
return resultShader;
}
return ShaderGenerator.GeneratePreviewShader(m_Node, out m_GeneratedShaderMode);

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/LevelsNodePresenter.cs


namespace UnityEditor.MaterialGraph.Drawing
{
class LevelControlPresenter : GraphControlPresenter
class LevelsControlPresenter : GraphControlPresenter
var tNode = node as LevelNode;
var tNode = node as LevelsNode;
if (tNode == null)
return;

}
[Serializable]
public class LevelNodePresenter : PropertyNodePresenter
public class LevelsNodePresenter : PropertyNodePresenter
var instance = CreateInstance<LevelControlPresenter>();
var instance = CreateInstance<LevelsControlPresenter>();
instance.Initialize(node);
return new List<GraphElementPresenter>(base.GetControlData()) { instance };
}

21
MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader


Shader "Graph/UnityEngine.MaterialGraph.MetallicMasterNode6ab95a24-fc7d-4a4e-8828-a2de989d8143"
Shader "Graph/UnityEngine.MaterialGraph.MetallicMasterNodefb4e5d27-b55b-4c39-84a8-ae6dcd6d7631"
[NonModifiableTextureData] Texture_5537060b_db74_4900_8f2b_178ba97b7f11_Uniform("", 2D) = "white" {}
Cubemap_ee09e335_3be2_46ee_9d59_ce2673aeedf9_Uniform("", Cube) = "" {}
}

#pragma glsl
#pragma debug
inline float unity_remap_float (float arg1, float2 arg2, float2 arg3)
{
return arg1 * ((arg3.y - arg3.x) / (arg2.y - arg2.x)) + arg3.x;
}
sampler2D Texture_5537060b_db74_4900_8f2b_178ba97b7f11_Uniform;
samplerCUBE Cubemap_ee09e335_3be2_46ee_9d59_ce2673aeedf9_Uniform;
half4 meshUV0;
float3 worldViewDir;
float3 worldNormal;
};

o.meshUV0 = v.texcoord;
half4 uv0 = IN.meshUV0;
float3 worldSpaceViewDirection = IN.worldViewDir;
float3 worldSpaceNormal = normalize(IN.worldNormal);
float4 Texture_5537060b_db74_4900_8f2b_178ba97b7f11 = tex2D (Texture_5537060b_db74_4900_8f2b_178ba97b7f11_Uniform, uv0.xy);
float Remap_26b4b7a4_1c55_4c03_9830_fc5d53b3a504_Output = unity_remap_float (Texture_5537060b_db74_4900_8f2b_178ba97b7f11.r, float2 (0,1), float2 (7,-2));
float4 Cubemap_ee09e335_3be2_46ee_9d59_ce2673aeedf9 = texCUBElod (Cubemap_ee09e335_3be2_46ee_9d59_ce2673aeedf9_Uniform, float4(reflect(-worldSpaceViewDirection, worldSpaceNormal).xyz,Remap_26b4b7a4_1c55_4c03_9830_fc5d53b3a504_Output));
o.Emission = Cubemap_ee09e335_3be2_46ee_9d59_ce2673aeedf9;
}
ENDCG

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader.meta


fileFormatVersion: 2
guid: 9ab5e16c2083a4fe689209a8c1ae425e
timeCreated: 1495526268
<<<<<<< HEAD
timeCreated: 1495529915
=======
timeCreated: 1495532053
>>>>>>> f9e75cae7d0f088d17985a220f4ca7ae3da1222a
nonModifiableTextures: []
nonModifiableTextures:
- Texture_5537060b_db74_4900_8f2b_178ba97b7f11_Uniform: {fileID: 2800000, guid: 6e8d12f68bae2294da814f9d4c81b29a,
type: 3}
userData:
assetBundleName:
assetBundleVariant:

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Interfaces/IMasterNode.cs


string GetSubShader(GenerationMode mode, PropertyGenerator shaderPropertiesVisitor);
string GetVariableNameForNode();
bool has3DPreview();
}
}

5
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/AbstractMasterNode.cs


public abstract string GetFullShader(GenerationMode mode, out List<PropertyGenerator.TextureInfo> configuredTextures);
public abstract string GetSubShader(GenerationMode mode, PropertyGenerator shaderPropertiesVisitor);
public virtual bool has3DPreview()
{
return true;
}
}
}

34
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/CartesianToPolarNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("UV/Cartesian To Polar")]
public class CartesianToPolarNode : Function3Input, IGeneratesFunction
public class CartesianToPolarNode : Function1Input, IGeneratesFunction
{
public CartesianToPolarNode()
{

return "unity_cartesiantopolar_" + precision;
}
protected override string GetInputSlot1Name()
protected override string GetInputSlotName()
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()
protected override MaterialSlot GetInputSlot()
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);
return new MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero);
outputString.AddShaderChunk(GetFunctionPrototype("uv", "horizontalTileScale", "verticalTileScale"), false);
outputString.AddShaderChunk(GetFunctionPrototype("uv"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float radius = length(uv);", false);

49
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/UVRotatorNode.cs


using UnityEngine.Graphing;
using System.Collections.Generic;
using System.Linq;
public class UVRotatorNode : Function2Input, IGeneratesFunction
public class UVRotatorNode : Function2Input, IGeneratesFunction, IMayRequireMeshUV
{
private const string kUVSlotName = "UV";
private const string kRotationSlotName = "Rotation";

protected override MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, kUVSlotName, kUVSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero);
return new MaterialSlot(OutputSlotId, kUVSlotName, kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector4, Vector4.zero);
}
protected override string GetFunctionCallBody(string input1Value, string input2Value)
{
//get input UV slot
var uvName = string.Format("{0}", UVChannel.uv0.GetUVName());
bool isConnected = false;
var uvSlot = FindInputSlot<MaterialSlot>(InputSlot1Id);
if (uvSlot != null)
{
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.Vector4, true);
isConnected = true;
}
}
if (isConnected)
return GetFunctionName() + " (" + input1Value + ", " + input2Value + ")";
else
return GetFunctionName() + " (" + uvName + ", " + input2Value + ")";
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();

outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
public bool RequiresMeshUV(UVChannel channel)
{
if (channel != UVChannel.uv0)
{
return false;
}
var uvSlot = FindInputSlot<MaterialSlot>(InputSlot1Id);
if (uvSlot == null)
return true;
var edges = owner.GetEdges(uvSlot.slotReference).ToList();
return edges.Count == 0;
}
}
}

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/SubGraphNode.cs


, IMayRequireViewDirection
, IMayRequireWorldPosition
, IMayRequireVertexColor
, IMayRequireViewDirectionTangentSpace
{
[SerializeField]
private string m_SerializedSubGraph = string.Empty;

return false;
return subGraph.activeNodes.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection());
}
public bool RequiresViewDirectionTangentSpace()
{
if (subGraph == null)
return false;
return subGraph.activeNodes.OfType<IMayRequireViewDirectionTangentSpace>().Any(x => x.RequiresViewDirectionTangentSpace());
}
public bool RequiresWorldPosition()

50
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/AbstractSurfaceMasterNode.cs


// always add color because why not.
shaderInputVisitor.AddShaderChunk("float4 color : COLOR;", true);
bool requiresBitangent = activeNodeList.OfType<IMayRequireBitangent>().Any(x => x.RequiresBitangent());
bool requiresTangent = activeNodeList.OfType<IMayRequireTangent>().Any(x => x.RequiresTangent());
bool requiresViewDirTangentSpace = activeNodeList.OfType<IMayRequireViewDirectionTangentSpace>().Any(x => x.RequiresViewDirectionTangentSpace());
bool requiresViewDir = activeNodeList.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection());
bool requiresWorldPos = activeNodeList.OfType<IMayRequireWorldPosition>().Any(x => x.RequiresWorldPosition());
bool requiresNormal = activeNodeList.OfType<IMayRequireNormal>().Any(x => x.RequiresNormal());
bool requiresScreenPosition = activeNodeList.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition());
bool requiresVertexColor = activeNodeList.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor());
for (int uvIndex = 0; uvIndex < ShaderGeneratorNames.UVCount; ++uvIndex)
{
var channel = (UVChannel)uvIndex;

}
}
if (activeNodeList.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection()))
if (requiresViewDir || requiresViewDirTangentSpace)
if (activeNodeList.OfType<IMayRequireWorldPosition>().Any(x => x.RequiresWorldPosition()))
if (requiresWorldPos)
if (activeNodeList.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition()))
if (requiresScreenPosition)
bool needBitangent = activeNodeList.OfType<IMayRequireBitangent>().Any(x => x.RequiresBitangent());
if (needBitangent || activeNodeList.OfType<IMayRequireTangent>().Any(x => x.RequiresTangent()))
if (requiresBitangent || requiresTangent || requiresViewDirTangentSpace)
{
shaderInputVisitor.AddShaderChunk("float4 worldTangent;", true);
vertexShaderBlock.AddShaderChunk("o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);", true);

if (needBitangent || activeNodeList.OfType<IMayRequireNormal>().Any(x => x.RequiresNormal()))
if (requiresBitangent || requiresNormal || requiresViewDirTangentSpace)
{
// is the normal connected?
var normalSlot = FindInputSlot<MaterialSlot>(NormalSlotId);

shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.WorldSpaceNormal + " = normalize(IN.worldNormal);", true);
}
if (needBitangent)
if (requiresBitangent || requiresViewDirTangentSpace)
if (activeNodeList.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor()))
if (requiresViewDirTangentSpace)
{
// shaderInputVisitor.AddShaderChunk("float3 tangentViewDir;", true);
// shaderBody.AddShaderChunk("float3 " + ShaderGeneratorNames.TangentSpaceViewDirection + " = IN.tangentViewDir;", true);
shaderBody.AddShaderChunk(
"float3 " + ShaderGeneratorNames.TangentSpaceViewDirection + ";", true);
shaderBody.AddShaderChunk(
ShaderGeneratorNames.TangentSpaceViewDirection + ".x = dot(" +
ShaderGeneratorNames.WorldSpaceViewDirection + "," +
ShaderGeneratorNames.WorldSpaceTangent + ");", true);
shaderBody.AddShaderChunk(
ShaderGeneratorNames.TangentSpaceViewDirection + ".y = dot(" +
ShaderGeneratorNames.WorldSpaceViewDirection + "," +
ShaderGeneratorNames.WorldSpaceBitangent + ");", true);
shaderBody.AddShaderChunk(
ShaderGeneratorNames.TangentSpaceViewDirection + ".z = dot(" +
ShaderGeneratorNames.WorldSpaceViewDirection + "," +
ShaderGeneratorNames.WorldSpaceNormal + ");", true);
}
if (requiresVertexColor)
{
shaderBody.AddShaderChunk("float4 " + ShaderGeneratorNames.VertexColor + " = IN.color;", true);
}

48
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Util/ShaderGenerator.cs


public const string WorldSpaceTangent = "worldSpaceTangent";
public const string WorldSpacePosition = "worldPosition";
public const string WorldSpaceViewDirection = "worldSpaceViewDirection";
public const string TangentSpaceViewDirection = "tangentSpaceViewDirection";
public const string ScreenPosition = "screenPosition";
public const string VertexColor = "vertexColor";

vertexShaderBlock.AddShaderChunk("float4 screenPos = ComputeScreenPos(UnityObjectToClipPos(v.vertex));", true);
vertexShaderBlock.AddShaderChunk("float3 worldNormal = UnityObjectToWorldNormal(v.normal);", true);
bool needBitangent = activeNodeList.OfType<IMayRequireBitangent>().Any(x => x.RequiresBitangent());
bool needsWorldPos = activeNodeList.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection());
if (needsWorldPos || activeNodeList.OfType<IMayRequireWorldPosition>().Any(x => x.RequiresWorldPosition()))
bool requiresBitangent = activeNodeList.OfType<IMayRequireBitangent>().Any(x => x.RequiresBitangent());
bool requiresTangent = activeNodeList.OfType<IMayRequireTangent>().Any(x => x.RequiresTangent());
bool requiresViewDirTangentSpace = activeNodeList.OfType<IMayRequireViewDirectionTangentSpace>().Any(x => x.RequiresViewDirectionTangentSpace());
bool requiresViewDir = activeNodeList.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection());
bool requiresWorldPos = activeNodeList.OfType<IMayRequireWorldPosition>().Any(x => x.RequiresWorldPosition());
bool requiresNormal = activeNodeList.OfType<IMayRequireNormal>().Any(x => x.RequiresNormal());
bool requiresScreenPosition = activeNodeList.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition());
bool requiresVertexColor = activeNodeList.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor());
// view directions calculated from world position
if (requiresWorldPos || requiresViewDir || requiresViewDirTangentSpace)
{
shaderInputVisitor.AddShaderChunk("float3 worldPos : TEXCOORD0;", true);
vertexShaderBlock.AddShaderChunk("o.worldPos = worldPos;", true);

if (needBitangent || activeNodeList.OfType<IMayRequireNormal>().Any(x => x.RequiresNormal()))
if (requiresBitangent || requiresNormal || requiresViewDirTangentSpace)
{
shaderInputVisitor.AddShaderChunk("float3 worldNormal : TEXCOORD1;", true);
vertexShaderBlock.AddShaderChunk("o.worldNormal = worldNormal;", true);

}
}
if (activeNodeList.OfType<IMayRequireViewDirection>().Any(x => x.RequiresViewDirection()))
if (requiresViewDir || requiresViewDirTangentSpace)
{
shaderBodyVisitor.AddShaderChunk(
"float3 "

+ "));", true);
}
if (activeNodeList.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition()))
if (requiresScreenPosition)
{
shaderInputVisitor.AddShaderChunk("float4 screenPos : TEXCOORD3;", true);
vertexShaderBlock.AddShaderChunk("o.screenPos = screenPos;", true);

if (needBitangent || activeNodeList.OfType<IMayRequireTangent>().Any(x => x.RequiresTangent()))
if (requiresBitangent || requiresViewDirTangentSpace || requiresTangent)
{
shaderInputVisitor.AddShaderChunk("float4 worldTangent : TEXCOORD4;", true);
vertexShaderBlock.AddShaderChunk("o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);", true);

if (needBitangent)
if (requiresBitangent || requiresViewDirTangentSpace)
if (activeNodeList.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor()))
if (requiresViewDirTangentSpace)
{
shaderBodyVisitor.AddShaderChunk(
"float3 " + ShaderGeneratorNames.TangentSpaceViewDirection + ";", true);
shaderBodyVisitor.AddShaderChunk(
ShaderGeneratorNames.TangentSpaceViewDirection + ".x = dot(" +
ShaderGeneratorNames.WorldSpaceViewDirection + "," +
ShaderGeneratorNames.WorldSpaceTangent + ");", true);
shaderBodyVisitor.AddShaderChunk(
ShaderGeneratorNames.TangentSpaceViewDirection + ".y = dot(" +
ShaderGeneratorNames.WorldSpaceViewDirection + "," +
ShaderGeneratorNames.WorldSpaceBitangent + ");", true);
shaderBodyVisitor.AddShaderChunk(
ShaderGeneratorNames.TangentSpaceViewDirection + ".z = dot(" +
ShaderGeneratorNames.WorldSpaceViewDirection + "," +
ShaderGeneratorNames.WorldSpaceNormal + ");", true);
}
if (requiresVertexColor)
{
vertexShaderBlock.AddShaderChunk("o.color = v.color;", true);
shaderBodyVisitor.AddShaderChunk("float4 " + ShaderGeneratorNames.VertexColor + " = IN.color;", true);

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Trigonometry/DegreesToRadiansNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/Degrees To Radians Node")]
[Title("Math/Trigonometry/Degrees To Radians")]
public class DegreesToRadiansNode : Function1Input
{
public DegreesToRadiansNode()

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Trigonometry/RadiansToDegreesNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Trigonometry/Radians To Degrees Node")]
[Title("Math/Trigonometry/Radians To Degrees")]
public class RadiansToDegreesNode : Function1Input
{
public RadiansToDegreesNode()

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/ReciprocalNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Advanced/Reciprocal Node")]
[Title("Math/Advanced/Reciprocal")]
name = "ReciprocalNode";
name = "Reciprocal";
}
protected override string GetFunctionName()

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Normal/UnpackNormalNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Channel/Unpack Normal")]
[Title("Normal/Unpack Normal")]
internal class UnpackNormalNode : Function1Input
{
public UnpackNormalNode()

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/AddNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Add Node")]
[Title("Math/Basic/Add")]
name = "AddNode";
name = "Add";
}
protected override string GetFunctionName()

8
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Legacy/LegacyBlendNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Art/Blend Node")]
public class BlendNode : Function2Input, IGeneratesFunction
[Title("Legacy/Blend")]
public class LegacyBlendNode : Function2Input, IGeneratesFunction
public BlendNode()
public LegacyBlendNode()
name = "BlendNode";
name = "Blend";
}
public enum Operation

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/DivNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Div Node")]
[Title("Math/Basic/Divide")]
name = "DivNode";
name = "Divide";
}
protected override string GetFunctionName() {return "unity_div_" + precision; }

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Vector/DotNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Dot Node")]
[Title("Math/Vector/Dot Product")]
name = "DotNode";
name = "DotProduct";
}
protected override string GetFunctionName()

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Vector/FresnelNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Fresnel Node")]
[Title("Math/Vector/Fresnel")]
name = "FresnelNode";
name = "Fresnel";
}
protected override MaterialSlot GetInputSlot1()

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/MultiplyNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Multiply Node")]
[Title("Math/Basic/Multiply")]
name = "MultiplyNode";
name = "Multiply";
}
protected override string GetFunctionName()

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Vector/ReflectNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Reflect Node")]
[Title("Math/Vector/Reflect")]
name = "ReflectNode";
name = "Reflect";
}
protected override string GetInputSlot1Name() {return "Normal"; }

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/SubtractNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Subtract Node")]
[Title("Math/Basic/Subtract")]
name = "SubtractNode";
name = "Subtract";
}
protected override string GetFunctionName() {return "unity_subtract_" + precision; }

10
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments/LevelsNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Range/Level Node")]
public class LevelNode : Function1Input, IGeneratesFunction
[Title("Art/Adjustments/Levels")]
public class LevelsNode : Function1Input, IGeneratesFunction
{
[SerializeField]
private float m_InputMin = 0.0f;

}
}
public LevelNode()
public LevelsNode()
name = "LevelNode";
name = "Levels";
return "unity_level_" + precision;
return "unity_levels_" + precision;
}
public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode)

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/HSVtoRGBNode.cs


namespace UnityEngine.MaterialGraph
{
[Title ("Math/Color/HSVtoRGB")]
[Title ("Art/Conversion/HSVtoRGB")]
public class HSVtoRGBNode : Function1Input, IGeneratesFunction
{
public HSVtoRGBNode ()

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments/HueNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Color/Hue")]
[Title("Art/Adjustments/Hue")]
public class HueNode : Function1Input, IGeneratesFunction
{
public HueNode()

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/RGBtoHSVNode.cs


namespace UnityEngine.MaterialGraph
{
[Title ("Math/Color/RGBtoHSV")]
[Title ("Art/Conversion/RGBtoHSV")]
public class RGBtoHSVNode : Function1Input, IGeneratesFunction
{
public RGBtoHSVNode ()

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Range/RemapNode.cs


public RemapNode ()
{
name = "Remap";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()

6
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments/ContrastNode.cs


namespace UnityEngine.MaterialGraph
{
[Title ("Math/Color/Contrast")]
public class Contrast : Function3Input, IGeneratesFunction
[Title ("Art/Adjustments/Contrast")]
public class ContrastNode : Function3Input, IGeneratesFunction
public Contrast()
public ContrastNode()
{
name = "Contrast";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/RGBtoLuminanceNode.cs


namespace UnityEngine.MaterialGraph
{
[Title ("Math/Color/RGBtoLuminance")]
public class RGBtoLuminance : Function1Input, IGeneratesFunction
[Title ("Art/Conversion/RGBtoLuminance")]
public class RGBtoLuminanceNode : Function1Input, IGeneratesFunction
public RGBtoLuminance()
public RGBtoLuminanceNode()
{
name = "RGBtoLuminance";
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments/SaturationNode.cs


namespace UnityEngine.MaterialGraph
{
[Title ("Math/Color/Saturation")]
public class Saturation : Function2Input, IGeneratesFunction
[Title ("Art/Adjustments/Saturation")]
public class SaturationNode : Function2Input, IGeneratesFunction
public Saturation()
public SaturationNode()
{
name = "Saturation";
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/LinearToRGBNode.cs


namespace UnityEngine.MaterialGraph
{
[Title ("Math/Color/LineartoRGB")]
[Title ("Art/Conversion/LineartoRGB")]
name = "RGBtoLinear";
name = "LineartoRGB";
}
protected override string GetFunctionName ()

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion/RGBtoLinearNode.cs


namespace UnityEngine.MaterialGraph
{
[Title ("Math/Color/RGBtoLinear")]
[Title ("Art/Conversion/RGBtoLinear")]
public class RGBtoLinearNode : Function1Input, IGeneratesFunction
{
public RGBtoLinearNode()

9
MaterialGraphProject/Assets/Andre/Editor.meta


fileFormatVersion: 2
guid: bed9a49249fc34bf8adec9aaca294542
folderAsset: yes
timeCreated: 1495545513
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

1
MaterialGraphProject/Assets/Andre/FlowMap.ShaderGraph
文件差异内容过多而无法显示
查看文件

9
MaterialGraphProject/Assets/Andre/FlowMap.ShaderGraph.meta


fileFormatVersion: 2
guid: 78cd4aa6317ee45c1a7e853fbab1e808
timeCreated: 1495548280
licenseType: Pro
ScriptedImporter:
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

83
MaterialGraphProject/Assets/Andre/ToggleNode.cs


using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Toggle")]
public class ToggleNode : PropertyNode, IGeneratesBodyCode
{
[SerializeField]
private float m_Float;
private bool m_ToggleState;
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "Ouput";
public ToggleNode()
{
name = "Toggle";
UpdateNodeAfterDeserialization();
}
/* public override bool hasPreview
{
get { return true; }
}*/
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector1, Vector2.zero));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override PropertyType propertyType
{
get { return PropertyType.Float; }
}
public bool value
{
get { return m_ToggleState; }
set
{
if (m_ToggleState == value)
return;
m_ToggleState = value;
if (onModified != null)
{
onModified(this, ModificationScope.Node);
}
}
}
public override void GeneratePropertyBlock(PropertyGenerator visitor, GenerationMode generationMode)
{
if (exposedState == ExposedState.Exposed)
visitor.AddShaderProperty(new FloatPropertyChunk(propertyName, description, 0f, PropertyChunk.HideState.Visible));
}
public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode)
{
if (exposedState == ExposedState.Exposed || generationMode.IsPreview())
visitor.AddShaderChunk(precision + " " + propertyName + ";", true);
}
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
if (exposedState == ExposedState.Exposed || generationMode.IsPreview())
return;
visitor.AddShaderChunk(value.ToString (), true);
}
public override PreviewProperty GetPreviewProperty()
{
return new PreviewProperty
{
m_Name = propertyName,
m_PropType = PropertyType.Float,
m_Float = value ? 1f : 0f
};
}
}
}

8
MaterialGraphProject/Assets/Andre/ToggleNode.cs.meta


fileFormatVersion: 2
guid: fccc54ac137a8451d8011f29847e63b1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

104
MaterialGraphProject/Assets/Brandon/NoiseNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Noise")]
public class NoiseNode : Function1Input, IGeneratesFunction
{
public NoiseNode()
{
name = "Noise";
}
protected override string GetFunctionName()
{
return "unity_noise_" + precision;
}
protected override string GetInputSlotName()
{
return "UV";
}
protected override MaterialSlot GetInputSlot()
{
return new MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, 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("inline float unity_noise_randomValue (float2 uv)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return frac(sin(dot(uv, float2(12.9898, 78.233)))*43758.5453);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.AddShaderChunk("inline float unity_noise_interpolate (float a, float b, float t)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return (1.0-t)*a + (t*b);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.AddShaderChunk("inline float unity_valueNoise (float2 uv)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float2 i = floor(uv);", false);
outputString.AddShaderChunk("float2 f = frac(uv);", false);
outputString.AddShaderChunk("f = f * f * (3.0 - 2.0 * f);", false);
outputString.AddShaderChunk("uv = abs(frac(uv) - 0.5);", false);
outputString.AddShaderChunk("float2 c0 = i + float2(0.0, 0.0);", false);
outputString.AddShaderChunk("float2 c1 = i + float2(1.0, 0.0);", false);
outputString.AddShaderChunk("float2 c2 = i + float2(0.0, 1.0);", false);
outputString.AddShaderChunk("float2 c3 = i + float2(1.0, 1.0);", false);
outputString.AddShaderChunk("float r0 = unity_noise_randomValue(c0);", false);
outputString.AddShaderChunk("float r1 = unity_noise_randomValue(c1);", false);
outputString.AddShaderChunk("float r2 = unity_noise_randomValue(c2);", false);
outputString.AddShaderChunk("float r3 = unity_noise_randomValue(c3);", false);
outputString.AddShaderChunk("float bottomOfGrid = unity_noise_interpolate(r0, r1, f.x);", false);
outputString.AddShaderChunk("float topOfGrid = unity_noise_interpolate(r2, r3, f.x);", false);
outputString.AddShaderChunk("float t = unity_noise_interpolate(bottomOfGrid, topOfGrid, f.y);", false);
outputString.AddShaderChunk("return t;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.AddShaderChunk(GetFunctionPrototype("uv"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float t = 0.0;", false);
outputString.AddShaderChunk("for(int i = 0; i < 3; i++)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float freq = pow(2.0, float(i));", false);
outputString.AddShaderChunk("float amp = pow(0.5, float(3-i));", false);
outputString.AddShaderChunk("t += unity_valueNoise(float2(uv.x/freq, uv.y/freq))*amp;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.AddShaderChunk("return t;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

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


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

50
MaterialGraphProject/Assets/Eduardo/Editor/AddManyNodePresenter.cs


using System;
using System.Collections.Generic;
using UnityEngine.MaterialGraph;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine;
namespace UnityEditor.MaterialGraph.Drawing
{
[Serializable]
class AddManyContolPresenter : GraphControlPresenter
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var addNode = node as UnityEngine.MaterialGraph.AddManyNode;
if (addNode == null)
return;
if (GUILayout.Button("Add Input"))
{
addNode.AddInputSlot();
addNode.OnModified();
}
if (GUILayout.Button("Remove Input"))
{
addNode.RemoveInputSlot();
addNode.OnModified();
}
}
public override float GetHeight()
{
return EditorGUIUtility.singleLineHeight * 2 + 3 * EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class AddManyNodePresenter : MaterialNodePresenter
{
protected override IEnumerable<GraphElementPresenter> GetControlData()
{
var instance = CreateInstance<AddManyContolPresenter>();
instance.Initialize(node);
return new List<GraphElementPresenter> { instance };
}
}
}

12
MaterialGraphProject/Assets/Eduardo/Editor/AddManyNodePresenter.cs.meta


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

1
MaterialGraphProject/Assets/Eduardo/EduardoTestGraph.ShaderGraph
文件差异内容过多而无法显示
查看文件

9
MaterialGraphProject/Assets/Eduardo/EduardoTestGraph.ShaderGraph.meta


fileFormatVersion: 2
guid: ec1e3c0f2bd86e8468380cdcd9455a3d
timeCreated: 1495547544
licenseType: Pro
ScriptedImporter:
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

70
MaterialGraphProject/Assets/Eduardo/FunctionNAddNode.cs


using UnityEngine.Graphing;
using System.Linq;
using System.Collections;
namespace UnityEngine.MaterialGraph
{
[Title("Math/Advanced/Adder")]
public class AddManyNode : FunctionNInNOut, IGeneratesFunction
{
int m_nodeInputCount = 2;
public void AddInputSlot()
{
string inputName = "Input" + GetInputSlots<MaterialSlot>().Count().ToString();
AddSlot(inputName, inputName, Graphing.SlotType.Input, SlotValueType.Dynamic);
}
public AddManyNode()
{
name = "Adder";
for(int i = 0; i < m_nodeInputCount; ++i)
{
AddInputSlot();
}
AddSlot("Sum", "finalSum", Graphing.SlotType.Output, SlotValueType.Dynamic);
UpdateNodeAfterDeserialization();
}
public void OnModified()
{
if (onModified != null)
onModified(this, ModificationScope.Node);
}
protected override string GetFunctionName()
{
return "unity_Adder";
}
string GetSumOfAllInputs()
{
string sumString = "";
int inputsLeft = GetInputSlots<ISlot>().Count();
foreach (ISlot slot in GetInputSlots<ISlot>())
{
sumString += GetShaderOutputName(slot.id);
if (inputsLeft > 1)
sumString += " + ";
--inputsLeft;
}
return sumString;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype(), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("finalSum = " + GetSumOfAllInputs() + ";", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Eduardo/FunctionNAddNode.cs.meta


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

142
MaterialGraphProject/Assets/Eduardo/FunctionNInNOut.cs


using UnityEngine.Graphing;
using System.Linq;
using System.Collections;
using System;
namespace UnityEngine.MaterialGraph
{
public abstract class FunctionNInNOut : AbstractMaterialNode, IGeneratesBodyCode
{
public FunctionNInNOut()
{
name = "FunctionNInNOut";
UpdateNodeAfterDeserialization();
}
public override void UpdateNodeAfterDeserialization()
{
base.UpdateNodeAfterDeserialization();
foreach (var slot in GetSlots<MaterialSlot>())
{
slot.showValue = true;
}
}
public int AddSlot(string displayName, string nameInShader, SlotType slotType, SlotValueType valueType)
{
int nextSlotId;
if (slotType == SlotType.Output)
nextSlotId = -( GetOutputSlots<MaterialSlot>().Count() + 1 );
else
nextSlotId = GetInputSlots<MaterialSlot>().Count() + 1;
AddSlot(new MaterialSlot(nextSlotId, displayName, nameInShader, slotType, valueType, Vector4.zero, true));
return nextSlotId;
}
public void RemoveOutputSlot()
{
var lastSlotId = -GetOutputSlots<ISlot>().Count();
RemoveSlotById(lastSlotId);
}
public void RemoveInputSlot()
{
var lastSlotId = GetInputSlots<ISlot>().Count();
RemoveSlotById(lastSlotId);
}
private void RemoveSlotById(int slotID)
{
if (slotID == 0)
return;
RemoveSlot(slotID);
}
public string GetSlotTypeName(int slotId)
{
return ConvertConcreteSlotValueTypeToString(FindSlot<MaterialSlot>(slotId).concreteValueType);
}
protected string GetShaderOutputName(int slotId)
{
return FindSlot<MaterialSlot>(slotId).shaderOutputName;
}
// Must override this
protected abstract string GetFunctionName();
private string GetFunctionParameters()
{
string param = "";
int remainingParams = GetSlots<ISlot>().Count();
foreach (ISlot inSlot in GetSlots<ISlot>())
{
if (inSlot.isOutputSlot)
param += "out ";
param += precision + GetSlotTypeName(inSlot.id) + " ";
param += GetShaderOutputName(inSlot.id);
if (remainingParams > 1)
param += ", ";
--remainingParams;
}
return param;
}
private string GetFunctionCallParameters(GenerationMode generationMode)
{
string param = "";
int remainingParams = GetSlots<ISlot>().Count();
foreach (ISlot inSlot in GetSlots<ISlot>())
{
param += GetSlotValue(inSlot.id, generationMode);
if (remainingParams > 1)
param += ", ";
--remainingParams;
}
return param;
}
protected string GetFunctionPrototype()
{
return "inline " + "void" + " " + GetFunctionName() +
" (" +
GetFunctionParameters() +
")";
}
private string GetFunctionCall(GenerationMode generationMode)
{
return GetFunctionName() +
" (" +
GetFunctionCallParameters(generationMode) +
");";
}
private string GetOutputDeclaration()
{
string outDeclaration = "";
foreach (ISlot outSlot in GetOutputSlots<ISlot>())
{
outDeclaration += "\n " + precision + GetSlotTypeName(outSlot.id) + " " + GetVariableNameForSlot(outSlot.id) + ";\n";
}
return outDeclaration;
}
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetOutputDeclaration(), false);
outputString.AddShaderChunk(GetFunctionCall(generationMode), false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Eduardo/FunctionNInNOut.cs.meta


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

56
MaterialGraphProject/Assets/Rinaldo/FractalNode.cs


using UnityEngine.Graphing;
using System.Linq;
using System.Collections;
namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Fractal")]
public class FractalNode : FunctionNInNOut, IGeneratesFunction
{
public FractalNode()
{
name = "Fractal";
AddSlot("UV", "texCoord", Graphing.SlotType.Input, SlotValueType.Vector2);
AddSlot("Pan", "Pan", Graphing.SlotType.Input, SlotValueType.Vector2);
AddSlot("Zoom", "Zoom", Graphing.SlotType.Input, SlotValueType.Vector1);
AddSlot("Aspect", "Aspect", Graphing.SlotType.Input, SlotValueType.Vector1);
AddSlot("FracResult", "fractalRes", Graphing.SlotType.Output, SlotValueType.Dynamic);
UpdateNodeAfterDeserialization();
}
protected override string GetFunctionName()
{
return "unity_Fractal";
}
public override bool hasPreview
{
get { return true; }
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype(), false);
outputString.AddShaderChunk("{", false);
outputString.AddShaderChunk("const int Iterations = 128;", false);
outputString.Indent();
outputString.AddShaderChunk("float2 c = (texCoord - 0.5) * Zoom * float2(1, Aspect) - Pan;", false);
outputString.AddShaderChunk("float2 v = 0;", false);
outputString.AddShaderChunk("for (int n = 0; n < Iterations && dot(v,v) < 4; n++)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("v = float2(v.x * v.x - v.y * v.y, v.x * v.y * 2) + c;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.Deindent();
outputString.AddShaderChunk("fractalRes = (dot(v, v) > 4) ? (float)n / (float)Iterations : 0;", false);
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/Rinaldo/FractalNode.cs.meta


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

643
MaterialGraphProject/Assets/TestAssets/flowmap.png

之前 之后
宽度: 1024  |  高度: 1024  |  大小: 169 KiB

84
MaterialGraphProject/Assets/TestAssets/flowmap.png.meta


fileFormatVersion: 2
guid: 8a17a00c2a071472cb92f6911bb7be11
timeCreated: 1495551094
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art.meta


fileFormatVersion: 2
guid: 8ee6f8ab31f6bf349a63fdd21fc88664
folderAsset: yes
timeCreated: 1495532491
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Legacy.meta


fileFormatVersion: 2
guid: eb0cb153896a18c4ebb6d116283dfda4
folderAsset: yes
timeCreated: 1495532221
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math.meta


fileFormatVersion: 2
guid: e63f07e66d070412bb6e9582ca1eba72
folderAsset: yes
timeCreated: 1495526358
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Matrix/Multiply Node")]
public class MatrixMultiplyNode : Function2Input, IGeneratesFunction
{
public MatrixMultiplyNode()
{
name = "MatrixMultiplyNode";
}
protected override string GetFunctionName()
{
return "unity_matrix_multiply_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return mul(arg1, arg2);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs.meta


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

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixTransposeNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Matrix/Transpose Node")]
public class MatrixTransposeNode : Function1Input, IGeneratesFunction
{
public MatrixTransposeNode()
{
name = "MatrixTranspose";
}
protected override string GetFunctionName()
{
return "unity_matrix_transpose_" + 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 transpose(arg1);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixTransposeNode.cs.meta


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

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Normal.meta


fileFormatVersion: 2
guid: 8443203ba8104ff4bb0a6a0ed978034e
folderAsset: yes
timeCreated: 1495532369
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

56
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/RepeatingDotNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Repeating Dot")]
public class RepeatingDotNode : Function2Input, IGeneratesFunction
{
public RepeatingDotNode()
{
name = "RepeatingDot";
}
protected override string GetFunctionName()
{
return "unity_repreatingdot_" + precision;
}
protected override string GetInputSlot1Name()
{
return "UV";
}
protected override string GetInputSlot2Name()
{
return "Count";
}
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 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", "count"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("uv *= 2.0 - 1.0;", false);
outputString.AddShaderChunk("uv = fmod(uv * count, 1.0) * 2.0 - 1.0;", false);
outputString.AddShaderChunk("return length(uv);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/RepeatingDotNode.cs.meta


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

101
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/VoronoiNoise.cs


namespace UnityEngine.MaterialGraph
{
[Title("Procedural/Voronoi Noise")]
public class VoronoiNoiseNode : Function2Input, IGeneratesFunction
{
public VoronoiNoiseNode()
{
name = "VoronoiNoise";
}
protected override string GetFunctionName()
{
return "unity_voronoinoise_" + 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 "AngleOffset";
}
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("inline float2 unity_voronoi_noise_randomVector (float2 uv, float offset)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float2x2 m = float2x2(15.27, 47.63, 99.41, 89.98);", false);
outputString.AddShaderChunk("uv = frac(sin(mul(uv, m)) * 46839.32);", false);
outputString.AddShaderChunk("return float2(sin(uv.y*+offset)*0.5+0.5, cos(uv.x*offset)*0.5+0.5);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.AddShaderChunk(GetFunctionPrototype("uv", "angleOffset"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float2 g = floor(uv);", false);
outputString.AddShaderChunk("float2 f = frac(uv);", false);
outputString.AddShaderChunk("float t = 8.0;", false);
outputString.AddShaderChunk("float3 res = float3(8.0, 0.0, 0.0);", false);
outputString.AddShaderChunk("for(int y=-1; y<=1; y++)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("for(int x=-1; x<=1; x++)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float2 lattice = float2(x,y);", false);
outputString.AddShaderChunk("float2 offset = unity_voronoi_noise_randomVector(lattice + g, angleOffset);", false);
outputString.AddShaderChunk("float d = distance(lattice + offset, f);", false);
outputString.AddShaderChunk("if(d < res.x)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("res = float3(d, offset.x, offset.y);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
outputString.AddShaderChunk("return res.x;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/VoronoiNoise.cs.meta


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

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorProjectionNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Vector/Projection Node")]
public class VectorProjectionNode : Function2Input, IGeneratesFunction
{
public VectorProjectionNode()
{
name = "VectorProjection";
}
protected override string GetFunctionName()
{
return "unity_vector_projection_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg2 * dot(arg1, arg2) / dot(arg2, arg2);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorProjectionNode.cs.meta


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

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorRejectionNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Vector/Rejection Node")]
public class VectorRejectionNode : Function2Input, IGeneratesFunction
{
public VectorRejectionNode()
{
name = "VectorRejection";
}
protected override string GetFunctionName()
{
return "unity_vector_rejection_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg1 - (arg2 * dot(arg1, arg2) / dot(arg2, arg2));", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorRejectionNode.cs.meta


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

12
MaterialGraphProject/Assets/Andre/Editor/ToggleNodePresenter.cs.meta


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

46
MaterialGraphProject/Assets/Andre/Editor/ToggleNodePresenter.cs


using System;
using System.Collections.Generic;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
[Serializable]
class ToggleNodeControlPresenter : GraphControlPresenter
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var cNode = node as ToggleNode;
if (cNode == null)
return;
cNode.value = EditorGUILayout.Toggle(cNode.value);
cNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), cNode.exposedState);
}
/* public override float GetHeight()
{
return EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
}
*/
public override float GetHeight()
{
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class ToggleNodePresenter : MaterialNodePresenter
{
protected override IEnumerable<GraphElementPresenter> GetControlData()
{
var instance = CreateInstance<ToggleNodeControlPresenter>();
instance.Initialize(node);
return new List<GraphElementPresenter> { instance };
}
}
}

122
MaterialGraphProject/Assets/NewNodes/WIP/ParallaxNode.cs


using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
interface IMayRequireViewDirectionTangentSpace
{
bool RequiresViewDirectionTangentSpace();
}
[Title("UV/Parallax")]
public class ParallaxNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireMeshUV, IMayRequireViewDirectionTangentSpace
{
protected const string kInputSlot1ShaderName = "Depth";
protected const string kOutputSlotShaderName = "UV";
public const int InputSlot1Id = 0;
public const int OutputSlotId = 1;
public override bool hasPreview
{
get { return true; }
}
public override PreviewMode previewMode
{
get
{
return PreviewMode.Preview3D;
}
}
public ParallaxNode()
{
name = "Parallax";
UpdateNodeAfterDeserialization();
}
public string GetFunctionName()
{
return "unity_parallax_" + precision;
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(GetInputSlot1());
AddSlot(GetOutputSlot());
RemoveSlotsNameNotMatching(validSlots);
}
protected int[] validSlots
{
get { return new[] { InputSlot1Id, OutputSlotId }; }
}
protected virtual MaterialSlot GetInputSlot1()
{
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, SlotType.Input, SlotValueType.Vector1, Vector4.zero);
}
protected virtual MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector2, Vector4.zero);
}
protected virtual string GetInputSlot1Name()
{
return kInputSlot1ShaderName;
}
protected virtual string GetOutputSlotName()
{
return kOutputSlotShaderName;
}
protected virtual string GetFunctionPrototype(string arg1Name, string arg2Name, string arg3Name)
{
return "inline " + precision + "2 " + GetFunctionName() + " (" +
precision + " " + arg1Name + ", " +
precision + "2 " + arg2Name + ", " +
precision + "3 " + arg3Name + ")";
}
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
NodeUtils.SlotConfigurationExceptionIfBadConfiguration(this, new[] { InputSlot1Id }, new[] { OutputSlotId });
string input1Value = GetSlotValue(InputSlot1Id, generationMode);
visitor.AddShaderChunk(precision + "2 " + GetVariableNameForSlot(OutputSlotId) + " = " + GetFunctionCallBody(input1Value) + ";", true);
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("depth", "UVs", "viewTangentSpace"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return UVs + depth * viewTangentSpace.xy / viewTangentSpace.z;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
protected virtual string GetFunctionCallBody(string inputValue1)
{
var channel = UVChannel.uv0;
return GetFunctionName() + " (" +
inputValue1 + ", " +
channel.GetUVName() + ", " +
ShaderGeneratorNames.TangentSpaceViewDirection + ")";
}
public bool RequiresMeshUV(UVChannel channel)
{
return channel == UVChannel.uv0;
}
public bool RequiresViewDirectionTangentSpace()
{
return true;
}
}
}

12
MaterialGraphProject/Assets/NewNodes/WIP/ParallaxNode.cs.meta


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

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Adjustments.meta


fileFormatVersion: 2
guid: 75cc6d701e07fe246ba5377a454f74c4
folderAsset: yes
timeCreated: 1495532497
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Conversion.meta


fileFormatVersion: 2
guid: 9134a2b351ed9f140bfbb2d46f9075b5
folderAsset: yes
timeCreated: 1495532965
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced.meta


fileFormatVersion: 2
guid: 198ec765a01574320a8199338d27d9f1
folderAsset: yes
timeCreated: 1495526831
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

13
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/AbsoluteNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Advanced/Absolute")]
public class AbsoluteNode : Function1Input
{
public AbsoluteNode()
{
name = "Absolute";
}
protected override string GetFunctionName() {return "abs"; }
}
}

13
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/LengthNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Advanced/Length")]
public class LengthNode : Function1Input
{
public LengthNode()
{
name = "Length";
}
protected override string GetFunctionName() { return "length"; }
}
}

13
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/NormalizeNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Advanced/Normalize")]
class NormalizeNode : Function1Input
{
public NormalizeNode()
{
name = "Normalize";
}
protected override string GetFunctionName() { return "normalize"; }
}
}

26
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Advanced/PosterizeNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Advanced/Posterize")]
class PosterizeNode : Function2Input, IGeneratesFunction
{
public PosterizeNode()
{
name = "Posterize";
}
protected override string GetFunctionName() {return "unity_posterize_" + precision; }
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("input", "stepsize"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return floor(input / stepsize) * stepsize;", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic.meta


fileFormatVersion: 2
guid: 4120c70d7c1a34d92b74137bf0b1bc67
folderAsset: yes
timeCreated: 1495526365
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

13
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Basic/PowerNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Math/Basic/Power")]
public class PowerNode : Function2Input
{
public PowerNode()
{
name = "Power";
}
protected override string GetFunctionName() { return "pow"; }
}
}

9
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Interpolation.meta


fileFormatVersion: 2
guid: 458e098c89ad64ed3a48cb5f63a5a498
folderAsset: yes
timeCreated: 1495529238
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

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

正在加载...
取消
保存