浏览代码

Merge branch 'master' into node-artistic-adjustment

/main
Matt Dean 7 年前
当前提交
8e410579
共有 42 个文件被更改,包括 932 次插入548 次删除
  1. 12
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/NodeUtils.cs
  2. 1
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/SerializableGraphObject.cs
  3. 1
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/INode.cs
  4. 6
      MaterialGraphProject/Assets/New Shader Graph.ShaderGraph.meta
  5. 282
      MaterialGraphProject/Assets/PartyPreview.ShaderGraph
  6. 8
      MaterialGraphProject/Assets/PartyPreview.ShaderGraph.meta
  7. 14
      MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/TextureCache.cs
  8. 7
      MaterialGraphProject/Assets/SphereDent.ShaderGraph.meta
  9. 295
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs
  10. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialGraph.cs
  11. 18
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/SlotValue.cs
  12. 236
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/SubGraph/LayeredShaderGraph.cs
  13. 22
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs
  14. 1
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/IControlAttribute.cs
  15. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
  16. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/NodeEditorHeaderView.cs
  17. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs
  18. 143
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs
  19. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GradientEdge.cs
  20. 17
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  21. 20
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
  22. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PortInputView.cs
  23. 36
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PreviewTextureView.cs
  24. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs
  25. 15
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Shaders/Checkerboard.shader
  26. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
  27. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/Add.ShaderGraph.meta
  28. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/AddSubGraph.ShaderGraph.meta
  29. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/Cracks.ShaderGraph.meta
  30. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/Gradient.ShaderGraph.meta
  31. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/Multiply.ShaderGraph.meta
  32. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/SplitCombine.ShaderGraph.meta
  33. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/TextureSample.ShaderGraph.meta
  34. 4
      MaterialGraphProject/Assets/graphs_PartyPreview.mat
  35. 2
      MaterialGraphProject/ProjectSettings/ProjectVersion.txt
  36. 193
      MaterialGraphProject/Assets/Beachball.ShaderGraph
  37. 7
      MaterialGraphProject/Assets/Beachball.ShaderGraph.meta
  38. 22
      MaterialGraphProject/Assets/Beachball.mat
  39. 8
      MaterialGraphProject/Assets/Beachball.mat.meta
  40. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/INodeModificationListener.cs
  41. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/INodeModificationListener.cs.meta
  42. 0
      /MaterialGraphProject/UnityPackageManager

12
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/NodeUtils.cs


nodeList.Add(node);
}
static Stack<INode> s_NodeStack = new Stack<INode>();
var nodeStack = new Stack<INode>();
nodeStack.Push(initialNode);
while (nodeStack.Any() && shaderStage == ShaderStage.Dynamic)
s_NodeStack.Clear();
s_NodeStack.Push(initialNode);
while (s_NodeStack.Any() && shaderStage == ShaderStage.Dynamic)
var node = nodeStack.Pop();
var node = s_NodeStack.Pop();
foreach (var slot in goingBackwards ? node.GetInputSlots<MaterialSlot>() : node.GetOutputSlots<MaterialSlot>())
{
if (shaderStage != ShaderStage.Dynamic)

var connectedNode = node.owner.GetNodeFromGuid(goingBackwards ? edge.outputSlot.nodeGuid : edge.inputSlot.nodeGuid);
var connectedSlot = goingBackwards ? connectedNode.FindOutputSlot<MaterialSlot>(edge.outputSlot.slotId) : connectedNode.FindInputSlot<MaterialSlot>(edge.inputSlot.slotId);
if (connectedSlot.shaderStage == ShaderStage.Dynamic)
nodeStack.Push(connectedNode);
s_NodeStack.Push(connectedNode);
else
{
shaderStage = connectedSlot.shaderStage;

1
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/SerializableGraphObject.cs


public bool isDirty
{
get { return m_IsDirty; }
set { m_IsDirty = value; }
}
public void RegisterCompleteObjectUndo(string name)

1
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/INode.cs


}
public delegate void OnNodeModified(INode node, ModificationScope scope);
public delegate void OnNodeReplaced(INode previous, INode current);
public interface INode
{

6
MaterialGraphProject/Assets/New Shader Graph.ShaderGraph.meta


fileFormatVersion: 2
guid: bc622a74b3c2c0d4db4c564bf551b9b5
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

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

8
MaterialGraphProject/Assets/PartyPreview.ShaderGraph.meta


fileFormatVersion: 2
guid: e67b8be7b087145ab87b7ae0a690c35e
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures:
- Texture_507A46B3: {fileID: 2800000, guid: a653bbc25cc7e4794829cf7b1184abcb, type: 3}
- Texture_E2350D28: {fileID: 2800000, guid: 7296f51323ae9485a9c834c4e3d722ed, type: 3}
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

14
MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/TextureCache.cs


if (mismatch)
{
if (!Graphics.ConvertTexture(texture, 0, m_Cache, sliceIndex))
if (!UnityEngine.Graphics.ConvertTexture(texture, 0, m_Cache, sliceIndex))
{
Debug.LogErrorFormat(texture, "Unable to convert texture \"{0}\" to match renderloop settings ({1}x{2} {3})",
texture.name, m_Cache.width, m_Cache.height, m_Cache.format);

{
Graphics.CopyTexture(texture, 0, m_Cache, sliceIndex);
UnityEngine.Graphics.CopyTexture(texture, 0, m_Cache, sliceIndex);
}
}

for (int f = 0; f < 6; f++)
{
if (!Graphics.ConvertTexture(texture, f, m_Cache, 6 * sliceIndex + f))
if (!UnityEngine.Graphics.ConvertTexture(texture, f, m_Cache, 6 * sliceIndex + f))
{
failed = true;
break;

else
{
for (int f = 0; f < 6; f++)
Graphics.CopyTexture(texture, f, m_Cache, 6 * sliceIndex + f);
UnityEngine.Graphics.CopyTexture(texture, f, m_Cache, 6 * sliceIndex + f);
}
}
}

for (int m = 0; m < m_NumPanoMipLevels; m++)
{
m_CubeBlitMaterial.SetInt(m_CubeMipLevelPropName, Mathf.Min(m_NumMipLevels - 1, m));
Graphics.SetRenderTarget(m_StagingRTs[m]);
Graphics.Blit(null, m_CubeBlitMaterial, 0);
UnityEngine.Graphics.SetRenderTarget(m_StagingRTs[m]);
UnityEngine.Graphics.Blit(null, m_CubeBlitMaterial, 0);
Graphics.CopyTexture(m_StagingRTs[m], 0, 0, m_CacheNoCubeArray, sliceIndex, m);
UnityEngine.Graphics.CopyTexture(m_StagingRTs[m], 0, 0, m_CacheNoCubeArray, sliceIndex, m);
}
}

7
MaterialGraphProject/Assets/SphereDent.ShaderGraph.meta


fileFormatVersion: 2
guid: b63da350811f7ba48914e852a299204c
timeCreated: 1500770532
licenseType: Pro
ShaderImporter:
defaultTextures: []
nonModifiableTextures: []
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

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


using System.Linq;
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.Graphing.Util;
namespace UnityEditor.ShaderGraph
{

base.OnAfterDeserialize();
}
protected static ShaderGraphRequirements GetRequierments(AbstractMaterialNode nodeForRequirements)
protected static ShaderGraphRequirements GetRequirements(List<INode> nodes)
if (nodeForRequirements == null)
return ShaderGraphRequirements.none;
var activeNodeList = ListPool<INode>.Get();
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, nodeForRequirements);
NeededCoordinateSpace requiresNormal = activeNodeList.OfType<IMayRequireNormal>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresNormal());
NeededCoordinateSpace requiresBitangent = activeNodeList.OfType<IMayRequireBitangent>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresBitangent());
NeededCoordinateSpace requiresTangent = activeNodeList.OfType<IMayRequireTangent>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresTangent());
NeededCoordinateSpace requiresViewDir = activeNodeList.OfType<IMayRequireViewDirection>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresViewDirection());
NeededCoordinateSpace requiresPosition = activeNodeList.OfType<IMayRequirePosition>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresPosition());
bool requiresScreenPosition = activeNodeList.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition());
bool requiresVertexColor = activeNodeList.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor());
NeededCoordinateSpace requiresNormal = nodes.OfType<IMayRequireNormal>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresNormal());
NeededCoordinateSpace requiresBitangent = nodes.OfType<IMayRequireBitangent>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresBitangent());
NeededCoordinateSpace requiresTangent = nodes.OfType<IMayRequireTangent>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresTangent());
NeededCoordinateSpace requiresViewDir = nodes.OfType<IMayRequireViewDirection>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresViewDirection());
NeededCoordinateSpace requiresPosition = nodes.OfType<IMayRequirePosition>().Aggregate(NeededCoordinateSpace.None, (mask, node) => mask | node.RequiresPosition());
bool requiresScreenPosition = nodes.OfType<IMayRequireScreenPosition>().Any(x => x.RequiresScreenPosition());
bool requiresVertexColor = nodes.OfType<IMayRequireVertexColor>().Any(x => x.RequiresVertexColor());
if (activeNodeList.OfType<IMayRequireMeshUV>().Any(x => x.RequiresMeshUV(channel)))
if (nodes.OfType<IMayRequireMeshUV>().Any(x => x.RequiresMeshUV(channel)))
meshUV.Add(channel);
}

requiresMeshUVs = meshUV
};
ListPool<INode>.Release(activeNodeList);
return reqs;
}

List<PropertyCollector.TextureInfo> configuredTextures;
return GetShader(node, GenerationMode.Preview, string.Format("hidden/preview/{0}", node.GetVariableNameForNode()), out configuredTextures, out previewMode);
FloatShaderProperty outputIdProperty;
return GetShader(node, GenerationMode.Preview, string.Format("hidden/preview/{0}", node.GetVariableNameForNode()), out configuredTextures, out previewMode, out outputIdProperty);
protected static void GenerateSurfaceDescriptionStruct(ShaderGenerator surfaceDescriptionStruct, AbstractMaterialNode node, bool isMasterNode)
public string GetUberPreviewShader(Dictionary<Guid, int> ids, out FloatShaderProperty outputIdProperty)
{
List<PropertyCollector.TextureInfo> configuredTextures;
PreviewMode previewMode;
return GetShader(null, GenerationMode.Preview, "hidden/preview", out configuredTextures, out previewMode, out outputIdProperty, ids);
}
protected static void GenerateSurfaceDescriptionStruct(ShaderGenerator surfaceDescriptionStruct, List<MaterialSlot> slots, bool isMaster)
if (isMasterNode)
if (isMaster)
foreach (var slot in node.GetInputSlots<MaterialSlot>())
surfaceDescriptionStruct.AddShaderChunk(string.Format("{0} {1};", AbstractMaterialNode.ConvertConcreteSlotValueTypeToString(AbstractMaterialNode.OutputPrecision.@float, slot.concreteValueType), slot.shaderOutputName), false);
}
else
{
foreach (var slot in node.GetOutputSlots<MaterialSlot>())
surfaceDescriptionStruct.AddShaderChunk(string.Format("{0} {1};", AbstractMaterialNode.ConvertConcreteSlotValueTypeToString(AbstractMaterialNode.OutputPrecision.@float, slot.concreteValueType), node.GetVariableNameForSlot(slot.id)), false);
}
surfaceDescriptionStruct.Deindent();
surfaceDescriptionStruct.AddShaderChunk("};", false);
foreach (var slot in slots)
surfaceDescriptionStruct.AddShaderChunk(string.Format("{0} {1};", AbstractMaterialNode.ConvertConcreteSlotValueTypeToString(AbstractMaterialNode.OutputPrecision.@float, slot.concreteValueType), AbstractMaterialNode.GetHLSLSafeName(slot.shaderOutputName)), false);
surfaceDescriptionStruct.Deindent();
surfaceDescriptionStruct.AddShaderChunk("};", false);
surfaceDescriptionStruct.AddShaderChunk("void ScaleSurfaceDescription(inout SurfaceDescription surface, float scale){", false);
surfaceDescriptionStruct.Indent();
if (isMasterNode)
{
foreach (var slot in node.GetInputSlots<MaterialSlot>())
surfaceDescriptionStruct.AddShaderChunk( string.Format("surface.{0} = scale * surface.{0};", slot.shaderOutputName), false);
}
else
{
foreach (var slot in node.GetOutputSlots<MaterialSlot>())
surfaceDescriptionStruct.AddShaderChunk(string.Format("surface.{0} = scale * surface.{0};", node.GetVariableNameForSlot(slot.id)), false);
}
surfaceDescriptionStruct.Deindent();
surfaceDescriptionStruct.AddShaderChunk("};", false);
surfaceDescriptionStruct.AddShaderChunk("void ScaleSurfaceDescription(inout SurfaceDescription surface, float scale){", false);
surfaceDescriptionStruct.Indent();
foreach (var slot in slots)
surfaceDescriptionStruct.AddShaderChunk(string.Format("surface.{0} = scale * surface.{0};", AbstractMaterialNode.GetHLSLSafeName(slot.shaderOutputName)), false);
surfaceDescriptionStruct.Deindent();
surfaceDescriptionStruct.AddShaderChunk("};", false);
surfaceDescriptionStruct.AddShaderChunk("void AddSurfaceDescription(inout SurfaceDescription base, in SurfaceDescription add){", false);
surfaceDescriptionStruct.Indent();
if (isMasterNode)
{
foreach (var slot in node.GetInputSlots<MaterialSlot>())
{
var str = string.Format("base.{0} = base.{0} + add.{0};", slot.shaderOutputName);
surfaceDescriptionStruct.AddShaderChunk(str, false);
}
surfaceDescriptionStruct.AddShaderChunk("void AddSurfaceDescription(inout SurfaceDescription base, in SurfaceDescription add){", false);
surfaceDescriptionStruct.Indent();
foreach (var slot in slots)
surfaceDescriptionStruct.AddShaderChunk(string.Format("base.{0} = base.{0} + add.{0};", AbstractMaterialNode.GetHLSLSafeName(slot.shaderOutputName)), false);
foreach (var slot in node.GetOutputSlots<MaterialSlot>())
{
var str = string.Format("base.{0} = base.{0} + add.{0};", node.GetVariableNameForSlot(slot.id));
surfaceDescriptionStruct.AddShaderChunk(str, false);
}
surfaceDescriptionStruct.AddShaderChunk("float4 PreviewOutput;", false);
}
surfaceDescriptionStruct.Deindent();
surfaceDescriptionStruct.AddShaderChunk("};", false);

AbstractMaterialNode node,
List<INode> activeNodeList,
AbstractMaterialNode masterNode,
AbstractMaterialGraph graph,
bool isMasterNode,
string surfaceDescriptionName = "SurfaceDescription")
string surfaceDescriptionName = "SurfaceDescription",
FloatShaderProperty outputIdProperty = null,
Dictionary<Guid, int> ids = null)
var graph = node.owner as AbstractMaterialGraph;
surfaceDescriptionFunction.AddShaderChunk(string.Format("{0} surface = ({0})0;", surfaceDescriptionName), false);
if ((requirements.requiresNormal & NeededCoordinateSpace.Object) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Object.ToVariableName(InterpolatorType.Normal)), false);
if ((requirements.requiresNormal & NeededCoordinateSpace.View) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.View.ToVariableName(InterpolatorType.Normal)), false);
if ((requirements.requiresNormal & NeededCoordinateSpace.World) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.World.ToVariableName(InterpolatorType.Normal)), false);
if ((requirements.requiresNormal & NeededCoordinateSpace.Tangent) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Tangent.ToVariableName(InterpolatorType.Normal)), false);
if ((requirements.requiresTangent & NeededCoordinateSpace.Object) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Object.ToVariableName(InterpolatorType.Tangent)), false);
if ((requirements.requiresTangent & NeededCoordinateSpace.View) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.View.ToVariableName(InterpolatorType.Tangent)), false);
if ((requirements.requiresTangent & NeededCoordinateSpace.World) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.World.ToVariableName(InterpolatorType.Tangent)), false);
if ((requirements.requiresTangent & NeededCoordinateSpace.Tangent) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Tangent.ToVariableName(InterpolatorType.Tangent)), false);
if ((requirements.requiresBitangent & NeededCoordinateSpace.Object) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Object.ToVariableName(InterpolatorType.BiTangent)), false);
if ((requirements.requiresBitangent & NeededCoordinateSpace.View) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.View.ToVariableName(InterpolatorType.BiTangent)), false);
if ((requirements.requiresBitangent & NeededCoordinateSpace.World) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.World.ToVariableName(InterpolatorType.BiTangent)), false);
if ((requirements.requiresBitangent & NeededCoordinateSpace.Tangent) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Tangent.ToVariableName(InterpolatorType.BiTangent)), false);
if ((requirements.requiresViewDir & NeededCoordinateSpace.Object) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Object.ToVariableName(InterpolatorType.ViewDirection)), false);
if ((requirements.requiresViewDir & NeededCoordinateSpace.View) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.View.ToVariableName(InterpolatorType.ViewDirection)), false);
if ((requirements.requiresViewDir & NeededCoordinateSpace.World) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.World.ToVariableName(InterpolatorType.ViewDirection)), false);
if ((requirements.requiresViewDir & NeededCoordinateSpace.Tangent) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Tangent.ToVariableName(InterpolatorType.ViewDirection)), false);
if ((requirements.requiresPosition & NeededCoordinateSpace.Object) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Object.ToVariableName(InterpolatorType.Position)), false);
if ((requirements.requiresPosition & NeededCoordinateSpace.View) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.View.ToVariableName(InterpolatorType.Position)), false);
if ((requirements.requiresPosition & NeededCoordinateSpace.World) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.World.ToVariableName(InterpolatorType.Position)), false);
if ((requirements.requiresPosition & NeededCoordinateSpace.Tangent) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", CoordinateSpace.Tangent.ToVariableName(InterpolatorType.Position)), false);
foreach (CoordinateSpace space in Enum.GetValues(typeof(CoordinateSpace)))
{
var neededCoordinateSpace = space.ToNeededCoordinateSpace();
if ((requirements.requiresNormal & neededCoordinateSpace) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", space.ToVariableName(InterpolatorType.Normal)), false);
if ((requirements.requiresTangent & neededCoordinateSpace) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", space.ToVariableName(InterpolatorType.Tangent)), false);
if ((requirements.requiresBitangent & neededCoordinateSpace) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", space.ToVariableName(InterpolatorType.BiTangent)), false);
if ((requirements.requiresViewDir & neededCoordinateSpace) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", space.ToVariableName(InterpolatorType.ViewDirection)), false);
if ((requirements.requiresPosition & neededCoordinateSpace) > 0)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float3 {0} = IN.{0};", space.ToVariableName(InterpolatorType.Position)), false);
}
if (requirements.requiresScreenPosition)
surfaceDescriptionFunction.AddShaderChunk(string.Format("float4 {0} = IN.{0};", ShaderGeneratorNames.ScreenPosition), false);

graph.CollectShaderProperties(shaderProperties, mode);
var activeNodeList = ListPool<INode>.Get();
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, node);
var currentId = -1;
foreach (var activeNode in activeNodeList.OfType<AbstractMaterialNode>())
{
if (activeNode is IGeneratesFunction)

if (masterNode == null && activeNode.hasPreview)
{
var outputSlot = activeNode.GetOutputSlots<MaterialSlot>().FirstOrDefault();
if (outputSlot != null)
{
currentId++;
ids[activeNode.guid] = currentId;
surfaceDescriptionFunction.AddShaderChunk(string.Format("if ({0} == {1}) {{ surface.PreviewOutput = {2}; return surface; }}", outputIdProperty.referenceName, currentId, ShaderGenerator.AdaptNodeOutputForPreview(activeNode, outputSlot.id, activeNode.GetVariableNameForSlot(outputSlot.id))), false);
}
}
surfaceDescriptionFunction.AddShaderChunk(string.Format("{0} surface = ({0})0;", surfaceDescriptionName), false);
if (isMasterNode)
if (masterNode != null)
foreach (var input in node.GetInputSlots<MaterialSlot>())
if (masterNode is IMasterNode)
var foundEdges = graph.GetEdges(input.slotReference).ToArray();
if (foundEdges.Any())
{
var outputRef = foundEdges[0].outputSlot;
var fromNode = graph.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid);
surfaceDescriptionFunction.AddShaderChunk(string.Format("surface.{0} = {1};", input.shaderOutputName, fromNode.GetVariableNameForSlot(outputRef.slotId)), true);
}
else
foreach (var input in masterNode.GetInputSlots<MaterialSlot>())
surfaceDescriptionFunction.AddShaderChunk(string.Format("surface.{0} = {1};", input.shaderOutputName, input.GetDefaultValue(mode)), true);
var foundEdges = graph.GetEdges(input.slotReference).ToArray();
if (foundEdges.Any())
{
var outputRef = foundEdges[0].outputSlot;
var fromNode = graph.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid);
surfaceDescriptionFunction.AddShaderChunk(string.Format("surface.{0} = {1};", AbstractMaterialNode.GetHLSLSafeName(input.shaderOutputName), fromNode.GetVariableNameForSlot(outputRef.slotId)), true);
}
else
{
surfaceDescriptionFunction.AddShaderChunk(string.Format("surface.{0} = {1};", AbstractMaterialNode.GetHLSLSafeName(input.shaderOutputName), input.GetDefaultValue(mode)), true);
}
}
else
{
foreach (var slot in node.GetOutputSlots<MaterialSlot>())
surfaceDescriptionFunction.AddShaderChunk(string.Format("surface.{0} = {0};", node.GetVariableNameForSlot(slot.id)), true);
else if (masterNode.hasPreview)
{
foreach (var slot in masterNode.GetOutputSlots<MaterialSlot>())
surfaceDescriptionFunction.AddShaderChunk(string.Format("surface.{0} = {1};", AbstractMaterialNode.GetHLSLSafeName(slot.shaderOutputName), masterNode.GetVariableNameForSlot(slot.id)), true);
}
ListPool<INode>.Release(activeNodeList);
}
static void Visit(List<INode> outputList, Dictionary<Guid, INode> unmarkedNodes, INode node)
{
if (!unmarkedNodes.ContainsKey(node.guid))
return;
foreach (var slot in node.GetInputSlots<ISlot>())
{
foreach (var edge in node.owner.GetEdges(slot.slotReference))
{
var inputNode = node.owner.GetNodeFromGuid(edge.outputSlot.nodeGuid);
Visit(outputList, unmarkedNodes, inputNode);
}
}
unmarkedNodes.Remove(node.guid);
outputList.Add(node);
public string GetShader(AbstractMaterialNode node, GenerationMode mode, string name, out List<PropertyCollector.TextureInfo> configuredTextures, out PreviewMode previewMode)
public string GetShader(AbstractMaterialNode node, GenerationMode mode, string name, out List<PropertyCollector.TextureInfo> configuredTextures, out PreviewMode previewMode, out FloatShaderProperty outputIdProperty, Dictionary<Guid, int> ids = null)
if (node == null)
throw new ArgumentNullException("node");
bool isUber = node == null;
var vertexShader = new ShaderGenerator();
var surfaceDescriptionFunction = new ShaderGenerator();

surfaceInputs.AddShaderChunk("struct SurfaceInputs{", false);
surfaceInputs.Indent();
var requirements = GetRequierments(node);
var activeNodeList = ListPool<INode>.Get();
if (isUber)
{
var unmarkedNodes = GetNodes<INode>().Where(x => !(x is IMasterNode)).ToDictionary(x => x.guid);
while (unmarkedNodes.Any())
{
var unmarkedNode = unmarkedNodes.FirstOrDefault();
Visit(activeNodeList, unmarkedNodes, unmarkedNode.Value);
}
}
else
{
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, node);
}
var requirements = GetRequirements(activeNodeList);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresNormal, InterpolatorType.Normal, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresTangent, InterpolatorType.Tangent, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresBitangent, InterpolatorType.BiTangent, surfaceInputs);

if (requirements.requiresScreenPosition)
surfaceInputs.AddShaderChunk(string.Format("float4 {0};", ShaderGeneratorNames.ScreenPosition), false);
var activeNodeList = ListPool<INode>.Get();
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, node);
previewMode = PreviewMode.Preview2D;
foreach (var pNode in activeNodeList.OfType<AbstractMaterialNode>())
previewMode = PreviewMode.Preview3D;
if (!isUber)
if (pNode.previewMode == PreviewMode.Preview3D)
foreach (var pNode in activeNodeList.OfType<AbstractMaterialNode>())
previewMode = PreviewMode.Preview3D;
break;
if (pNode.previewMode == PreviewMode.Preview3D)
{
previewMode = PreviewMode.Preview3D;
break;
}
ListPool<INode>.Release(activeNodeList);
foreach (var channel in requirements.requiresMeshUVs.Distinct())
surfaceInputs.AddShaderChunk(string.Format("half4 {0};", channel.GetUVName()), false);

vertexShader.Deindent();
vertexShader.AddShaderChunk("}", false);
GenerateSurfaceDescriptionStruct(surfaceDescriptionStruct, node, node is IMasterNode);
var slots = new List<MaterialSlot>();
foreach (var activeNode in isUber ? activeNodeList.Where(n => ((AbstractMaterialNode)n).hasPreview) : ((INode)node).ToEnumerable())
{
if (activeNode is IMasterNode)
slots.AddRange(activeNode.GetInputSlots<MaterialSlot>());
else
slots.AddRange(activeNode.GetOutputSlots<MaterialSlot>());
}
GenerateSurfaceDescriptionStruct(surfaceDescriptionStruct, slots, !isUber);
outputIdProperty = new FloatShaderProperty
{
displayName = "OutputId",
generatePropertyBlock = false,
value = -1
};
if (isUber)
shaderProperties.AddShaderProperty(outputIdProperty);
activeNodeList,
this,
node is IMasterNode);
outputIdProperty: outputIdProperty,
ids: ids);
var finalShader = new ShaderGenerator();
finalShader.AddShaderChunk(string.Format(@"Shader ""{0}""", name), false);

finalShader.AddShaderChunk("ENDCG", false);
var masterNode = node as IMasterNode;
if (masterNode != null)
if (node != null && masterNode != null)
{
var subShaders = masterNode.GetSubshader(requirements, null);
foreach (var ss in subShaders)

{
finalShader.AddShaderChunk(ShaderGenerator.GetPreviewSubShader(node, requirements), false);
}
ListPool<INode>.Release(activeNodeList);
finalShader.Deindent();
finalShader.AddShaderChunk("}", false);

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


public string GetShader(string name, GenerationMode mode, out List<PropertyCollector.TextureInfo> configuredTextures)
{
PreviewMode pmode;
return GetShader(masterNode as AbstractMaterialNode, mode, name, out configuredTextures, out pmode);
FloatShaderProperty outputIdProperty;
return base.GetShader(masterNode as AbstractMaterialNode, mode, name, out configuredTextures, out pmode, out outputIdProperty);
}
public void LoadedFromDisk()

18
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/SlotValue.cs


return ChannelCount.Zero;
}
}
static readonly string[] k_ConcreteSlotValueTypeClassNames =
{
null,
"typeMatrix",
"typeMatrix",
"typeMatrix",
"typeTexture2D",
"typeFloat4",
"typeFloat3",
"typeFloat2",
"typeFloat1"
};
public static string ToClassName(this ConcreteSlotValueType type)
{
return k_ConcreteSlotValueTypeClassNames[(int)type];
}
}
}

236
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/SubGraph/LayeredShaderGraph.cs


[SerializeField]
private Shader m_Shader;
public Layer()
{}
public Layer() { }
public Guid guid
{

if (outputNode != null)
outputNode.onModified(outputNode, ModificationScope.Graph);
}
}
public override void OnBeforeSerialize()

public string GetShader(string name, GenerationMode mode, out List<PropertyCollector.TextureInfo> configuredTextures)
{
if (outputNode == null)
if (outputNode == null)
throw new InvalidOperationException();
var layerMap = new Dictionary<Guid, MaterialGraph>();

surfaceInputs.AddShaderChunk("struct SurfaceInputs{", false);
surfaceInputs.Indent();
var requirements = ShaderGraphRequirements.none;
foreach (var layer in layerMap)
requirements = requirements.Union(GetRequierments(layer.Value.masterNode as AbstractMaterialNode));
using (var activeNodesDisposable = ListPool<INode>.GetDisposable())
{
var activeNodes = activeNodesDisposable.value;
foreach (var layer in layerMap)
{
NodeUtils.DepthFirstCollectNodesFromNode(activeNodes, layer.Value.masterNode as AbstractMaterialNode);
}
NodeUtils.DepthFirstCollectNodesFromNode(activeNodes, outputNode);
var requirements = GetRequirements(activeNodes);
requirements = requirements.Union(GetRequierments(outputNode));
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresNormal, InterpolatorType.Normal, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresTangent, InterpolatorType.Tangent, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresBitangent, InterpolatorType.BiTangent, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresViewDir, InterpolatorType.ViewDirection, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresPosition, InterpolatorType.Position, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresNormal, InterpolatorType.Normal, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresTangent, InterpolatorType.Tangent, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresBitangent, InterpolatorType.BiTangent, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresViewDir, InterpolatorType.ViewDirection, surfaceInputs);
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresPosition, InterpolatorType.Position, surfaceInputs);
if (requirements.requiresVertexColor)
surfaceInputs.AddShaderChunk(string.Format("float4 {0};", ShaderGeneratorNames.VertexColor), false);
if (requirements.requiresVertexColor)
surfaceInputs.AddShaderChunk(string.Format("float4 {0};", ShaderGeneratorNames.VertexColor), false);
if (requirements.requiresScreenPosition)
surfaceInputs.AddShaderChunk(string.Format("float4 {0};", ShaderGeneratorNames.ScreenPosition), false);
if (requirements.requiresScreenPosition)
surfaceInputs.AddShaderChunk(string.Format("float4 {0};", ShaderGeneratorNames.ScreenPosition), false);
foreach (var channel in requirements.requiresMeshUVs.Distinct())
surfaceInputs.AddShaderChunk(string.Format("half4 {0};", channel.GetUVName()), false);
surfaceInputs.Deindent();
surfaceInputs.AddShaderChunk("};", false);
foreach (var channel in requirements.requiresMeshUVs.Distinct())
surfaceInputs.AddShaderChunk(string.Format("half4 {0};", channel.GetUVName()), false);
vertexShader.AddShaderChunk("GraphVertexInput PopulateVertexData(GraphVertexInput v){", false);
vertexShader.Indent();
vertexShader.AddShaderChunk("return v;", false);
vertexShader.Deindent();
vertexShader.AddShaderChunk("}", false);
surfaceInputs.Deindent();
surfaceInputs.AddShaderChunk("};", false);
var shaderProperties = new PropertyCollector();
vertexShader.AddShaderChunk("GraphVertexInput PopulateVertexData(GraphVertexInput v){", false);
vertexShader.Indent();
vertexShader.AddShaderChunk("return v;", false);
vertexShader.Deindent();
vertexShader.AddShaderChunk("}", false);
var baseGraph = layerMap.Values.FirstOrDefault();
if (baseGraph == null)
{
configuredTextures = new List<PropertyCollector.TextureInfo>();
return string.Empty;
}
var shaderProperties = new PropertyCollector();
var masterNode = baseGraph.masterNode;
GenerateSurfaceDescriptionStruct(surfaceDescriptionStruct, ((AbstractMaterialNode) masterNode).GetInputSlots<MaterialSlot>().ToList(), true);
var baseGraph = layerMap.Values.FirstOrDefault();
if (baseGraph == null)
{
configuredTextures = new List<PropertyCollector.TextureInfo>();
return string.Empty;
}
foreach (var layer in layerMap)
{
activeNodes.Clear();
NodeUtils.DepthFirstCollectNodesFromNode(activeNodes, layer.Value.masterNode as AbstractMaterialNode);
GenerateSurfaceDescription(
activeNodes,
layer.Value.masterNode as AbstractMaterialNode,
this,
surfaceDescriptionFunction,
shaderFunctionVisitor,
shaderProperties,
requirements,
mode,
LayerToFunctionName(layer.Key));
}
surfaceDescriptionStruct.AddShaderChunk("struct WeightsSurfaceDescription{", false);
surfaceDescriptionStruct.Indent();
foreach (var slot in outputNode.GetInputSlots<MaterialSlot>())
surfaceDescriptionStruct.AddShaderChunk(AbstractMaterialNode.ConvertConcreteSlotValueTypeToString(AbstractMaterialNode.OutputPrecision.@float, slot.concreteValueType) + " " + slot.shaderOutputName + ";", false);
var masterNode = baseGraph.masterNode;
GenerateSurfaceDescriptionStruct(surfaceDescriptionStruct, masterNode as AbstractMaterialNode, true);
surfaceDescriptionStruct.Deindent();
surfaceDescriptionStruct.AddShaderChunk("};", false);
foreach (var layer in layerMap)
{
activeNodes.Clear();
NodeUtils.DepthFirstCollectNodesFromNode(activeNodes, outputNode);
layer.Value.masterNode as AbstractMaterialNode,
activeNodes,
outputNode,
this,
true,
LayerToFunctionName(layer.Key));
}
surfaceDescriptionStruct.AddShaderChunk("struct WeightsSurfaceDescription{", false);
surfaceDescriptionStruct.Indent();
foreach (var slot in outputNode.GetInputSlots<MaterialSlot>())
surfaceDescriptionStruct.AddShaderChunk(AbstractMaterialNode.ConvertConcreteSlotValueTypeToString(AbstractMaterialNode.OutputPrecision.@float, slot.concreteValueType) + " " + slot.shaderOutputName + ";", false);
surfaceDescriptionStruct.Deindent();
surfaceDescriptionStruct.AddShaderChunk("};", false);
GenerateSurfaceDescription(
outputNode,
surfaceDescriptionFunction,
shaderFunctionVisitor,
shaderProperties,
requirements,
mode,
true,
"PopulateWeightsGraph",
"WeightsSurfaceDescription");
"PopulateWeightsGraph",
"WeightsSurfaceDescription");
string functionName = "PopulateSurfaceData";
string surfaceDescriptionName = "SurfaceDescription";
layerShaders.AddShaderChunk(string.Format("{0} {1}(SurfaceInputs IN) {{", surfaceDescriptionName, functionName), false);
layerShaders.Indent();
string functionName = "PopulateSurfaceData";
string surfaceDescriptionName = "SurfaceDescription";
layerShaders.AddShaderChunk(string.Format("{0} {1}(SurfaceInputs IN) {{", surfaceDescriptionName, functionName), false);
layerShaders.Indent();
layerShaders.AddShaderChunk("WeightsSurfaceDescription weights = PopulateWeightsGraph(IN);", false);
layerShaders.AddShaderChunk("SurfaceDescription result = (SurfaceDescription)0;", false);
layerShaders.AddShaderChunk("WeightsSurfaceDescription weights = PopulateWeightsGraph(IN);", false);
layerShaders.AddShaderChunk("SurfaceDescription result = (SurfaceDescription)0;", false);
foreach (var layer in layerMap)
{
layerShaders.AddShaderChunk(
string.Format(
"{0} {1} = {2}({3});",
surfaceDescriptionName,
LayerToFunctionName(layer.Key) + "_surface",
LayerToFunctionName(layer.Key),
"IN"), false);
foreach (var layer in layerMap)
{
layerShaders.AddShaderChunk(
string.Format(
"{0} {1} = {2}({3});",
surfaceDescriptionName,
LayerToFunctionName(layer.Key) + "_surface",
LayerToFunctionName(layer.Key),
"IN"), false);
layerShaders.AddShaderChunk(
string.Format("ScaleSurfaceDescription({0}_surface, weights.{0});", LayerToFunctionName(layer.Key)), false);
layerShaders.AddShaderChunk(
string.Format("ScaleSurfaceDescription({0}_surface, weights.{0});", LayerToFunctionName(layer.Key)), false);
layerShaders.AddShaderChunk(string.Format("AddSurfaceDescription(result, {0}_surface);", LayerToFunctionName(layer.Key)), false);
}
layerShaders.AddShaderChunk("return result;", false);
layerShaders.AddShaderChunk(string.Format("AddSurfaceDescription(result, {0}_surface);", LayerToFunctionName(layer.Key)), false);
}
layerShaders.AddShaderChunk("return result;", false);
layerShaders.Deindent();
layerShaders.AddShaderChunk("}", false);
layerShaders.Deindent();
layerShaders.AddShaderChunk("}", false);
var finalShader = new ShaderGenerator();
finalShader.AddShaderChunk(string.Format(@"Shader ""{0}""", name), false);
finalShader.AddShaderChunk("{", false);
finalShader.Indent();
var finalShader = new ShaderGenerator();
finalShader.AddShaderChunk(string.Format(@"Shader ""{0}""", name), false);
finalShader.AddShaderChunk("{", false);
finalShader.Indent();
finalShader.AddShaderChunk("Properties", false);
finalShader.AddShaderChunk("{", false);
finalShader.Indent();
finalShader.AddShaderChunk(shaderProperties.GetPropertiesBlock(2), false);
finalShader.Deindent();
finalShader.AddShaderChunk("}", false);
finalShader.AddShaderChunk("Properties", false);
finalShader.AddShaderChunk("{", false);
finalShader.Indent();
finalShader.AddShaderChunk(shaderProperties.GetPropertiesBlock(2), false);
finalShader.Deindent();
finalShader.AddShaderChunk("}", false);
finalShader.AddShaderChunk("CGINCLUDE", false);
finalShader.AddShaderChunk("#include \"UnityCG.cginc\"", false);
finalShader.AddShaderChunk(shaderFunctionVisitor.GetShaderString(2), false);
finalShader.AddShaderChunk(graphVertexInput, false);
finalShader.AddShaderChunk(surfaceInputs.GetShaderString(2), false);
finalShader.AddShaderChunk(surfaceDescriptionStruct.GetShaderString(2), false);
finalShader.AddShaderChunk(shaderProperties.GetPropertiesDeclaration(2), false);
finalShader.AddShaderChunk(vertexShader.GetShaderString(2), false);
finalShader.AddShaderChunk(surfaceDescriptionFunction.GetShaderString(2), false);
finalShader.AddShaderChunk(layerShaders.GetShaderString(2), false);
finalShader.AddShaderChunk("ENDCG", false);
finalShader.AddShaderChunk("CGINCLUDE", false);
finalShader.AddShaderChunk("#include \"UnityCG.cginc\"", false);
finalShader.AddShaderChunk(shaderFunctionVisitor.GetShaderString(2), false);
finalShader.AddShaderChunk(graphVertexInput, false);
finalShader.AddShaderChunk(surfaceInputs.GetShaderString(2), false);
finalShader.AddShaderChunk(surfaceDescriptionStruct.GetShaderString(2), false);
finalShader.AddShaderChunk(shaderProperties.GetPropertiesDeclaration(2), false);
finalShader.AddShaderChunk(vertexShader.GetShaderString(2), false);
finalShader.AddShaderChunk(surfaceDescriptionFunction.GetShaderString(2), false);
finalShader.AddShaderChunk(layerShaders.GetShaderString(2), false);
finalShader.AddShaderChunk("ENDCG", false);
if (masterNode != null)
{
var subShaders = masterNode.GetSubshader(requirements, null);
foreach (var ss in subShaders)
finalShader.AddShaderChunk(ss, false);
}
if (masterNode != null)
{
var subShaders = masterNode.GetSubshader(requirements, null);
foreach (var ss in subShaders)
finalShader.AddShaderChunk(ss, false);
finalShader.Deindent();
finalShader.AddShaderChunk("}", false);
configuredTextures = shaderProperties.GetConfiguredTexutres();
return finalShader.GetShaderString(0);
finalShader.Deindent();
finalShader.AddShaderChunk("}", false);
configuredTextures = shaderProperties.GetConfiguredTexutres();
return finalShader.GetShaderString(0);
}
public void LoadedFromDisk()

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


{
private static string[] UV = {"uv0", "uv1", "uv2", "uv3"};
public static int UVCount = 4;
public const string ScreenPosition = "screenPosition";
public const string VertexColor = "vertexColor";

public static string GetPreviewSubShader(AbstractMaterialNode node, ShaderGraphRequirements shaderGraphRequirements)
{
var activeNodeList = ListPool<INode>.Get();
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, node);
var interpolators = new ShaderGenerator();
var vertexShader = new ShaderGenerator();
var pixelShader = new ShaderGenerator();

CoordinateSpace.World);
var outputs = new ShaderGenerator();
var outputSlot = node.GetOutputSlots<MaterialSlot>().FirstOrDefault();
if (outputSlot != null)
if (node != null)
var result = string.Format("surf.{0}", node.GetVariableNameForSlot(outputSlot.id));
outputs.AddShaderChunk(string.Format("return {0};", AdaptNodeOutputForPreview(node, outputSlot.id, result)), true);
var outputSlot = node.GetOutputSlots<MaterialSlot>().FirstOrDefault();
if (outputSlot != null)
{
var result = string.Format("surf.{0}", node.GetVariableNameForSlot(outputSlot.id));
outputs.AddShaderChunk(string.Format("return {0};", AdaptNodeOutputForPreview(node, outputSlot.id, result)), true);
}
else
outputs.AddShaderChunk("return 0;", true);
outputs.AddShaderChunk("return 0;", true);
{
outputs.AddShaderChunk("return surf.PreviewOutput;", false);
}
var res = subShaderTemplate.Replace("${Interpolators}", interpolators.GetShaderString(0));
res = res.Replace("${VertexShader}", vertexShader.GetShaderString(0));

1
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/IControlAttribute.cs


using System.Reflection;
using UnityEngine.Experimental.UIElements;
using UnityEditor.ShaderGraph;
namespace UnityEditor.ShaderGraph.Drawing.Controls
{

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs


{
var headerContainer = new VisualElement {name = "header"};
{
headerContainer.Add(new VisualElement {name = "title", text = assetName});
headerContainer.Add(new Label(assetName) {name = "title"});
}
topContainer.Add(headerContainer);

{
var header = new VisualElement {name = "header"};
{
var title = new VisualElement {name = "title", text = "Properties"};
var title = new Label("Properties") {name = "title"};
header.Add(title);
var addPropertyButton = new Button(OnAddProperty) {text = "Add", name = "addButton"};

{
var header = new VisualElement {name = "header"};
{
var title = new VisualElement {name = "title", text = "Layers"};
var title = new Label("Layers") {name = "title"};
header.Add(title);
var addLayerButton = new Button(OnAddLayer) {text = "Add", name = "addButton"};

void OnPreviewChanged()
{
m_PreviewTextureView.image = m_PreviewHandle.texture ?? Texture2D.blackTexture;
m_PreviewTextureView.Dirty(ChangeType.Repaint);
}
void OnPreviewMeshChanged(ChangeEvent<UnityEngine.Object> changeEvent)

m_ContentContainer.Clear();
if (m_SelectedNodes.Count > 1)
{
var element = new VisualElement
var element = new Label(string.Format("{0} nodes selected.", m_SelectedNodes.Count))
name = "selectionCount",
text = string.Format("{0} nodes selected.", m_SelectedNodes.Count)
name = "selectionCount"
};
m_ContentContainer.Add(element);
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/NodeEditorHeaderView.cs


{
public class NodeEditorHeaderView : VisualElement
{
VisualElement m_Title;
VisualElement m_Type;
Label m_Title;
Label m_Type;
m_Title = new VisualElement { name = "title", text = "" };
m_Title = new Label("") { name = "title" };
Add(new VisualElement { name = "preType", text = "(" });
m_Type = new VisualElement { name = "type", text = "" };
Add(new Label("(") { name = "preType" });
m_Type = new Label("") { name = "type" };
Add(new VisualElement { name = "postType", text = ")" });
Add(new Label(")") { name = "postType" });
}
public string title

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs


{
if (m_GraphEditorView != null)
{
rootVisualContainer.Remove(m_GraphEditorView);
m_GraphEditorView.RemoveFromHierarchy();
m_GraphEditorView.Dispose();
}
m_GraphEditorView = value;

m_GraphEditorView.onConvertToSubgraphClick += ToSubGraph;
m_GraphEditorView.onShowInProjectClick += PingAsset;
rootVisualContainer.Add(graphEditorView);
rootVisualContainer.parent.clippingOptions = VisualElement.ClippingOptions.ClipContents;
this.GetRootVisualContainer().Add(graphEditorView);
}
}
}

if (m_GraphObject.graph.GetType() == typeof(MasterRemapGraph))
UpdateAbstractSubgraphOnDisk<MasterRemapGraph>(path);
graphObject.isDirty = false;
var windows = Resources.FindObjectsOfTypeAll<MaterialGraphEditWindow>();
foreach (var materialGraphEditWindow in windows)
{

143
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;

using UnityEditor.Graphing;
using UnityEditor.ShaderGraph;
using UnityEngine.Rendering;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;
namespace UnityEditor.ShaderGraph.Drawing

PreviewSceneResources m_SceneResources;
Texture2D m_ErrorTexture;
DateTime m_LastUpdate;
const bool k_UberShaderEnabled = true;
Shader m_UberShader;
string m_UberShaderString;
Dictionary<Guid, int> m_UberShaderIds;
FloatShaderProperty m_OutputIdProperty;
public PreviewRate previewRate { get; set; }

m_ErrorTexture.filterMode = FilterMode.Point;
m_ErrorTexture.Apply();
m_SceneResources = new PreviewSceneResources();
m_UberShader = ShaderUtil.CreateShaderAsset(k_EmptyShader);
m_UberShader.hideFlags = HideFlags.HideAndDontSave;
m_UberShaderIds = new Dictionary<Guid, int>();
foreach (var node in m_Graph.GetNodes<INode>())
AddPreview(node);

List<PreviewData> m_RenderList2D = new List<PreviewData>();
List<PreviewData> m_RenderList3D = new List<PreviewData>();
HashSet<Guid> m_NodesWith3DPreview = new HashSet<Guid>();
public void RenderPreviews()
{

if (m_DirtyShaders.Any())
{
m_NodesWith3DPreview.Clear();
foreach (var node in m_Graph.GetNodes<AbstractMaterialNode>())
{
if (node.previewMode == PreviewMode.Preview3D)
m_NodesWith3DPreview.Add(node.guid);
}
PropagateNodeSet(m_NodesWith3DPreview);
var count = m_DirtyShaders.Count;
var masterNodes = new List<INode>();
var uberNodes = new List<INode>();
foreach (var guid in m_DirtyShaders)
{
var node = m_Graph.GetNodeFromGuid(guid);
if (node == null)
continue;
if (!k_UberShaderEnabled || node is IMasterNode)
masterNodes.Add(node);
else
uberNodes.Add(node);
}
var count = Math.Min(uberNodes.Count, 1) + masterNodes.Count;
var sw = new Stopwatch();
sw.Start();
foreach (var nodeGuid in m_DirtyShaders)
foreach (var node in masterNodes)
UpdateShader(nodeGuid);
UpdateShader(node.guid);
if (uberNodes.Count > 0)
{
m_UberShaderIds.Clear();
m_UberShaderString = m_Graph.GetUberPreviewShader(m_UberShaderIds, out m_OutputIdProperty);
ShaderUtil.UpdateShaderAsset(m_UberShader, m_UberShaderString);
File.WriteAllText(Application.dataPath + "/../UberShader.shader", (m_UberShaderString ?? "null").Replace("UnityEngine.MaterialGraph", "Generated"));
var message = "RecreateUberShader: " + Environment.NewLine + m_UberShaderString;
if (MaterialGraphAsset.ShaderHasError(m_UberShader))
{
Debug.LogWarning(message);
ShaderUtil.ClearShaderErrors(m_UberShader);
ShaderUtil.UpdateShaderAsset(m_UberShader, k_EmptyShader);
}
else
{
Debug.Log(message);
}
foreach (var node in uberNodes)
{
PreviewData previewData;
if (!m_Previews.TryGetValue(node.guid, out previewData))
continue;
previewData.previewMode = m_NodesWith3DPreview.Contains(node.guid) ? PreviewMode.Preview3D : PreviewMode.Preview2D;
previewData.shader = m_UberShader;
}
i++;
EditorUtility.DisplayProgressBar("Shader Graph", string.Format("Compiling preview shaders ({0}/{1})", i, count), 0f);
}
sw.Stop();
Debug.LogFormat("Compiled preview shaders in {0} seconds", sw.Elapsed.TotalSeconds);
}
finally
{

// Fill MaterialPropertyBlock
m_PreviewPropertyBlock.Clear();
var outputIdName = m_OutputIdProperty != null ? m_OutputIdProperty.referenceName : null;
m_PreviewPropertyBlock.SetFloat(outputIdName, -1);
foreach (var nodeGuid in m_PropertyNodeGuids)
{
var node = m_Graph.GetNodeFromGuid<AbstractMaterialNode>(nodeGuid);

previewData.texture = m_ErrorTexture;
continue;
}
if (previewData.previewMode == PreviewMode.Preview2D)
m_RenderList2D.Add(previewData);
else

m_SceneResources.camera.orthographic = true;
foreach (var previewData in m_RenderList2D)
{
int outputId;
if (m_UberShaderIds.TryGetValue(previewData.node.guid, out outputId))
m_PreviewPropertyBlock.SetFloat(outputIdName, outputId);
m_PreviewMaterial.shader = previewData.shader;
m_SceneResources.camera.targetTexture = previewData.renderTexture;
var previousRenderTexure = RenderTexture.active;

m_SceneResources.camera.orthographic = false;
foreach (var previewData in m_RenderList3D)
{
int outputId;
if (m_UberShaderIds.TryGetValue(previewData.node.guid, out outputId))
m_PreviewPropertyBlock.SetFloat(outputIdName, outputId);
m_PreviewMaterial.shader = previewData.shader;
m_SceneResources.camera.targetTexture = previewData.renderTexture;
var previousRenderTexure = RenderTexture.active;

if (!m_Previews.TryGetValue(nodeGuid, out previewData))
return;
if (node is IMasterNode)
{
var materialGraph = (AbstractMaterialGraph) node.owner;
previewData.previewMode = m_NodesWith3DPreview.Contains(nodeGuid) ? PreviewMode.Preview3D : PreviewMode.Preview2D;
List<PropertyCollector.TextureInfo> defaultTextures;
PreviewMode pmode;
previewData.shaderString = materialGraph.GetShader(node, GenerationMode.Preview, node.guid + "_preview", out defaultTextures, out pmode);
previewData.previewMode = node.previewMode;
}
else if (!node.hasPreview || NodeUtils.FindEffectiveShaderStage(node, true) == ShaderStage.Vertex)
if (!(node is IMasterNode) && (!node.hasPreview || NodeUtils.FindEffectiveShaderStage(node, true) == ShaderStage.Vertex))
{
previewData.shaderString = null;
}

previewData.shaderString = m_Graph.GetPreviewShader(node, out mode);
previewData.previewMode = mode;
// Debug output
Debug.Log("RecreateShader: " + node.GetVariableNameForNode() + Environment.NewLine + previewData.shaderString);
File.WriteAllText(Application.dataPath + "/../GeneratedShader.shader", (previewData.shaderString ?? "null").Replace("UnityEngine.MaterialGraph", "Generated"));
if (string.IsNullOrEmpty(previewData.shaderString))

ShaderUtil.UpdateShaderAsset(previewData.shader, previewData.shaderString);
}
// Debug output
var message = "RecreateShader: " + node.GetVariableNameForNode() + Environment.NewLine + previewData.shaderString;
Debug.LogWarningFormat("ShaderHasError: {0}\n{1}", node.GetVariableNameForNode(), previewData.shaderString);
Debug.LogWarning(message);
else
Debug.Log(message);
}
void DestroyPreview(Guid nodeGuid, PreviewData previewData)

{
ReleaseUnmanagedResources();
}
const string k_EmptyShader = @"
Shader ""hidden/preview""
{
SubShader
{
Tags { ""RenderType""=""Opaque"" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include ""UnityCG.cginc""
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return 0;
}
ENDCG
}
}
}";
}
public delegate void OnPreviewChanged();

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GradientEdge.cs


edgeControl.edgeWidth = edgeWidth;
edgeControl.inputColor = isGhostEdge ? ghostColor : (selected ? selectedColor : inputColor);
edgeControl.outputColor = isGhostEdge ? ghostColor : (selected ? selectedColor : outputColor);
edgeControl.startCapColor = edgeControl.outputColor;
edgeControl.endCapColor = edgeControl.inputColor;
// edgeControl.startCapColor = edgeControl.outputColor;
// edgeControl.endCapColor = edgeControl.inputColor;
}
}
}

17
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs


var textureInfo = new List<PropertyCollector.TextureInfo>();
PreviewMode previewMode;
string shader = graph.GetShader(copyFromNode, GenerationMode.ForReals, assetName, out textureInfo, out previewMode);
FloatShaderProperty outputIdProperty;
string shader = graph.GetShader(copyFromNode, GenerationMode.ForReals, assetName, out textureInfo, out previewMode, out outputIdProperty);
GUIUtility.systemCopyBuffer = shader;
}
));

{
if (m_GraphView == null)
return;
var dependentNodes = new List<INode>();
NodeUtils.CollectNodesNodeFeedsInto(dependentNodes, inNode);
foreach (var node in dependentNodes)

var targetNodeView = m_GraphView.nodes.ToList().OfType<MaterialNodeView>().FirstOrDefault(x => x.node == targetNode);
var targetAnchor = targetNodeView.inputContainer.Children().OfType<Port>().FirstOrDefault(x => x.userData is ISlot && (x.userData as ISlot).Equals(targetSlot));
var edgeView = new GradientEdge
var edgeView = new Edge
edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
// edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
edgeView.output.Connect(edgeView);
edgeView.input.Connect(edgeView);
m_GraphView.AddElement(edgeView);

foreach (var anchorView in nodeView.outputContainer.Children().OfType<Port>())
{
var sourceSlot = (MaterialSlot)anchorView.userData;
foreach (var edgeView in anchorView.connections.OfType<GradientEdge>())
foreach (var edgeView in anchorView.connections.OfType<Edge>())
edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
// edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
var connectedNodeView = edgeView.input.node as MaterialNodeView;
if (connectedNodeView != null && !nodeViews.Contains(connectedNodeView))
{

var targetSlot = (MaterialSlot)anchorView.userData;
if (targetSlot.valueType != SlotValueType.Dynamic)
continue;
foreach (var edgeView in anchorView.connections.OfType<GradientEdge>())
foreach (var edgeView in anchorView.connections.OfType<Edge>())
edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
// edgeView.UpdateClasses(sourceSlot.concreteValueType, targetSlot.concreteValueType);
var connectedNodeView = edgeView.output.node as MaterialNodeView;
if (connectedNodeView != null && !nodeViews.Contains(connectedNodeView))
{

20
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs


UpdatePreviewTexture();
m_PreviewContainer.Add(m_PreviewTextureView);
var collapsePreviewButton = new VisualElement { name = "collapse", text = "▲" };
var collapsePreviewButton = new Label { name = "collapse", text = "▲" };
collapsePreviewButton.AddManipulator(new Clickable(() =>
{
node.owner.owner.RegisterCompleteObjectUndo("Collapse Preview");

m_PreviewContainer.Add(collapsePreviewButton);
var expandPreviewButton = new VisualElement { name = "expand", text = "▼" };
var expandPreviewButton = new Label { name = "expand", text = "▼" };
expandPreviewButton.AddManipulator(new Clickable(() =>
{
node.owner.owner.RegisterCompleteObjectUndo("Expand Preview");

if (node is PreviewNode)
{
var resizeHandle = new VisualElement { name = "resize", text = "" };
var resizeHandle = new Label { name = "resize", text = "" };
mainContainer.clippingOptions = ClippingOptions.ClipContents;
}
public AbstractMaterialNode node { get; private set; }

}
UpdatePortInputVisibilities();
foreach (var control in m_ControlViews)
{
var listener = control as INodeModificationListener;
if (listener != null)
listener.OnNodeModified(scope);
}
}
void AddSlots(IEnumerable<MaterialSlot> slots)

if (slot.hidden)
continue;
var port = InstantiatePort(Orientation.Horizontal, slot.isInputSlot ? Direction.Input : Direction.Output, typeof(Vector4));
port.capabilities &= ~Capabilities.Movable;
var port = InstantiatePort(Orientation.Horizontal, slot.isInputSlot ? Direction.Input : Direction.Output, null);
port.visualClass = slot.concreteValueType.ToClassName();
if (slot.isOutputSlot)
{

{
var slot = (MaterialSlot) anchor.userData;
anchor.portName = slot.displayName;
anchor.visualClass = slot.concreteValueType.ToClassName();
}
foreach (var attacher in m_Attachers)

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PortInputView.cs


Add(m_EdgeControl);
m_Container.visible = m_EdgeControl.visible = m_Control != null;
clippingOptions = ClippingOptions.NoClipping;
m_Container.clippingOptions = ClippingOptions.ClipAndCacheContents;
}
protected override void OnStyleResolved(ICustomStyle styles)

36
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PreviewTextureView.cs


namespace UnityEditor.ShaderGraph.Drawing
{
public sealed class PreviewTextureView : VisualElement
public sealed class PreviewTextureView : Image
Texture m_Image;
public Texture image
{
get { return m_Image; }
set
{
if (value == m_Image)
return;
m_Image = value;
Dirty(ChangeType.Repaint);
}
}
// Texture m_Image;
//
// public Texture image
// {
// get { return m_Image; }
// set
// {
// if (value == m_Image)
// return;
// m_Image = value;
// Dirty(ChangeType.Repaint);
// }
// }
public override void DoRepaint()
{
EditorGUI.DrawPreviewTexture(contentRect, image);
}
// public override void DoRepaint()
// {
// EditorGUI.DrawPreviewTexture(contentRect, image);
// }
}
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs


namespace UnityEditor.ShaderGraph.Drawing
{
public class ToolbarView : VisualElement
public class ToolbarView : BaseTextElement
{
public ToolbarView()
{

public class ToolbarButtonView : VisualElement
public class ToolbarButtonView : BaseTextElement
{
public ToolbarButtonView()
{

public class ToolbarSeparatorView : VisualElement
public class ToolbarSeparatorView : BaseTextElement
{
public ToolbarSeparatorView()
{

public class ToolbarSpaceView : VisualElement
public class ToolbarSpaceView : BaseTextElement
{
public ToolbarSpaceView()
{

15
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Shaders/Checkerboard.shader


#include "UnityCG.cginc"
static const float rows = 32;
static const float columns = 32;
static const float4 col1 = float4(32.0/255.0, 32.0/255.0, 32.0/255.0, 1.0);
static const float4 col2 = float4(42.0/255.0, 42.0/255.0, 42.0/255.0, 1.0);
static const float rows = 24;
static const float columns = 24;
float3 col1 = float3(32.0/255.0, 32.0/255.0, 32.0/255.0);
float3 col2 = float3(42.0/255.0, 42.0/255.0, 42.0/255.0);
if (!IsGammaSpace()) {
col1 = GammaToLinearSpace(col1);
col2 = GammaToLinearSpace(col2);
}
return lerp(col1, col2, step(fmod(total, 2.0), 0.5));
return float4(lerp(col1, col2, step(fmod(total, 2.0), 0.5)), 1.0);
}
ENDCG
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss


}
MaterialNodeView > .mainContainer > #left > #previewContainer.expanded > #collapse {
background-color: rgba(0, 0, 0, 0.5);
text-color: rgba(255, 255, 255, 0.75);
border-color: rgba(255, 255, 255, 0.75);
border-radius: 2;
text-alignment: middle-center;
position-left: 87;

}
MaterialNodeView > .mainContainer > #left > #previewContainer.expanded:hover > #collapse {
background-color: rgba(0, 0, 0, 0.5);
text-color: rgba(255, 255, 255, 0.75);
border-color: rgba(255, 255, 255, 0.75);
border-top-width: 1;
border-bottom-width: 1;
border-left-width: 1;

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/Add.ShaderGraph.meta


fileFormatVersion: 2
guid: 6b526455b2500458f9e378534990c26c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/AddSubGraph.ShaderGraph.meta


fileFormatVersion: 2
guid: f20399762b45e564fbe7b65ab460a5b6
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/Cracks.ShaderGraph.meta


fileFormatVersion: 2
guid: a8cb0d181b460aa4bac2693ce3bfc1ad
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/Gradient.ShaderGraph.meta


fileFormatVersion: 2
guid: 090ac3a2dd039884ba2dfa3b2ca34452
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/Multiply.ShaderGraph.meta


fileFormatVersion: 2
guid: 3b1382b7bb78a4162b89a4f706240f08
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/SplitCombine.ShaderGraph.meta


fileFormatVersion: 2
guid: 3782c62dd61732042aed83e579a22e5f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures:
- Texture_BBB67AA7: {fileID: 2800000, guid: bd7bebe6d50204bf5837af485488c872, type: 3}
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/TextureSample.ShaderGraph.meta


fileFormatVersion: 2
guid: 0bf1c65d8d6ab4c1f8476fb1cf9eb20a
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures:
- Texture_AD00096F: {fileID: 2800000, guid: 55fd692de65e703408cbda23b0eae8d0, type: 3}
ScriptedImporter:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

4
MaterialGraphProject/Assets/graphs_PartyPreview.mat


m_Texture: {fileID: 2800000, guid: 7296f51323ae9485a9c834c4e3d722ed, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Texture2D_8897CB1D_Tex:
m_Texture: {fileID: 2800000, guid: 9d64a9e7ca6864704ae6b8ca7afc9d85, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Float_D2D9489B: 3
m_Colors: []

2
MaterialGraphProject/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2018.1.0a4
m_EditorVersion: 2018.1.0a6

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

7
MaterialGraphProject/Assets/Beachball.ShaderGraph.meta


fileFormatVersion: 2
guid: b141c720617d37f45a2fd27af59ccf42
ScriptedImporter:
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

22
MaterialGraphProject/Assets/Beachball.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Beachball
m_Shader: {fileID: 4800000, guid: b141c720617d37f45a2fd27af59ccf42, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Floats: []
m_Colors: []

8
MaterialGraphProject/Assets/Beachball.mat.meta


fileFormatVersion: 2
guid: b232af1498b13d14db58368a73b45744
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/INodeModificationListener.cs


using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph.Drawing
{
public interface INodeModificationListener
{
void OnNodeModified(ModificationScope scope);
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/INodeModificationListener.cs.meta


fileFormatVersion: 2
guid: 22f268830a014848b3a8bfdd5142a2d0
timeCreated: 1510751718

/MaterialGraphProject/Packages → /MaterialGraphProject/UnityPackageManager

正在加载...
取消
保存