Matt Dean
8 年前
当前提交
2c5dc651
共有 93 个文件被更改,包括 1904 次插入 和 629 次删除
-
8MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Function3Input.cs
-
34MaterialGraphProject/Assets/Matt&Andre/FmodNode.cs
-
24MaterialGraphProject/Assets/Matt&Andre/FmodNode.cs.meta
-
28MaterialGraphProject/Assets/Matt&Andre/LogNode.cs
-
24MaterialGraphProject/Assets/Matt&Andre/LogNode.cs.meta
-
34MaterialGraphProject/Assets/Matt&Andre/ExponentialNode.cs
-
24MaterialGraphProject/Assets/Matt&Andre/ExponentialNode.cs.meta
-
90MaterialGraphProject/Assets/Matt&Andre/HSVtoRGBNode.cs
-
24MaterialGraphProject/Assets/Matt&Andre/HSVtoRGBNode.cs.meta
-
90MaterialGraphProject/Assets/Matt&Andre/HueNode.cs
-
24MaterialGraphProject/Assets/Matt&Andre/HueNode.cs.meta
-
58MaterialGraphProject/Assets/Matt&Andre/InverseLerpNode.cs
-
24MaterialGraphProject/Assets/Matt&Andre/InverseLerpNode.cs.meta
-
58MaterialGraphProject/Assets/Matt&Andre/OneMinus.cs
-
16MaterialGraphProject/Assets/Matt&Andre/OneMinus.cs.meta
-
24MaterialGraphProject/Assets/Matt/Contrast.cs.meta
-
96MaterialGraphProject/Assets/Matt&Andre/RGBtoHSVNode.cs
-
24MaterialGraphProject/Assets/Matt&Andre/RGBtoHSVNode.cs.meta
-
24MaterialGraphProject/Assets/Matt&Andre/RemapNode.cs.meta
-
34MaterialGraphProject/Assets/Matt&Andre/SquareRootNode.cs
-
434MaterialGraphProject/Assets/TestAssets/Sky1.jpg
-
152MaterialGraphProject/Assets/TestAssets/ColorGuide.tif.meta
-
152MaterialGraphProject/Assets/TestAssets/Gradient.png.meta
-
152MaterialGraphProject/Assets/TestAssets/sfn_vertexcolor.png.meta
-
25MaterialGraphProject/Assets/Matt&Andre/ComponentSplitNode.cs
-
9MaterialGraphProject/Assets/Matt&Andre.meta
-
9MaterialGraphProject/Assets/Matt.meta
-
183MaterialGraphProject/Assets/Matt&Andre/RemapNode.cs
-
64MaterialGraphProject/Assets/Matt/Contrast.cs
-
15MaterialGraphProject/Assets/Matt/DDX.cs
-
12MaterialGraphProject/Assets/Matt/DDX.cs.meta
-
31MaterialGraphProject/Assets/Matt/DDXY.cs
-
12MaterialGraphProject/Assets/Matt/DDXY.cs.meta
-
15MaterialGraphProject/Assets/Matt/DDY.cs
-
12MaterialGraphProject/Assets/Matt/DDY.cs.meta
-
104MaterialGraphProject/Assets/Matt/DepthTexture.cs
-
44MaterialGraphProject/Assets/Matt/Desaturate.cs
-
12MaterialGraphProject/Assets/Matt/Desaturate.cs.meta
-
15MaterialGraphProject/Assets/Matt/Distance.cs
-
12MaterialGraphProject/Assets/Matt/Distance.cs.meta
-
104MaterialGraphProject/Assets/Matt/MotionVectorTexture.cs
-
12MaterialGraphProject/Assets/Matt/MotionVectorTexture.cs.meta
-
48MaterialGraphProject/Assets/Matt/NormalBlend.cs
-
12MaterialGraphProject/Assets/Matt/NormalBlend.cs.meta
-
42MaterialGraphProject/Assets/Matt/RGBtoLuminance.cs
-
12MaterialGraphProject/Assets/Matt/RGBtoLuminance.cs.meta
-
56MaterialGraphProject/Assets/Matt/Saturation.cs
-
12MaterialGraphProject/Assets/Matt/Saturation.cs.meta
-
9MaterialGraphProject/Assets/NewNodes.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/FmodNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/FmodNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/LogNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/LogNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/CeilNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/CeilNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt/DepthTexture.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/ExponentialNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/ExponentialNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/FloorNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/FloorNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/FractionNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/FractionNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/HSVtoRGBNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/HSVtoRGBNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/HueNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/HueNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/InverseLerpNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/InverseLerpNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/OneMinus.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/OneMinus.cs.meta
-
0/MaterialGraphProject/Assets/Matt/Contrast.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/RGBtoHSVNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/RGBtoHSVNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/RemapNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/RoundNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/RoundNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/SignNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/SignNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/SquareRootNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/SquareRootNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/StepNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/StepNode.cs.meta
-
0/MaterialGraphProject/Assets/Matt&Andre/TruncNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/TruncNode.cs.meta
-
0/MaterialGraphProject/Assets/TestAssets.meta
-
0/MaterialGraphProject/Assets/TestAssets
-
0/MaterialGraphProject/Assets/Matt&Andre/ComponentSplitNode.cs
-
0/MaterialGraphProject/Assets/Matt&Andre/ComponentSplitNode.cs.meta
-
0/MaterialGraphProject/Assets/CubemapNode.cs
-
0/MaterialGraphProject/Assets/CubemapNode.cs.meta
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Advanced/Fmod")] |
|||
public class FmodNode : Function2Input |
|||
{ |
|||
public FmodNode () |
|||
{ |
|||
name = "Fmod"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "fmod"; |
|||
} |
|||
} |
|||
} |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Advanced/Fmod")] |
|||
public class FmodNode : Function2Input |
|||
{ |
|||
public FmodNode () |
|||
{ |
|||
name = "Fmod"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "fmod"; |
|||
} |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 058897be65bcd42f6ba05a4918c46629 |
|||
timeCreated: 1490745697 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 058897be65bcd42f6ba05a4918c46629 |
|||
timeCreated: 1490745697 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Advanced/Log")] |
|||
public class LogNode : Function1Input |
|||
{ |
|||
public LogNode() |
|||
{ |
|||
name = "Log"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "log"; } |
|||
} |
|||
} |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Advanced/Log")] |
|||
public class LogNode : Function1Input |
|||
{ |
|||
public LogNode() |
|||
{ |
|||
name = "Log"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "log"; } |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: a8880ad54646f8b469de662f4f0785c9 |
|||
timeCreated: 1490740341 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: a8880ad54646f8b469de662f4f0785c9 |
|||
timeCreated: 1490740341 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Basic/Exponential")] |
|||
public class ExponentialNode : Function1Input |
|||
{ |
|||
public ExponentialNode () |
|||
{ |
|||
name = "Exponential"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "exp"; |
|||
} |
|||
} |
|||
} |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Basic/Exponential")] |
|||
public class ExponentialNode : Function1Input |
|||
{ |
|||
public ExponentialNode () |
|||
{ |
|||
name = "Exponential"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "exp"; |
|||
} |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 2caea2ece6d6b4cbebf8bd122b11258a |
|||
timeCreated: 1490745697 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 2caea2ece6d6b4cbebf8bd122b11258a |
|||
timeCreated: 1490745697 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Color/HSVtoRGB")] |
|||
public class HSVtoRGBNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public HSVtoRGBNode () |
|||
{ |
|||
name = "HSVtoRGB"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_hsvtorgb_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot () |
|||
{ |
|||
return new MaterialSlot (InputSlotId, GetInputSlotName (), kInputSlotShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot () |
|||
{ |
|||
return new MaterialSlot (OutputSlotId, GetOutputSlotName (), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
//TODO:Externalize
|
|||
//Reference code from:https://github.com/Unity-Technologies/PostProcessing/blob/master/PostProcessing/Resources/Shaders/ColorGrading.cginc#L175
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk (precision + "4 K = " + precision + "4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);", false); |
|||
outputString.AddShaderChunk (precision + "3 P = abs(frac(arg1.xxx + K.xyz) * 6.0 - K.www);", false); |
|||
outputString.AddShaderChunk ("return arg1.z * lerp(K.xxx, saturate(P - K.xxx), arg1.y);", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Color/HSVtoRGB")] |
|||
public class HSVtoRGBNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public HSVtoRGBNode () |
|||
{ |
|||
name = "HSVtoRGB"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_hsvtorgb_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot () |
|||
{ |
|||
return new MaterialSlot (InputSlotId, GetInputSlotName (), kInputSlotShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot () |
|||
{ |
|||
return new MaterialSlot (OutputSlotId, GetOutputSlotName (), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
//TODO:Externalize
|
|||
//Reference code from:https://github.com/Unity-Technologies/PostProcessing/blob/master/PostProcessing/Resources/Shaders/ColorGrading.cginc#L175
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk (precision + "4 K = " + precision + "4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);", false); |
|||
outputString.AddShaderChunk (precision + "3 P = abs(frac(arg1.xxx + K.xyz) * 6.0 - K.www);", false); |
|||
outputString.AddShaderChunk ("return arg1.z * lerp(K.xxx, saturate(P - K.xxx), arg1.y);", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e3b0a3eacac60414c9f7594fc5286799 |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: e3b0a3eacac60414c9f7594fc5286799 |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Color/Hue")] |
|||
public class HueNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public HueNode() |
|||
{ |
|||
name = "Hue"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_hue_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot() |
|||
{ |
|||
return new MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotShaderName, SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
//TODO:Externalize
|
|||
//Reference code from:https://github.com/Unity-Technologies/PostProcessing/blob/master/PostProcessing/Resources/Shaders/ColorGrading.cginc#L175
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("arg1"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk(precision + "4 K = " + precision + "4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);", false); |
|||
outputString.AddShaderChunk(precision + "3 P = abs(frac(arg1.xxx + K.xyz) * 6.0 - K.www);", false); |
|||
outputString.AddShaderChunk("return 1 * lerp(K.xxx, saturate(P - K.xxx), 1);", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Color/Hue")] |
|||
public class HueNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public HueNode() |
|||
{ |
|||
name = "Hue"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_hue_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot() |
|||
{ |
|||
return new MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotShaderName, SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
//TODO:Externalize
|
|||
//Reference code from:https://github.com/Unity-Technologies/PostProcessing/blob/master/PostProcessing/Resources/Shaders/ColorGrading.cginc#L175
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("arg1"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk(precision + "4 K = " + precision + "4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);", false); |
|||
outputString.AddShaderChunk(precision + "3 P = abs(frac(arg1.xxx + K.xyz) * 6.0 - K.www);", false); |
|||
outputString.AddShaderChunk("return 1 * lerp(K.xxx, saturate(P - K.xxx), 1);", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 083caf0fe7ff62f438e121e934355461 |
|||
timeCreated: 1490973460 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 083caf0fe7ff62f438e121e934355461 |
|||
timeCreated: 1490973460 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Interpolation/InverseLerp")] |
|||
public class InverseLerpNode : Function3Input, IGeneratesFunction |
|||
{ |
|||
public InverseLerpNode () |
|||
{ |
|||
name = "InverseLerp"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_inverselerp_" + precision; |
|||
} |
|||
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1", "arg2", "arg3"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk ("return (arg3 - arg1)/(arg2 - arg1);", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Interpolation/InverseLerp")] |
|||
public class InverseLerpNode : Function3Input, IGeneratesFunction |
|||
{ |
|||
public InverseLerpNode () |
|||
{ |
|||
name = "InverseLerp"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_inverselerp_" + precision; |
|||
} |
|||
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1", "arg2", "arg3"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk ("return (arg3 - arg1)/(arg2 - arg1);", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 25857c1c6903f40f382b8857bba28668 |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 25857c1c6903f40f382b8857bba28668 |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Range/OneMinus")] |
|||
public class OneMinusNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public OneMinusNode () |
|||
{ |
|||
name = "OneMinus"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_oneminus_" + 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 arg1 * -1 + 1;", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Range/OneMinus")] |
|||
public class OneMinusNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public OneMinusNode () |
|||
{ |
|||
name = "OneMinus"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_oneminus_" + 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 arg1 * -1 + 1;", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ea3f39b56fc9544ff80cbe84aa0753d0 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
fileFormatVersion: 2 |
|||
guid: ea3f39b56fc9544ff80cbe84aa0753d0 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
fileFormatVersion: 2 |
|||
guid: 74003f5fdec034579a435cdeb6219999 |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 94965bffe51535041a4f0a618263bf7d |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Color/RGBtoHSV")] |
|||
public class RGBtoHSVNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public RGBtoHSVNode () |
|||
{ |
|||
name = "RGBtoHSV"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_rgbtohsv_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot () |
|||
{ |
|||
return new MaterialSlot (InputSlotId, GetInputSlotName (), kInputSlotShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot () |
|||
{ |
|||
return new MaterialSlot (OutputSlotId, GetOutputSlotName (), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
//TODO:Externalize
|
|||
//Reference code from:http://www.chilliant.com/rgb2hsv.html
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk (precision + "4 K = " + precision + "4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);", false); |
|||
outputString.AddShaderChunk (precision + "4 P = lerp(" + precision + "4(arg1.bg, K.wz), " + precision + "4(arg1.gb, K.xy), step(arg1.b, arg1.g));", false); |
|||
outputString.AddShaderChunk (precision + "4 Q = lerp(" + precision + "4(P.xyw, arg1.r), " + precision + "4(arg1.r, P.yzx), step(P.x, arg1.r));", false); |
|||
outputString.AddShaderChunk (precision + " D = Q.x - min(Q.w, Q.y);", false); |
|||
outputString.AddShaderChunk (precision + " E = 1e-10;", false); |
|||
outputString.AddShaderChunk ("return " + precision + "3(abs(Q.z + (Q.w - Q.y)/(6.0 * D + E)), D / (Q.x + E), Q.x);", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Color/RGBtoHSV")] |
|||
public class RGBtoHSVNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public RGBtoHSVNode () |
|||
{ |
|||
name = "RGBtoHSV"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_rgbtohsv_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot () |
|||
{ |
|||
return new MaterialSlot (InputSlotId, GetInputSlotName (), kInputSlotShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot () |
|||
{ |
|||
return new MaterialSlot (OutputSlotId, GetOutputSlotName (), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
//TODO:Externalize
|
|||
//Reference code from:http://www.chilliant.com/rgb2hsv.html
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk (precision + "4 K = " + precision + "4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);", false); |
|||
outputString.AddShaderChunk (precision + "4 P = lerp(" + precision + "4(arg1.bg, K.wz), " + precision + "4(arg1.gb, K.xy), step(arg1.b, arg1.g));", false); |
|||
outputString.AddShaderChunk (precision + "4 Q = lerp(" + precision + "4(P.xyw, arg1.r), " + precision + "4(arg1.r, P.yzx), step(P.x, arg1.r));", false); |
|||
outputString.AddShaderChunk (precision + " D = Q.x - min(Q.w, Q.y);", false); |
|||
outputString.AddShaderChunk (precision + " E = 1e-10;", false); |
|||
outputString.AddShaderChunk ("return " + precision + "3(abs(Q.z + (Q.w - Q.y)/(6.0 * D + E)), D / (Q.x + E), Q.x);", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5fd9fa04ca1054c9c9a5bdd6984f0ee4 |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 5fd9fa04ca1054c9c9a5bdd6984f0ee4 |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 1d2a789d52c4340c98278ca90d8563fe |
|||
timeCreated: 1446473341 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 1d2a789d52c4340c98278ca90d8563fe |
|||
timeCreated: 1446473341 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Basic/SquareRoot")] |
|||
public class SquareRootNode : Function1Input |
|||
{ |
|||
public SquareRootNode () |
|||
{ |
|||
name = "SquareRoot"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "sqrt"; |
|||
} |
|||
} |
|||
} |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Basic/SquareRoot")] |
|||
public class SquareRootNode : Function1Input |
|||
{ |
|||
public SquareRootNode () |
|||
{ |
|||
name = "SquareRoot"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "sqrt"; |
|||
} |
|||
} |
|||
} |
|||
|
434
MaterialGraphProject/Assets/TestAssets/Sky1.jpg
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 9c50a18d04437449b86568cfcbb668a7 |
|||
timeCreated: 1490800222 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 0 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
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: |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapMode: -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 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
- buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 9c50a18d04437449b86568cfcbb668a7 |
|||
timeCreated: 1490800222 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 0 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
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: |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapMode: -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 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
- buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 543701356bb512c4cbd1e20cceb22ebb |
|||
timeCreated: 1490973774 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 0 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
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: |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapMode: -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 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
- buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: 543701356bb512c4cbd1e20cceb22ebb |
|||
timeCreated: 1490973774 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 0 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
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: |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapMode: -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 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
- buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ed6958aa821014dc9bc55ee355394931 |
|||
timeCreated: 1490797376 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
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: |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapMode: -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 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
- buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
fileFormatVersion: 2 |
|||
guid: ed6958aa821014dc9bc55ee355394931 |
|||
timeCreated: 1490797376 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
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: |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapMode: -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 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
- buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
textureFormat: -1 |
|||
textureCompression: 0 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 07096cbe059c94e42b244abc3e875ccf |
|||
folderAsset: yes |
|||
timeCreated: 1495475979 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: d44a270dca2589e4bb89c277d87ac0d9 |
|||
folderAsset: yes |
|||
timeCreated: 1495475979 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Range/Remap")] |
|||
public class RemapNode : Function2Input, IGeneratesFunction |
|||
{ |
|||
/*protected const string kInputSlot1ShaderName = "Input1"; |
|||
protected const string kInputSlot2ShaderName = "Input2"; |
|||
protected const string kOutputSlotShaderName = "Output"; |
|||
|
|||
public const int InputSlot1Id = 0; |
|||
public const int InputSlot2Id = 1; |
|||
public const int OutputSlotId = 2; |
|||
|
|||
[SerializeField] |
|||
private Vector4 m_Value; |
|||
*/ |
|||
|
|||
public RemapNode () |
|||
{ |
|||
name = "RemapNode"; |
|||
//UpdateNodeAfterDeserialization ();
|
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_remap_" + precision; |
|||
} |
|||
|
|||
//need to override the type of slot two somehow///////////////////////////////////////////////////
|
|||
/*override MaterialSlot GetInputSlot2 () |
|||
{ |
|||
return new MaterialSlot (InputSlot2Id, GetInputSlot2Name (), kInputSlot2ShaderName, SlotType.Input, SlotValueType.Vector4, Vector4.zero); |
|||
}*/ |
|||
|
|||
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.y - arg2.x)) * (arg2.w - arg2.z))+arg2.z;", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
|
|||
/* |
|||
public sealed override void UpdateNodeAfterDeserialization () |
|||
{ |
|||
AddSlot (GetInputSlot1 ()); |
|||
AddSlot (GetInputSlot2 ()); |
|||
AddSlot (GetOutputSlot ()); |
|||
RemoveSlotsNameNotMatching (validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots { |
|||
get { return new[] { InputSlot1Id, InputSlot2Id, OutputSlotId }; } |
|||
} |
|||
|
|||
protected virtual MaterialSlot GetInputSlot1 () |
|||
{ |
|||
return new MaterialSlot (InputSlot1Id, GetInputSlot1Name (), kInputSlot1ShaderName, SlotType.Input, SlotValueType.Dynamic, Vector4.zero); |
|||
} |
|||
|
|||
protected virtual MaterialSlot GetInputSlot2 () |
|||
{ |
|||
return new MaterialSlot (InputSlot2Id, GetInputSlot2Name (), kInputSlot2ShaderName, SlotType.Input, SlotValueType.Vector4, Vector4.zero); |
|||
} |
|||
|
|||
protected virtual MaterialSlot GetOutputSlot () |
|||
{ |
|||
return new MaterialSlot (OutputSlotId, GetOutputSlotName (), kOutputSlotShaderName, SlotType.Output, SlotValueType.Dynamic, Vector4.zero); |
|||
} |
|||
|
|||
protected virtual string GetInputSlot1Name () |
|||
{ |
|||
return "Input1"; |
|||
} |
|||
|
|||
protected virtual string GetInputSlot2Name () |
|||
{ |
|||
return "RemapVector"; |
|||
} |
|||
|
|||
protected virtual string GetOutputSlotName () |
|||
{ |
|||
return "Output"; |
|||
} |
|||
|
|||
//protected abstract string GetFunctionName ();
|
|||
|
|||
/*protected virtual string GetFunctionPrototype (string arg1Name, string arg2Name) |
|||
{ |
|||
return "inline " + precision + outputDimension + " " + GetFunctionName () + " (" |
|||
+ precision + input1Dimension + " " + arg1Name + ", " |
|||
+ precision + input2Dimension + " " + arg2Name + ")"; |
|||
} |
|||
|
|||
public void GenerateNodeCode (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
NodeUtils.SlotConfigurationExceptionIfBadConfiguration (this, new[] { InputSlot1Id, InputSlot2Id }, new[] { OutputSlotId }); |
|||
string input1Value = GetSlotValue (InputSlot1Id, generationMode); |
|||
string input2Value = GetSlotValue (InputSlot2Id, generationMode); |
|||
visitor.AddShaderChunk (precision + outputDimension + " " + GetVariableNameForSlot (OutputSlotId) + " = " + GetFunctionCallBody (input1Value, input2Value) + ";", true); |
|||
} |
|||
|
|||
protected virtual string GetFunctionCallBody (string input1Value, string input2Value) |
|||
{ |
|||
return GetFunctionName () + " (" + input1Value + ", " + input2Value + ")"; |
|||
}*/ |
|||
|
|||
/*public string outputDimension { |
|||
get { return ConvertConcreteSlotValueTypeToString (FindOutputSlot<MaterialSlot> (OutputSlotId).concreteValueType); } |
|||
} |
|||
|
|||
private string input1Dimension { |
|||
get { return ConvertConcreteSlotValueTypeToString (FindInputSlot<MaterialSlot> (InputSlot1Id).concreteValueType); } |
|||
} |
|||
|
|||
private string input2Dimension { |
|||
get { return ConvertConcreteSlotValueTypeToString (FindInputSlot<MaterialSlot> (InputSlot2Id).concreteValueType); } |
|||
}*/ |
|||
|
|||
/// <summary>
|
|||
/// Gets the type of the property.*/
|
|||
/// </summary>
|
|||
/// <value>The type of the property.</value>
|
|||
|
|||
/*public override PropertyType propertyType { |
|||
get { return PropertyType.Vector4; } |
|||
} |
|||
|
|||
public Vector4 value { |
|||
get { return m_Value; } |
|||
set { |
|||
if (m_Value == value) |
|||
return; |
|||
|
|||
m_Value = value; |
|||
|
|||
if (onModified != null) |
|||
onModified (this, ModificationScope.Node); |
|||
} |
|||
}*/ |
|||
|
|||
/*public override void GeneratePropertyBlock (PropertyGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
if (exposedState == ExposedState.Exposed) |
|||
visitor.AddShaderProperty (new VectorPropertyChunk (propertyName, description, m_Value, PropertyChunk.HideState.Visible)); |
|||
} |
|||
|
|||
public override void GeneratePropertyUsages (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
if (exposedState == ExposedState.Exposed || generationMode.IsPreview ()) |
|||
visitor.AddShaderChunk (precision + "3 " + propertyName + ";", false); |
|||
}*/ |
|||
|
|||
/*public void GenerateNodeCode (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
if (exposedState == ExposedState.Exposed || generationMode.IsPreview ()) |
|||
return; |
|||
var input1Value = GetSlotValue (InputSlot1Id, generationMode); |
|||
var input2Value = GetSlotValue (InputSlot2Id, generationMode); |
|||
visitor.AddShaderChunk (precision + "4 " + propertyName + " = " + input1Value + " * ((" + input2Value + ".w - " + input2Value + ".z) + " + input2Value + ".z);", false); |
|||
} |
|||
|
|||
public override bool hasPreview { |
|||
get { return true; } |
|||
} |
|||
|
|||
public override PreviewProperty GetPreviewProperty () |
|||
{ |
|||
return new PreviewProperty { |
|||
m_Name = propertyName, |
|||
m_PropType = PropertyType.Vector4, |
|||
m_Vector4 = m_Value |
|||
}; |
|||
}*/ |
|||
} |
|||
} |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Color/Contrast")] |
|||
public class Contrast : Function3Input, IGeneratesFunction |
|||
{ |
|||
public Contrast() |
|||
{ |
|||
name = "Contrast"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_contrast_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1 () |
|||
{ |
|||
return new MaterialSlot (InputSlot1Id, GetInputSlot1Name (), kInputSlot1ShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot3() |
|||
{ |
|||
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot () |
|||
{ |
|||
return new MaterialSlot (OutputSlotId, GetOutputSlotName (), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "Contrast"; |
|||
} |
|||
|
|||
protected override string GetInputSlot3Name() |
|||
{ |
|||
return "Midpoint"; |
|||
} |
|||
|
|||
// Contrast (reacts better when applied in log)
|
|||
// Optimal range: [0.0, 2.0]]
|
|||
// From PostProcessing
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1", "arg2", "arg3"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk ("return (arg1 - arg3) * arg2 + arg3;", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Vector/DDX")] |
|||
public class DDXNode : Function1Input |
|||
{ |
|||
public DDXNode() |
|||
{ |
|||
name = "DDX"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "ddx"; } |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: f13ae4db3be37ef4bbb46a37782ecd1a |
|||
timeCreated: 1490780593 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Vector/DDXY")] |
|||
public class DDXYNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public DDXYNode() |
|||
{ |
|||
name = "DDXY"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_ddxy_" + 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 abs(ddx(arg1) + ddy(arg1));", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: c18b14d941c03eb4d90c30f51c1d4fe1 |
|||
timeCreated: 1490780593 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Vector/DDY")] |
|||
public class DDYNode : Function1Input |
|||
{ |
|||
public DDYNode() |
|||
{ |
|||
name = "DDY"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "ddy"; } |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 421366e7b391f2c45902b735c4f45cb9 |
|||
timeCreated: 1490780593 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
#endif
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Depth Texture")] |
|||
public class DepthTextureNode : PropertyNode, IGeneratesBodyCode, IMayRequireMeshUV |
|||
{ |
|||
protected const string kUVSlotName = "UV"; |
|||
protected const string kOutputSlotName = "Output"; |
|||
|
|||
public const int UvSlotId = 0; |
|||
public const int OutputSlotId = 1; |
|||
|
|||
public override bool hasPreview { get { return true; } } |
|||
|
|||
public Texture2D defaultTexture { get; set; } |
|||
|
|||
public DepthTextureNode() |
|||
{ |
|||
name = "DepthTexture"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(UvSlotId, kUVSlotName, kUVSlotName, SlotType.Input, SlotValueType.Vector2, Vector4.zero, false)); |
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { OutputSlotId, UvSlotId }; } |
|||
} |
|||
|
|||
public virtual void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var uvSlot = FindInputSlot<MaterialSlot>(UvSlotId); |
|||
if (uvSlot == null) |
|||
return; |
|||
|
|||
var uvName = string.Format("{0}.xy", UVChannel.uv0.GetUVName()); |
|||
var edges = owner.GetEdges(uvSlot.slotReference).ToList(); |
|||
|
|||
if (edges.Count > 0) |
|||
{ |
|||
var edge = edges[0]; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(edge.outputSlot.nodeGuid); |
|||
uvName = ShaderGenerator.AdaptNodeOutput(fromNode, edge.outputSlot.slotId, ConcreteSlotValueType.Vector2, true); |
|||
} |
|||
|
|||
string body = "tex2D (_CameraDepthTexture, " + uvName + ")"; |
|||
visitor.AddShaderChunk(precision + "4 " + GetVariableNameForNode() + " = " + body + ";", true); |
|||
} |
|||
|
|||
public override void CollectPreviewMaterialProperties(List<PreviewProperty> properties) |
|||
{ |
|||
properties.Add(GetPreviewProperty()); |
|||
} |
|||
|
|||
public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
visitor.AddShaderChunk("sampler2D _CameraDepthTexture;", true); |
|||
} |
|||
|
|||
public override PreviewProperty GetPreviewProperty() |
|||
{ |
|||
return new PreviewProperty |
|||
{ |
|||
m_Name = propertyName, |
|||
m_PropType = PropertyType.Texture2D, |
|||
m_Texture = defaultTexture |
|||
}; |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
return GetVariableNameForNode(); |
|||
} |
|||
|
|||
public override PropertyType propertyType { get { return PropertyType.Texture2D; } } |
|||
|
|||
public bool RequiresMeshUV(UVChannel channel) |
|||
{ |
|||
if (channel != UVChannel.uv0) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
var uvSlot = FindInputSlot<MaterialSlot>(UvSlotId); |
|||
if (uvSlot == null) |
|||
return true; |
|||
|
|||
var edges = owner.GetEdges(uvSlot.slotReference).ToList(); |
|||
return edges.Count == 0; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Color/Desaturate")] |
|||
public class DesaturateNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public DesaturateNode() |
|||
{ |
|||
name = "Desaturate"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_desaturate_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot() |
|||
{ |
|||
return new MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("arg1"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk(precision+" intensity = "+precision+" (arg1.r * 0.3 + arg1.g * 0.59 + arg1.b * 0.11);", false); |
|||
outputString.AddShaderChunk("return " + precision + "3(intensity, intensity, intensity);", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: f34ce9f9ea429ef438e7825d66ede62f |
|||
timeCreated: 1490780593 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Vector/Distance")] |
|||
public class DistanceNode : Function2Input |
|||
{ |
|||
public DistanceNode() |
|||
{ |
|||
name = "Distance"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "distance"; } |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: ec570279ba6e0734b9cd4c293a08b9fd |
|||
timeCreated: 1490780593 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
#endif
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Motion Vector Texture")] |
|||
public class MotionVectorTextureNode : PropertyNode, IGeneratesBodyCode, IMayRequireMeshUV |
|||
{ |
|||
protected const string kUVSlotName = "UV"; |
|||
protected const string kOutputSlotName = "Output"; |
|||
|
|||
public const int UvSlotId = 0; |
|||
public const int OutputSlotId = 1; |
|||
|
|||
public override bool hasPreview { get { return true; } } |
|||
|
|||
public Texture2D defaultTexture { get; set; } |
|||
|
|||
public MotionVectorTextureNode() |
|||
{ |
|||
name = "MotionVectorTexture"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(UvSlotId, kUVSlotName, kUVSlotName, SlotType.Input, SlotValueType.Vector2, Vector4.zero, false)); |
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { OutputSlotId, UvSlotId }; } |
|||
} |
|||
|
|||
public virtual void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var uvSlot = FindInputSlot<MaterialSlot>(UvSlotId); |
|||
if (uvSlot == null) |
|||
return; |
|||
|
|||
var uvName = string.Format("{0}.xy", UVChannel.uv0.GetUVName()); |
|||
var edges = owner.GetEdges(uvSlot.slotReference).ToList(); |
|||
|
|||
if (edges.Count > 0) |
|||
{ |
|||
var edge = edges[0]; |
|||
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(edge.outputSlot.nodeGuid); |
|||
uvName = ShaderGenerator.AdaptNodeOutput(fromNode, edge.outputSlot.slotId, ConcreteSlotValueType.Vector2, true); |
|||
} |
|||
|
|||
string body = "tex2D (_CameraMotionVectorTexture, " + uvName + ")"; |
|||
visitor.AddShaderChunk(precision + "4 " + GetVariableNameForNode() + " = " + body + ";", true); |
|||
} |
|||
|
|||
public override void CollectPreviewMaterialProperties(List<PreviewProperty> properties) |
|||
{ |
|||
properties.Add(GetPreviewProperty()); |
|||
} |
|||
|
|||
public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
visitor.AddShaderChunk("sampler2D _CameraMotionVectorTexture;", true); |
|||
} |
|||
|
|||
public override PreviewProperty GetPreviewProperty() |
|||
{ |
|||
return new PreviewProperty |
|||
{ |
|||
m_Name = propertyName, |
|||
m_PropType = PropertyType.Texture2D, |
|||
m_Texture = defaultTexture |
|||
}; |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
return GetVariableNameForNode(); |
|||
} |
|||
|
|||
public override PropertyType propertyType { get { return PropertyType.Texture2D; } } |
|||
|
|||
public bool RequiresMeshUV(UVChannel channel) |
|||
{ |
|||
if (channel != UVChannel.uv0) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
var uvSlot = FindInputSlot<MaterialSlot>(UvSlotId); |
|||
if (uvSlot == null) |
|||
return true; |
|||
|
|||
var edges = owner.GetEdges(uvSlot.slotReference).ToList(); |
|||
return edges.Count == 0; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c7cc7e5395a37b6449bf1835a04565f8 |
|||
timeCreated: 1490975413 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Art/Normal Blend")] |
|||
public class NormalBlendNode : Function2Input, IGeneratesFunction |
|||
{ |
|||
public NormalBlendNode() |
|||
{ |
|||
name = "Normal Blend"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_normalblend_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
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 normalize("+precision+"3(arg1.rg + arg2.rg, arg1.b * arg2.b));", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: e8d13e9dbb613e04f835b281d7ee9ef1 |
|||
timeCreated: 1490780593 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Color/RGBtoLuminance")] |
|||
public class RGBtoLuminance : Function1Input, IGeneratesFunction |
|||
{ |
|||
public RGBtoLuminance() |
|||
{ |
|||
name = "RGBtoLuminance"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_rgbtoluminance_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot () |
|||
{ |
|||
return new MaterialSlot (InputSlotId, GetInputSlotName (), kInputSlotShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot () |
|||
{ |
|||
return new MaterialSlot (OutputSlotId, GetOutputSlotName (), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
// Convert rgb to luminance with rgb in linear space with sRGB primaries and D65 white point (from PostProcessing)
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk ("return dot(arg1, "+precision+outputDimension+"(0.2126729, 0.7151522, 0.0721750));", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 58e3952f4abe4d44d91b7dc9fbdb4853 |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Color/Saturation")] |
|||
public class Saturation : Function2Input, IGeneratesFunction |
|||
{ |
|||
public Saturation() |
|||
{ |
|||
name = "Saturation"; |
|||
} |
|||
|
|||
protected override string GetFunctionName () |
|||
{ |
|||
return "unity_saturation_" + precision; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1 () |
|||
{ |
|||
return new MaterialSlot (InputSlot1Id, GetInputSlot1Name (), kInputSlot1ShaderName, SlotType.Input, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot () |
|||
{ |
|||
return new MaterialSlot (OutputSlotId, GetOutputSlotName (), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "Saturation"; |
|||
} |
|||
|
|||
// RGB Saturation (closer to a vibrance effect than actual saturation)
|
|||
// Recommended workspace: ACEScg (linear)
|
|||
// Optimal range: [0.0, 2.0]
|
|||
// From PostProcessing
|
|||
public void GenerateNodeFunction (ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator (); |
|||
outputString.AddShaderChunk (GetFunctionPrototype ("arg1", "arg2"), false); |
|||
outputString.AddShaderChunk ("{", false); |
|||
outputString.Indent (); |
|||
outputString.AddShaderChunk(precision+" luma = dot(arg1, " + precision + outputDimension + "(0.2126729, 0.7151522, 0.0721750));", false); |
|||
outputString.AddShaderChunk ("return luma.xxx + arg2.xxx * (arg1 - luma.xxx);", false); |
|||
outputString.Deindent (); |
|||
outputString.AddShaderChunk ("}", false); |
|||
|
|||
visitor.AddShaderChunk (outputString.GetShaderString (0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8f3854e9ab30c854b93e88a2e560463e |
|||
timeCreated: 1444218016 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 5e38909e3b20f43b28137daed5bd62bf |
|||
folderAsset: yes |
|||
timeCreated: 1495449911 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue