Patrick Fournier
7 年前
当前提交
de93c238
共有 1065 个文件被更改,包括 1455 次插入 和 936 次删除
-
2.gitignore
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Assets/IGraphAsset.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Assets/SerializableGraphAsset.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/Edge.cs
-
4MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/NodeUtils.cs
-
92MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/SerializableGraph.cs
-
15MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/SerializableGraphObject.cs
-
5MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/SerializableNode.cs
-
18MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/SerializableSlot.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/SlotType.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/DrawState.cs
-
21MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/GraphChange.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/GraphDrawingData.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/IEdge.cs
-
10MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/IGraph.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/IGraphObject.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/INode.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/IOnAssetEnabled.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/ISlot.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Interfaces/SlotReference.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Testing/IntegrationTests/SerializationTests.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Testing/UnitTests/SerializedGraphTests.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Util/DictionaryPool.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Util/ListPool.cs
-
8MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Util/Logging.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Util/ObjectPool.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Util/PooledObject.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Util/QueuePool.cs
-
51MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Util/SerializationHelper.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Util/StackPool.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/ChannelBlendNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/CommonMatrixType.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/ConstantType.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/FractalNode.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/FunctionNAddNode.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/FunctionNInNOut.cs
-
7MaterialGraphProject/Assets/NewNodes/Editor/Keep/BlendModeNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/Keep/BlendModesEnum.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Keep/ColorBalanceNode.cs
-
9MaterialGraphProject/Assets/NewNodes/Editor/Keep/ConstantsNode.cs
-
17MaterialGraphProject/Assets/NewNodes/Editor/Keep/GradientNode.cs
-
97MaterialGraphProject/Assets/NewNodes/Editor/Keep/HeightToNormalNode.cs
-
5MaterialGraphProject/Assets/NewNodes/Editor/Keep/LightProbeNode.cs
-
7MaterialGraphProject/Assets/NewNodes/Editor/Keep/ParallaxNode.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Keep/RadialShearNode.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Keep/RandomRangeNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/Keep/ReciprocalSqrtNode.cs
-
5MaterialGraphProject/Assets/NewNodes/Editor/Keep/ReflectionProbeNode.cs
-
7MaterialGraphProject/Assets/NewNodes/Editor/Keep/SamplerStateNode.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Keep/ScaleOffsetNode.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Keep/TangentToWorldNode.cs
-
39MaterialGraphProject/Assets/NewNodes/Editor/Keep/TextureSamplerNode.cs
-
8MaterialGraphProject/Assets/NewNodes/Editor/Keep/TransformNode.cs
-
6MaterialGraphProject/Assets/NewNodes/Editor/Keep/UVTriPlanar.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Kill/AACheckerBoard3dNode.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Kill/AACheckerBoardNode.cs
-
7MaterialGraphProject/Assets/NewNodes/Editor/Kill/MultiLayerParallaxNode.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Kill/POMNode.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/Kill/ScatterNode.cs
-
3MaterialGraphProject/Assets/NewNodes/Editor/Kill/SphereWarpNode.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/Kill/SphericalIndentationNode.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/Kill/ToggleNode.cs
-
5MaterialGraphProject/Assets/NewNodes/Editor/Kill/VertexNormalNode.cs
-
537MaterialGraphProject/Assets/PartyPreview.ShaderGraph
-
3MaterialGraphProject/Assets/PartyPreview.ShaderGraph.meta
-
4MaterialGraphProject/Assets/SRP.meta
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline.meta
-
2MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Camera/CameraSwitcher.cs
-
82MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Camera/FreeCamera.cs
-
19MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/CommandBufferPool.cs
-
107MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugActionManager.cs
-
14MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugItemHandler.cs
-
6MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugItemUI.cs
-
3MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugMenuManager.cs
-
56MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugMenuState.cs
-
3MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugMenuUI.cs
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugMenuUpdater.cs
-
14MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugPanel.cs
-
39MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/DebugPanelUI.cs
-
1MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/Debugging.cs
-
13MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/Editor/DebugMenuEditor.cs
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/Serialization/DebugItemStateBool.cs
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/Serialization/DebugItemStateColor.cs
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/Serialization/DebugItemStateFloat.cs
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/Serialization/DebugItemStateInt.cs
-
4MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/Debugging/Serialization/DebugItemStateUInt.cs
-
2MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderGenerator/Editor/CSharpToHLSL.cs
-
193MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/BSDF.hlsl
-
26MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl
-
46MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/CommonLighting.hlsl
-
29MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/CommonMaterial.hlsl
-
13MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/EntityLighting.hlsl
-
8MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/Fibonacci.hlsl
-
174MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl
-
9MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/PerPixelDisplacement.hlsl
-
9MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/Shadow.hlsl
-
310MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/ShadowAlgorithms.hlsl
-
46MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/ShadowSampling.hlsl
-
10MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/VolumeRendering.hlsl
-
32MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/Core/ShaderLibrary/Wind.hlsl
|
|||
namespace UnityEngine.Graphing |
|||
namespace UnityEditor.Graphing |
|||
{ |
|||
} |
|
|||
namespace UnityEngine.Graphing |
|||
namespace UnityEditor.Graphing |
|||
{ |
|||
} |
|
|||
using System; |
|||
using UnityEngine; |
|||
using Object = System.Object; |
|||
namespace UnityEngine.Graphing |
|||
namespace UnityEditor.Graphing |
|||
public void LogFormat(LogType logType, Object context, string format, params object[] args) |
|||
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) |
|||
public void LogException(Exception exception, Object context) |
|||
public void LogException(Exception exception, UnityEngine.Object context) |
|||
{ |
|||
Console.WriteLine("{0} - {1}", context, exception); |
|||
} |
|
|||
using System.Linq; |
|||
using JetBrains.Annotations; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
namespace UnityEngine.MaterialGraph |
|||
namespace UnityEditor.ShaderGraph |
|||
public class HeightToNormalNode : CodeFunctionNode |
|||
public class HeightToNormalNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireMeshUV |
|||
public const int TextureInput = 0; |
|||
public const int TexCoordInput = 1; |
|||
public const int TexOffsetInput = 2; |
|||
public const int StrengthInput = 3; |
|||
public const int NormalOutput = 4; |
|||
|
|||
const string TextureInputName = "Texture"; |
|||
const string TexCoordInputName = "UV"; |
|||
const string TexOffsetInputName = "Offset"; |
|||
const string StrengthInputName = "Strength"; |
|||
const string NormalOutputName = "Normal"; |
|||
|
|||
UpdateNodeAfterDeserialization(); |
|||
protected override MethodInfo GetFunctionToConvert() |
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
return GetType().GetMethod("Unity_HeightToNormal", BindingFlags.Static | BindingFlags.NonPublic); |
|||
AddSlot(new Texture2DMaterialSlot(TextureInput, TextureInputName, TextureInputName, SlotType.Input)); |
|||
AddSlot(new Vector2MaterialSlot(TexCoordInput, TexCoordInputName, TexCoordInputName, SlotType.Input, Vector2.zero)); |
|||
AddSlot(new Vector1MaterialSlot(TexOffsetInput, TexOffsetInputName, TexOffsetInputName, SlotType.Input, 0.005f)); |
|||
AddSlot(new Vector1MaterialSlot(StrengthInput, StrengthInputName, StrengthInputName, SlotType.Input, 8f)); |
|||
AddSlot(new Vector3MaterialSlot(NormalOutput, NormalOutputName, NormalOutputName, SlotType.Output, Vector3.zero)); |
|||
static string Unity_HeightToNormal( |
|||
[Slot(0, Binding.None)] Texture2D heightmap, |
|||
[Slot(1, Binding.MeshUV0)] Vector1 texCoord, |
|||
[Slot(2, Binding.None, 0.005f, 0, 0, 0)] Vector1 texOffset, |
|||
[Slot(3, Binding.None, 8f, 0, 0, 0)] Vector1 strength, |
|||
[Slot(4, Binding.None)] out Vector1 normal) |
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
return |
|||
@"
|
|||
{ |
|||
float2 offsetU = float2(texCoord.x + texOffset, texCoord.y); |
|||
float2 offsetV = float2(texCoord.x, texCoord.y + texOffset); |
|||
var textureInput = GetSlotValue(TextureInput, generationMode); |
|||
var texCoordInput = RequiresMeshUV(UVChannel.uv0) |
|||
? string.Format("{0}.xy", UVChannel.uv0.GetUVName()) |
|||
: GetSlotValue(TexCoordInput, generationMode); |
|||
var texOffsetInput = GetSlotValue(TexOffsetInput, generationMode); |
|||
var strengthInput = GetSlotValue(StrengthInput, generationMode); |
|||
var normalOutput = GetVariableNameForSlot(NormalOutput); |
|||
|
|||
visitor.AddShaderChunk(string.Format("{0}3 {1};", precision, normalOutput), true); |
|||
visitor.AddShaderChunk("{", false); |
|||
visitor.Indent(); |
|||
{ |
|||
visitor.AddShaderChunk(string.Format("{0}2 offsetU = float2({1}.x + {2}, {1}.y);", precision, texCoordInput, texOffsetInput), true); |
|||
visitor.AddShaderChunk(string.Format("{0}2 offsetV = float2({1}.x, {1}.y + {2});", precision, texCoordInput, texOffsetInput), true); |
|||
float normalSample = 0; |
|||
float uSample = 0; |
|||
float vSample = 0; |
|||
visitor.AddShaderChunk(string.Format("{0} normalSample = UNITY_SAMPLE_TEX2D({1}, {2});", precision, textureInput, texCoordInput), true); |
|||
visitor.AddShaderChunk(string.Format("{0} uSample = UNITY_SAMPLE_TEX2D({1}, offsetU);", precision, textureInput), true); |
|||
visitor.AddShaderChunk(string.Format("{0} vSample = UNITY_SAMPLE_TEX2D({1}, offsetV);", precision, textureInput), true); |
|||
#ifdef UNITY_COMPILER_HLSL |
|||
normalSample = heightmap.Sample(my_linear_repeat_sampler, texCoord).r; |
|||
uSample = heightmap.Sample(my_linear_repeat_sampler, offsetU).r; |
|||
vSample = heightmap.Sample(my_linear_repeat_sampler, offsetV).r; |
|||
#endif
|
|||
visitor.AddShaderChunk(string.Format("{0}3 va = float3(1, 0, (uSample - normalSample) * {1});", precision, strengthInput), true); |
|||
visitor.AddShaderChunk(string.Format("{0}3 vb = float3(0, 1, (vSample - normalSample) * {1});", precision, strengthInput), true); |
|||
visitor.AddShaderChunk(string.Format("{0} = cross(va, vb);", normalOutput), true); |
|||
} |
|||
visitor.Deindent(); |
|||
visitor.AddShaderChunk("}", false); |
|||
} |
|||
float uMinusNormal = uSample - normalSample; |
|||
float vMinusNormal = vSample - normalSample; |
|||
public override bool hasPreview |
|||
{ |
|||
get { return true; } |
|||
} |
|||
uMinusNormal = uMinusNormal * strength; |
|||
vMinusNormal = vMinusNormal * strength; |
|||
public bool RequiresMeshUV(UVChannel channel) |
|||
{ |
|||
if (channel != UVChannel.uv0) |
|||
{ |
|||
return false; |
|||
} |
|||
float3 va = float3(1, 0, uMinusNormal); |
|||
float3 vb = float3(0, 1, vMinusNormal); |
|||
var uvSlot = FindInputSlot<MaterialSlot>(TexCoordInput); |
|||
if (uvSlot == null) |
|||
return true; |
|||
normals = cross(va, vb); |
|||
} |
|||
";
|
|||
var edges = owner.GetEdges(uvSlot.slotReference).ToList(); |
|||
return edges.Count == 0; |
|||
} |
|||
} |
|||
} |
537
MaterialGraphProject/Assets/PartyPreview.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: fd470011795144262bf5aa4bf5f396a1 |
|||
guid: 22c204b70537f8d46a054fa00bf16298 |
|||
timeCreated: 1505274236 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue