浏览代码
Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017
/main
Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017
/main
RinaldoTjan
8 年前
当前提交
c5984a7b
共有 278 个文件被更改,包括 3029 次插入 和 1858 次删除
-
1MaterialGraphProject/Assets/Eduardo/ConstantsNode.cs
-
2MaterialGraphProject/Assets/Eduardo/EduardoTestGraph.ShaderGraph
-
54MaterialGraphProject/Assets/Eduardo/FunctionNInNOut.cs
-
26MaterialGraphProject/Assets/Eduardo/HeightToNormalNode.cs
-
896MaterialGraphProject/Assets/GeneratedShader.shader
-
8MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/NodeUtils.cs
-
2MaterialGraphProject/Assets/Matt/AnisotropicMaster.ShaderGraph
-
2MaterialGraphProject/Assets/Matt/EyeMaster.ShaderGraph
-
2MaterialGraphProject/Assets/NewNodes/WIP/MultiLayerParallaxNode.cs
-
5MaterialGraphProject/Assets/TestAssets/Materials/Default.mat
-
2MaterialGraphProject/Assets/TestAssets/Teapot.fbx.meta
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/AbstractMaterialGraphInspector.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/ColorNodePresenter.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/CustomCodeNodePresenter.cs
-
25MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
49MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Vector1NodePresenter.cs
-
93MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader.meta
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/subshader.template
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyChunkTests.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyNodeTests.cs
-
43MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/AbstractMaterialNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Function2Input.cs
-
23MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/ColorNode.cs
-
14MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Texture/CubemapNode.cs
-
54MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Vector/Vector1Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Vector/Vector2Node.cs
-
32MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MaterialSlot.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/CheckerboardNode.cs
-
42MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/VoronoiNoise.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PropertyNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PropertyType.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/SlotValue.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/UVTileNode.cs
-
126MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/AbstractSurfaceMasterNode.cs
-
35MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/MetallicMasterNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/SpecularMasterNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Util/ColorPropertyChunk.cs
-
39MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Util/FloatPropertyChunk.cs
-
8MaterialGraphProject/Assets/Vlad/TextureAssetNode.cs
-
122MaterialGraphProject/Assets/Vlad/UVTriPlanar.cs
-
9MaterialGraphProject/Assets/Andre/Nodes/ToggleNode.cs
-
8MaterialGraphProject/Assets/Andre/Scenes/Andre_scene.unity
-
127MaterialGraphProject/Assets/Andre/Materials/Mat.mat
-
9MaterialGraphProject/Assets/Andre/Materials/Sky.mat
-
102MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixMultiplyNode.cs
-
21MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixTransposeNode.cs
-
998MaterialGraphProject/Assets/Andre/Scenes/EmissionTest/LightingData.asset
-
4MaterialGraphProject/Assets/Andre/Scenes/LightProbeTesting/ReflectionProbe-0.exr.meta
-
9MaterialGraphProject/Assets/Andre/Materials.meta
-
9MaterialGraphProject/Assets/Andre/Nodes.meta
-
9MaterialGraphProject/Assets/Andre/Scenes.meta
-
9MaterialGraphProject/Assets/Andre/Scripts.meta
-
9MaterialGraphProject/Assets/Andre/Shaders.meta
-
1MaterialGraphProject/Assets/Brandon/Electricity.ShaderGraph
-
9MaterialGraphProject/Assets/Brandon/Electricity.ShaderGraph.meta
-
1MaterialGraphProject/Assets/Brandon/Flame.ShaderGraph
-
9MaterialGraphProject/Assets/Brandon/Flame.ShaderGraph.meta
-
1MaterialGraphProject/Assets/Code Graph.ShaderGraph
-
9MaterialGraphProject/Assets/Code Graph.ShaderGraph.meta
-
83MaterialGraphProject/Assets/Eduardo/EduardoTestMat.mat
-
9MaterialGraphProject/Assets/Eduardo/EduardoTestMat.mat.meta
-
64MaterialGraphProject/Assets/Eduardo/VertexNormalNode.cs
-
12MaterialGraphProject/Assets/Eduardo/VertexNormalNode.cs.meta
-
64MaterialGraphProject/Assets/Eduardo/VertexPositionNode.cs
-
12MaterialGraphProject/Assets/Eduardo/VertexPositionNode.cs.meta
-
363MaterialGraphProject/Assets/Eduardo/eduardoScene.unity
-
8MaterialGraphProject/Assets/Eduardo/eduardoScene.unity.meta
-
9MaterialGraphProject/Assets/Florent.meta
-
22MaterialGraphProject/Assets/Matt/CommonMatrixType.cs
-
12MaterialGraphProject/Assets/Matt/CommonMatrixType.cs.meta
-
9MaterialGraphProject/Assets/Matt/Examples.meta
-
1MaterialGraphProject/Assets/Matt/Test.ShaderGraph
-
9MaterialGraphProject/Assets/Matt/Test.ShaderGraph.meta
-
335MaterialGraphProject/Assets/NewNodes/WIP/POMNode.cs
-
12MaterialGraphProject/Assets/NewNodes/WIP/POMNode.cs.meta
-
1MaterialGraphProject/Assets/POM_Graph.ShaderGraph
-
9MaterialGraphProject/Assets/POM_Graph.ShaderGraph.meta
-
21MaterialGraphProject/Assets/TestAssets/TangentMap1.jpg
-
75MaterialGraphProject/Assets/TestAssets/TangentMap1.jpg.meta
-
33MaterialGraphProject/Assets/TestAssets/TangentMap2.jpg
-
75MaterialGraphProject/Assets/TestAssets/TangentMap2.jpg.meta
-
12MaterialGraphProject/Assets/TestAssets/TangentMap3.jpg
-
75MaterialGraphProject/Assets/TestAssets/TangentMap3.jpg.meta
-
29MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/NodeInspectors/PropertyNodeInspector.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/NodeInspectors/PropertyNodeInspector.cs.meta
-
151MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/ConvolutionFilterNodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/ConvolutionFilterNodePresenter.cs.meta
-
72MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GradientNodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GradientNodePresenter.cs.meta
-
40MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix2NodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix2NodePresenter.cs.meta
-
41MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix3NodePresenter.cs
2
MaterialGraphProject/Assets/Eduardo/EduardoTestGraph.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
2
MaterialGraphProject/Assets/Matt/AnisotropicMaster.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
2
MaterialGraphProject/Assets/Matt/EyeMaster.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 9ab5e16c2083a4fe689209a8c1ae425e |
|||
timeCreated: 1495630928 |
|||
timeCreated: 1495720140 |
|||
defaultTextures: |
|||
- TextureAsset_ebbe75eb_728a_4e6c_b8a1_994df86c74ad_Uniform: {fileID: 2800000, guid: 225a31f233f5b82488f996901413908d, |
|||
type: 3} |
|||
nonModifiableTextures: |
|||
- Texture_94ba0aed_e579_4ba0_b677_86c6deda72a2_Uniform: {fileID: 2800000, guid: 9c50a18d04437449b86568cfcbb668a7, |
|||
type: 3} |
|||
- Texture_65e72eb9_bdc7_4c17_b514_379aaeefd7ca_Uniform: {fileID: 2800000, guid: 84462bdfeee9d694bbebf34e5f3faa74, |
|||
type: 3} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
998
MaterialGraphProject/Assets/Andre/Scenes/EmissionTest/LightingData.asset
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 7d10d324ed0f94cb09a5c4478eee9945 |
|||
folderAsset: yes |
|||
timeCreated: 1495628966 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 9d0a876dd165a46c6b30eac1bbbef3a7 |
|||
folderAsset: yes |
|||
timeCreated: 1495628893 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 788be86d1d83c4b5596351884aa015a9 |
|||
folderAsset: yes |
|||
timeCreated: 1495628982 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 1a53c91de66c7460fb9b67844e09076d |
|||
folderAsset: yes |
|||
timeCreated: 1495628928 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 2eded065f6ee74c53a9261b91dc002ff |
|||
folderAsset: yes |
|||
timeCreated: 1495628909 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1
MaterialGraphProject/Assets/Brandon/Electricity.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 9c4fda6a69c679d49acc351c2a1709bf |
|||
timeCreated: 1495610699 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
1
MaterialGraphProject/Assets/Brandon/Flame.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 98bd80683fc0ce3468161776bcacc8dc |
|||
timeCreated: 1495484022 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
1
MaterialGraphProject/Assets/Code Graph.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 6e7da496d1011f54b8e707ce39eb4b5f |
|||
timeCreated: 1495644036 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
|
|||
%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: EduardoTestMat |
|||
m_Shader: {fileID: 4800000, guid: 9ab5e16c2083a4fe689209a8c1ae425e, type: 3} |
|||
m_ShaderKeywords: |
|||
m_LightmapFlags: 0 |
|||
m_EnableInstancingVariants: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- Texture_8fd49eff_ec05_41e3_9bc1_5bdfc20db019_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 6ff1e57e8df9d2948bb6d703d02af730, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture_ec519094_93da_4612_af61_2f8bcdc6589e_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 6ff1e57e8df9d2948bb6d703d02af730, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 1 |
|||
- _Glossiness: 0.5 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 1 |
|||
- _Parallax: 0.02 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|
|||
fileFormatVersion: 2 |
|||
guid: 51689361644e44b41aa59664b34a6e45 |
|||
timeCreated: 1495654926 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Geometry/Vertex Normal")] |
|||
public class VertexNormalNode : AbstractMaterialNode |
|||
{ |
|||
private const string kOutputSlotName = "XYZW"; |
|||
private const string kOutputSlotNameXYZ = "XYZ"; |
|||
private const string kOutputSlotNameX = "X"; |
|||
private const string kOutputSlotNameY = "Y"; |
|||
private const string kOutputSlotNameZ = "Z"; |
|||
private const string kOutputSlotNameW = "W"; |
|||
|
|||
public const int OutputSlotId = 0; |
|||
public const int OutputSlotIdXYZ = 1; |
|||
public const int OutputSlotIdX = 2; |
|||
public const int OutputSlotIdY = 3; |
|||
public const int OutputSlotIdZ = 4; |
|||
public const int OutputSlotIdW = 5; |
|||
|
|||
public VertexNormalNode() |
|||
{ |
|||
name = "VertexNormal"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdXYZ, kOutputSlotNameXYZ, kOutputSlotNameXYZ, SlotType.Output, SlotValueType.Vector3, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdX, kOutputSlotNameX, kOutputSlotNameX, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdY, kOutputSlotNameY, kOutputSlotNameY, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdZ, kOutputSlotNameZ, kOutputSlotNameZ, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdW, kOutputSlotNameW, kOutputSlotNameW, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
|
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { OutputSlotId, OutputSlotIdXYZ, OutputSlotIdX, OutputSlotIdY, OutputSlotIdZ, OutputSlotIdW }; } |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
switch (slotId) |
|||
{ |
|||
case OutputSlotIdXYZ: |
|||
return "v.normal.xyz"; |
|||
case OutputSlotIdX: |
|||
return "v.normal.x"; |
|||
case OutputSlotIdY: |
|||
return "v.normal.y"; |
|||
case OutputSlotIdZ: |
|||
return "v.normal.z"; |
|||
case OutputSlotIdW: |
|||
return "v.normal.w"; |
|||
default: |
|||
return "v.normal"; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c5532eff58cce43468e6f88386d8ac1c |
|||
timeCreated: 1495660146 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Geometry/Vertex Position")] |
|||
public class VertexPositionNode : AbstractMaterialNode |
|||
{ |
|||
private const string kOutputSlotName = "XYZW"; |
|||
private const string kOutputSlotNameXYZ = "XYZ"; |
|||
private const string kOutputSlotNameX = "X"; |
|||
private const string kOutputSlotNameY = "Y"; |
|||
private const string kOutputSlotNameZ = "Z"; |
|||
private const string kOutputSlotNameW = "W"; |
|||
|
|||
public const int OutputSlotId = 0; |
|||
public const int OutputSlotIdXYZ = 1; |
|||
public const int OutputSlotIdX = 2; |
|||
public const int OutputSlotIdY = 3; |
|||
public const int OutputSlotIdZ = 4; |
|||
public const int OutputSlotIdW = 5; |
|||
|
|||
public VertexPositionNode() |
|||
{ |
|||
name = "VertexPostion"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdXYZ, kOutputSlotNameXYZ, kOutputSlotNameXYZ, SlotType.Output, SlotValueType.Vector3, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdX, kOutputSlotNameX, kOutputSlotNameX, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdY, kOutputSlotNameY, kOutputSlotNameY, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdZ, kOutputSlotNameZ, kOutputSlotNameZ, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdW, kOutputSlotNameW, kOutputSlotNameW, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
|
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { OutputSlotId, OutputSlotIdXYZ ,OutputSlotIdX, OutputSlotIdY, OutputSlotIdZ, OutputSlotIdW }; } |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
switch (slotId) |
|||
{ |
|||
case OutputSlotIdXYZ: |
|||
return "v.vertex.xyz"; |
|||
case OutputSlotIdX: |
|||
return "v.vertex.x"; |
|||
case OutputSlotIdY: |
|||
return "v.vertex.y"; |
|||
case OutputSlotIdZ: |
|||
return "v.vertex.z"; |
|||
case OutputSlotIdW: |
|||
return "v.vertex.w"; |
|||
default: |
|||
return "v.vertex"; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 27fd3b60f289f4242a6142556ed287f1 |
|||
timeCreated: 1495658351 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!29 &1 |
|||
OcclusionCullingSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_OcclusionBakeSettings: |
|||
smallestOccluder: 5 |
|||
smallestHole: 0.25 |
|||
backfaceThreshold: 100 |
|||
m_SceneGUID: 00000000000000000000000000000000 |
|||
m_OcclusionCullingData: {fileID: 0} |
|||
--- !u!104 &2 |
|||
RenderSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 8 |
|||
m_Fog: 0 |
|||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
|||
m_FogMode: 3 |
|||
m_FogDensity: 0.01 |
|||
m_LinearFogStart: 0 |
|||
m_LinearFogEnd: 300 |
|||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
|||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
|||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
|||
m_AmbientIntensity: 1 |
|||
m_AmbientMode: 0 |
|||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
|||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_HaloStrength: 0.5 |
|||
m_FlareStrength: 1 |
|||
m_FlareFadeSpeed: 3 |
|||
m_HaloTexture: {fileID: 0} |
|||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_DefaultReflectionMode: 0 |
|||
m_DefaultReflectionResolution: 128 |
|||
m_ReflectionBounces: 1 |
|||
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 0} |
|||
m_IndirectSpecularColor: {r: 0.18028316, g: 0.22571331, b: 0.306922, a: 1} |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 11 |
|||
m_GIWorkflowMode: 0 |
|||
m_GISettings: |
|||
serializedVersion: 2 |
|||
m_BounceScale: 1 |
|||
m_IndirectOutputScale: 1 |
|||
m_AlbedoBoost: 1 |
|||
m_TemporalCoherenceThreshold: 1 |
|||
m_EnvironmentLightingMode: 0 |
|||
m_EnableBakedLightmaps: 1 |
|||
m_EnableRealtimeLightmaps: 1 |
|||
m_LightmapEditorSettings: |
|||
serializedVersion: 9 |
|||
m_Resolution: 2 |
|||
m_BakeResolution: 40 |
|||
m_TextureWidth: 1024 |
|||
m_TextureHeight: 1024 |
|||
m_AO: 0 |
|||
m_AOMaxDistance: 1 |
|||
m_CompAOExponent: 1 |
|||
m_CompAOExponentDirect: 0 |
|||
m_Padding: 2 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_LightmapsBakeMode: 1 |
|||
m_TextureCompression: 1 |
|||
m_FinalGather: 0 |
|||
m_FinalGatherFiltering: 1 |
|||
m_FinalGatherRayCount: 256 |
|||
m_ReflectionCompression: 2 |
|||
m_MixedBakeMode: 2 |
|||
m_BakeBackend: 0 |
|||
m_PVRSampling: 1 |
|||
m_PVRDirectSampleCount: 32 |
|||
m_PVRSampleCount: 500 |
|||
m_PVRBounces: 2 |
|||
m_PVRFiltering: 0 |
|||
m_PVRFilteringMode: 1 |
|||
m_PVRCulling: 1 |
|||
m_PVRFilteringGaussRadiusDirect: 1 |
|||
m_PVRFilteringGaussRadiusIndirect: 5 |
|||
m_PVRFilteringGaussRadiusAO: 2 |
|||
m_PVRFilteringAtrousColorSigma: 1 |
|||
m_PVRFilteringAtrousNormalSigma: 1 |
|||
m_PVRFilteringAtrousPositionSigma: 1 |
|||
m_LightingDataAsset: {fileID: 0} |
|||
m_UseShadowmask: 1 |
|||
--- !u!196 &4 |
|||
NavMeshSettings: |
|||
serializedVersion: 2 |
|||
m_ObjectHideFlags: 0 |
|||
m_BuildSettings: |
|||
serializedVersion: 2 |
|||
agentTypeID: 0 |
|||
agentRadius: 0.5 |
|||
agentHeight: 2 |
|||
agentSlope: 45 |
|||
agentClimb: 0.4 |
|||
ledgeDropHeight: 0 |
|||
maxJumpAcrossDistance: 0 |
|||
minRegionArea: 2 |
|||
manualCellSize: 0 |
|||
cellSize: 0.16666667 |
|||
manualTileSize: 0 |
|||
tileSize: 256 |
|||
accuratePlacement: 0 |
|||
debug: |
|||
m_Flags: 0 |
|||
m_NavMeshData: {fileID: 0} |
|||
--- !u!1 &165786477 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 165786481} |
|||
- component: {fileID: 165786480} |
|||
- component: {fileID: 165786479} |
|||
- component: {fileID: 165786478} |
|||
m_Layer: 0 |
|||
m_Name: Cube |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!23 &165786478 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 165786477} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: 51689361644e44b41aa59664b34a6e45, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!65 &165786479 |
|||
BoxCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 165786477} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Size: {x: 1, y: 1, z: 1} |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &165786480 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 165786477} |
|||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!4 &165786481 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 165786477} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &545929005 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 545929010} |
|||
- component: {fileID: 545929009} |
|||
- component: {fileID: 545929008} |
|||
- component: {fileID: 545929007} |
|||
- component: {fileID: 545929006} |
|||
m_Layer: 0 |
|||
m_Name: Main Camera |
|||
m_TagString: MainCamera |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!81 &545929006 |
|||
AudioListener: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_Enabled: 1 |
|||
--- !u!124 &545929007 |
|||
Behaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_Enabled: 1 |
|||
--- !u!92 &545929008 |
|||
Behaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_Enabled: 1 |
|||
--- !u!20 &545929009 |
|||
Camera: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_ClearFlags: 1 |
|||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} |
|||
m_NormalizedViewPortRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
near clip plane: 0.3 |
|||
far clip plane: 1000 |
|||
field of view: 60 |
|||
orthographic: 0 |
|||
orthographic size: 5 |
|||
m_Depth: -1 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingPath: -1 |
|||
m_TargetTexture: {fileID: 0} |
|||
m_TargetDisplay: 0 |
|||
m_TargetEye: 3 |
|||
m_HDR: 1 |
|||
m_AllowMSAA: 1 |
|||
m_ForceIntoRT: 0 |
|||
m_OcclusionCulling: 1 |
|||
m_StereoConvergence: 10 |
|||
m_StereoSeparation: 0.022 |
|||
m_StereoMirrorMode: 0 |
|||
--- !u!4 &545929010 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 1, z: -10} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1301173965 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1301173967} |
|||
- component: {fileID: 1301173966} |
|||
m_Layer: 0 |
|||
m_Name: Directional Light |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!108 &1301173966 |
|||
Light: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1301173965} |
|||
m_Enabled: 1 |
|||
serializedVersion: 8 |
|||
m_Type: 1 |
|||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} |
|||
m_Intensity: 1 |
|||
m_Range: 10 |
|||
m_SpotAngle: 30 |
|||
m_CookieSize: 10 |
|||
m_Shadows: |
|||
m_Type: 2 |
|||
m_Resolution: -1 |
|||
m_CustomResolution: -1 |
|||
m_Strength: 1 |
|||
m_Bias: 0.05 |
|||
m_NormalBias: 0.4 |
|||
m_NearPlane: 0.2 |
|||
m_Cookie: {fileID: 0} |
|||
m_DrawHalo: 0 |
|||
m_Flare: {fileID: 0} |
|||
m_RenderMode: 0 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_Lightmapping: 4 |
|||
m_AreaSize: {x: 1, y: 1} |
|||
m_BounceIntensity: 1 |
|||
m_FalloffTable: |
|||
m_Table[0]: 0 |
|||
m_Table[1]: 0 |
|||
m_Table[2]: 0 |
|||
m_Table[3]: 0 |
|||
m_Table[4]: 0 |
|||
m_Table[5]: 0 |
|||
m_Table[6]: 0 |
|||
m_Table[7]: 0 |
|||
m_Table[8]: 0 |
|||
m_Table[9]: 0 |
|||
m_Table[10]: 0 |
|||
m_Table[11]: 0 |
|||
m_Table[12]: 0 |
|||
m_ColorTemperature: 6570 |
|||
m_UseColorTemperature: 0 |
|||
m_ShadowRadius: 0 |
|||
m_ShadowAngle: 0 |
|||
--- !u!4 &1301173967 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1301173965} |
|||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} |
|||
m_LocalPosition: {x: 0, y: 3, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 418471c069e40784489ba3ba9d0bb95b |
|||
timeCreated: 1495655530 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: e9dab59e587c7f244adde1add29b34fc |
|||
folderAsset: yes |
|||
timeCreated: 1495531757 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
public enum CommonMatrixType |
|||
{ |
|||
ModelView, |
|||
View, |
|||
Projection, |
|||
ViewProjection, |
|||
TransposeModelView, |
|||
InverseTransposeModelView, |
|||
ObjectToWorld, |
|||
WorldToObject |
|||
}; |
|||
|
|||
public enum SimpleMatrixType |
|||
{ |
|||
World, |
|||
Local, |
|||
Tangent, |
|||
View |
|||
}; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e466cff33b1ebe64eb2b897b9534a4a4 |
|||
timeCreated: 1495703998 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 6a5311f2c2db6e34f8da2333309aab50 |
|||
folderAsset: yes |
|||
timeCreated: 1495713891 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1
MaterialGraphProject/Assets/Matt/Test.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: fd03b3a3f54f741498f9bea81e951ebb |
|||
timeCreated: 1495668190 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("UV/ParallaxOcclusionMapping")] |
|||
public class ParallaxOcclusionMappingNode : |
|||
AbstractMaterialNode, |
|||
IGeneratesBodyCode, |
|||
IGeneratesFunction, |
|||
IMayRequireMeshUV, |
|||
IMayRequireViewDirection, |
|||
IMayRequireNormal, |
|||
IMayRequireViewDirectionTangentSpace |
|||
{ |
|||
protected const string kInputHeightScaleShaderName = "HeightScale"; |
|||
protected const string kTextureSlotShaderName = "Texture"; |
|||
protected const string kOutputSlotShaderName = "UV"; |
|||
|
|||
public const int HeightScaleSlotId = 0; // 'height_scale'
|
|||
public const int TextureSlotId = 1; // 'tex'
|
|||
public const int OutputSlotId = 2; |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return true; } |
|||
} |
|||
|
|||
public override PreviewMode previewMode |
|||
{ |
|||
get |
|||
{ |
|||
return PreviewMode.Preview3D; |
|||
} |
|||
} |
|||
|
|||
public ParallaxOcclusionMappingNode() |
|||
{ |
|||
name = "ParallaxOcclusionMapping"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public string GetFunctionName() |
|||
{ |
|||
return "unity_parallax_occlusion_mapping_" + precision; |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(GetInputHeightScaleSlot()); |
|||
AddSlot(GetTextureSlot()); |
|||
AddSlot(GetOutputSlot()); |
|||
|
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { HeightScaleSlotId, TextureSlotId, OutputSlotId }; } |
|||
} |
|||
protected virtual string GetInputHeightScaleName() |
|||
{ |
|||
return kInputHeightScaleShaderName; |
|||
} |
|||
protected virtual MaterialSlot GetInputHeightScaleSlot() |
|||
{ |
|||
return new MaterialSlot( |
|||
HeightScaleSlotId, GetInputHeightScaleName(), kInputHeightScaleShaderName, SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
protected virtual MaterialSlot GetTextureSlot() |
|||
{ |
|||
return new MaterialSlot(TextureSlotId, GetTextureSlotName(), kTextureSlotShaderName, SlotType.Input, SlotValueType.Texture2D, Vector4.zero); |
|||
} |
|||
|
|||
protected virtual MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector2, Vector4.zero); |
|||
} |
|||
|
|||
protected virtual string GetTextureSlotName() |
|||
{ |
|||
return kTextureSlotShaderName; |
|||
} |
|||
|
|||
protected virtual string GetOutputSlotName() |
|||
{ |
|||
return kOutputSlotShaderName; |
|||
} |
|||
|
|||
private string inputHeightScaleDimension |
|||
{ |
|||
get { return ConvertConcreteSlotValueTypeToString(FindInputSlot<MaterialSlot>(HeightScaleSlotId).concreteValueType); } |
|||
} |
|||
|
|||
protected virtual string GetFunctionPrototype( |
|||
string heightScale, string tex, string UVs, string viewTangentSpace, string worldSpaceNormal, string worldSpaceViewDirection) |
|||
{ |
|||
return "inline " + precision + "2 " + GetFunctionName() + " (" + |
|||
precision + inputHeightScaleDimension + " " + heightScale + ", " + |
|||
"sampler2D " + tex + ", " + |
|||
precision + "2 " + UVs + ", " + |
|||
precision + "3 " + viewTangentSpace + ", " + |
|||
precision + "3 " + worldSpaceNormal + ", " + |
|||
precision + "3 " + worldSpaceViewDirection + ")"; |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
NodeUtils.SlotConfigurationExceptionIfBadConfiguration( |
|||
this, |
|||
new[] { HeightScaleSlotId, TextureSlotId }, |
|||
new[] { OutputSlotId }); |
|||
string heightScaleValue = GetSlotValue(HeightScaleSlotId, generationMode); |
|||
string textureValue = GetSlotValue(TextureSlotId, generationMode); |
|||
|
|||
visitor.AddShaderChunk(precision + "2 " + GetVariableNameForSlot(OutputSlotId) + " = " + |
|||
GetFunctionCallBody(heightScaleValue, textureValue) + ";", true); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk( |
|||
GetFunctionPrototype("heightScale", "tex", "UVs", "viewTangentSpace", "worldSpaceNormal", "worldSpaceViewDirection" ), |
|||
false); |
|||
|
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk(precision + "2 " + "height_map_dimensions = " + precision + "2" + "(256.0f, 256.0f); //HARDCODE", false); |
|||
//height_map.tex.GetDimensions(height_map_dimensions.x, height_map_dimensions.y);
|
|||
|
|||
outputString.AddShaderChunk(precision + "2 texcoord= UVs;", false); |
|||
|
|||
// Compute the current gradients:
|
|||
outputString.AddShaderChunk(precision + "2 " + " texcoords_per_size = texcoord * height_map_dimensions;", false); |
|||
|
|||
// Compute all 4 derivatives in x and y in a single instruction to optimize:
|
|||
outputString.AddShaderChunk("float2 dx, dy;", false); |
|||
|
|||
outputString.AddShaderChunk(" float4 temp_ddx = ddx(float4(texcoords_per_size, texcoord));", false); |
|||
|
|||
outputString.AddShaderChunk("dx.xy = temp_ddx.zw;", false); |
|||
|
|||
outputString.AddShaderChunk("float4 temp_ddy = ddy(float4(texcoords_per_size, texcoord));", false); |
|||
|
|||
outputString.AddShaderChunk("dy.xy = temp_ddy.zw;", false); |
|||
|
|||
// Start the current sample located at the input texture coordinate, which would correspond
|
|||
// to computing a bump mapping result:
|
|||
outputString.AddShaderChunk(precision + "2 " + "result_texcoord = texcoord;", false); |
|||
|
|||
outputString.AddShaderChunk("float height_scale_value = heightScale;", false); |
|||
outputString.AddShaderChunk("float height_scale_adjust = height_scale_value;", false); |
|||
|
|||
|
|||
outputString.AddShaderChunk("float per_pixel_height_scale_value = height_scale_value * heightScale;", false); |
|||
|
|||
// Parallax occlusion mapping offset computation
|
|||
//--------------
|
|||
|
|||
// Utilize dynamic flow control to change the number of samples per ray
|
|||
// depending on the viewing angle for the surface. Oblique angles require
|
|||
// smaller step sizes to achieve more accurate precision for computing displacement.
|
|||
// We express the sampling rate as a linear function of the angle between
|
|||
// the geometric normal and the view direction ray:
|
|||
outputString.AddShaderChunk("float max_samples = 30.0f;", false); |
|||
outputString.AddShaderChunk("float min_samples = 4.0f;", false); |
|||
|
|||
outputString.AddShaderChunk("float view_dot_normal= dot(worldSpaceNormal, worldSpaceViewDirection);", false); |
|||
|
|||
outputString.AddShaderChunk("int number_of_steps = (int)lerp(max_samples, min_samples, saturate(view_dot_normal));", false); |
|||
|
|||
// Intersect the view ray with the height field profile along the direction of
|
|||
// the parallax offset ray (computed in the vertex shader. Note that the code is
|
|||
// designed specifically to take advantage of the dynamic flow control constructs
|
|||
// in HLSL and is very sensitive to specific syntax. When converting to other examples,
|
|||
// if still want to use dynamic flow control in the resulting assembly shader,
|
|||
// care must be applied.
|
|||
//
|
|||
// In the below steps we approximate the height field profile as piecewise linear
|
|||
// curve. We find the pair of endpoints between which the intersection between the
|
|||
// height field profile and the view ray is found and then compute line segment
|
|||
// intersection for the view ray and the line segment formed by the two endpoints.
|
|||
// This intersection is the displacement offset from the original texture coordinate.
|
|||
// See the above SI3D 06 paper for more details about the process and derivation.
|
|||
//
|
|||
|
|||
outputString.AddShaderChunk("float current_height = 0.0;", false); |
|||
outputString.AddShaderChunk("float step_size = 1.0 / (float)number_of_steps;", false); |
|||
|
|||
outputString.AddShaderChunk("float previous_height = 1.0;", false); |
|||
outputString.AddShaderChunk("float next_height = 0.0;", false); |
|||
|
|||
|
|||
outputString.AddShaderChunk("int step_index = 0;", false); |
|||
|
|||
// Optimization: this should move to vertex shader, however, we compute it here for simplicity of
|
|||
// integration into our shaders for now.
|
|||
outputString.AddShaderChunk("float3 normalized_view_dir_in_tangent_space = normalize(viewTangentSpace.xyz);", false); |
|||
|
|||
// Compute initial parallax displacement direction:
|
|||
outputString.AddShaderChunk("float2 parallax_direction = normalize(viewTangentSpace.xy);", false); |
|||
|
|||
// The length of this vector determines the furthest amount of displacement:
|
|||
outputString.AddShaderChunk("float parallax_direction_length = length(normalized_view_dir_in_tangent_space);", false); |
|||
|
|||
outputString.AddShaderChunk( |
|||
"float max_parallax_amount = sqrt(parallax_direction_length * parallax_direction_length - viewTangentSpace.z * viewTangentSpace.z) / viewTangentSpace.z;", false); |
|||
|
|||
// Compute the actual reverse parallax displacement vector:
|
|||
outputString.AddShaderChunk("float2 parallax_offset_in_tangent_space = parallax_direction * max_parallax_amount;", false); |
|||
|
|||
// Need to scale the amount of displacement to account for different height ranges
|
|||
// in height maps. This is controlled by an artist-editable parameter:
|
|||
outputString.AddShaderChunk("parallax_offset_in_tangent_space *= saturate(heightScale);", false); |
|||
|
|||
outputString.AddShaderChunk("float2 texcoord_offset_per_step = step_size * parallax_offset_in_tangent_space;", false); |
|||
|
|||
outputString.AddShaderChunk(precision + "2 " + "current_texcoord_offset = texcoord;", false); |
|||
outputString.AddShaderChunk("float current_bound = 1.0;", false); |
|||
|
|||
outputString.AddShaderChunk("float current_parallax_amount = 0.0;", false); |
|||
|
|||
outputString.AddShaderChunk("float2 pt1 = 0;", false); |
|||
outputString.AddShaderChunk("float2 pt2 = 0;", false); |
|||
|
|||
|
|||
outputString.AddShaderChunk(precision + "2 " + "temp_texcoord_offset = 0;", false); |
|||
|
|||
outputString.AddShaderChunk("while (step_index < number_of_steps)", false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("current_texcoord_offset -= texcoord_offset_per_step;", false); |
|||
|
|||
// Sample height map which in this case is stored in the alpha channel of the normal map:
|
|||
outputString.AddShaderChunk("current_height = tex2Dgrad(tex, current_texcoord_offset, dx, dy).r;", false); |
|||
|
|||
outputString.AddShaderChunk("current_bound -= step_size;", false); |
|||
|
|||
outputString.AddShaderChunk("if (current_height > current_bound)", false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("pt1 = float2(current_bound, current_height);", false); |
|||
|
|||
outputString.AddShaderChunk("pt2 = float2(current_bound + step_size, previous_height);", false); |
|||
|
|||
|
|||
outputString.AddShaderChunk("temp_texcoord_offset = current_texcoord_offset - texcoord_offset_per_step;", false); |
|||
|
|||
outputString.AddShaderChunk("step_index = number_of_steps + 1;", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
outputString.AddShaderChunk("else", false); |
|||
|
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("step_index++;", false); |
|||
outputString.AddShaderChunk("previous_height = current_height;", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("} // End of while ( step_index < number_of_steps)", false); |
|||
|
|||
|
|||
outputString.AddShaderChunk("float delta2 = pt2.x - pt2.y;", false); |
|||
outputString.AddShaderChunk("float delta1 = pt1.x - pt1.y;", false); |
|||
|
|||
outputString.AddShaderChunk("float denominator = delta2 - delta1;", false); |
|||
|
|||
// SM 3.0 and above requires a check for divide by zero since that operation
|
|||
// will generate an 'Inf' number instead of 0
|
|||
outputString.AddShaderChunk("if (denominator== 0.0f) ", false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk("current_parallax_amount= 0.0f;", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
outputString.AddShaderChunk("else", false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk("current_parallax_amount= (pt1.x* delta2 - pt2.x* delta1) / denominator;", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
outputString.AddShaderChunk("float2 parallax_offset = parallax_offset_in_tangent_space * (1.0f - current_parallax_amount);", false); |
|||
|
|||
// The computed texture offset for the displaced point on the pseudo-extruded surface:
|
|||
outputString.AddShaderChunk("float2 parallaxed_texcoord = texcoord - parallax_offset;", false); |
|||
|
|||
outputString.AddShaderChunk("return parallaxed_texcoord;", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
|
|||
protected virtual string GetFunctionCallBody(string heightScale, string texValue) |
|||
{ |
|||
var channel = UVChannel.uv0; |
|||
|
|||
return GetFunctionName() + " (" + |
|||
heightScale + ", " + |
|||
texValue + ", " + |
|||
channel.GetUVName() + ", " + |
|||
ShaderGeneratorNames.TangentSpaceViewDirection + ", " + |
|||
ShaderGeneratorNames.WorldSpaceNormal + ", " + |
|||
ShaderGeneratorNames.WorldSpaceViewDirection + ")"; |
|||
} |
|||
|
|||
public bool RequiresMeshUV(UVChannel channel) |
|||
{ |
|||
return channel == UVChannel.uv0; |
|||
} |
|||
public bool RequiresViewDirectionTangentSpace() |
|||
{ |
|||
return true; |
|||
} |
|||
public bool RequiresNormal() |
|||
{ |
|||
return true; |
|||
} |
|||
public bool RequiresViewDirection() |
|||
{ |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: daac036bc09be70438149124ccd0a11b |
|||
timeCreated: 1495700896 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1
MaterialGraphProject/Assets/POM_Graph.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 96bf971901c0d7c468d21e8511ced163 |
|||
timeCreated: 1495479560 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
|
|||
fileFormatVersion: 2 |
|||
guid: fd9dcc0042b460046917799942414fe0 |
|||
timeCreated: 1495721640 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapU: -1 |
|||
wrapV: -1 |
|||
wrapW: -1 |
|||
nPOTScale: 1 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 0 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spritePixelsToUnits: 100 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 0 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 0 |
|||
textureShape: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
platformSettings: |
|||
- buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ff1fa8d5d8b0945499c7785f1b0f2a4f |
|||
timeCreated: 1495721640 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapU: -1 |
|||
wrapV: -1 |
|||
wrapW: -1 |
|||
nPOTScale: 1 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 0 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spritePixelsToUnits: 100 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 0 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 0 |
|||
textureShape: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
platformSettings: |
|||
- buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: cbf25f5368b2350408963109a1c8f22d |
|||
timeCreated: 1495721640 |
|||
licenseType: Pro |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
serializedVersion: 4 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -1 |
|||
wrapU: -1 |
|||
wrapV: -1 |
|||
wrapW: -1 |
|||
nPOTScale: 1 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 0 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spritePixelsToUnits: 100 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 0 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 0 |
|||
textureShape: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
platformSettings: |
|||
- buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public class PropertyNodeInspector : BasicNodeInspector |
|||
{ |
|||
public override void OnInspectorGUI() |
|||
{ |
|||
base.OnInspectorGUI(); |
|||
|
|||
var propertyNode = node as PropertyNode; |
|||
if (propertyNode == null) |
|||
return; |
|||
|
|||
GUILayout.Label("Settings", EditorStyles.boldLabel); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
|
|||
//propertyNode.name = EditorGUILayout.TextField ("Name", propertyNode.name);
|
|||
propertyNode.description = EditorGUILayout.TextField ("Description", propertyNode.description); |
|||
|
|||
if (EditorGUI.EndChangeCheck()) |
|||
node.onModified(node, ModificationScope.Node); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4a761301a6b844baa9202a1dc4293b67 |
|||
timeCreated: 1495644228 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine.MaterialGraph; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
class ConvolutionFilterControlPresenter : GraphControlPresenter |
|||
{ |
|||
enum KernelPresets |
|||
{ |
|||
Presets, |
|||
BoxBlur, |
|||
GaussianBlur, |
|||
EdgesDetection, |
|||
EnhanceEdges, |
|||
Sharpen, |
|||
Emboss, |
|||
}; |
|||
|
|||
private void ApplyPreset(KernelPresets preset, ref float[,] values, ref float divisor) |
|||
{ |
|||
if (preset == KernelPresets.BoxBlur) |
|||
{ |
|||
values = new float[,] { {1,1,1,1,1}, |
|||
{1,1,1,1,1}, |
|||
{1,1,1,1,1}, |
|||
{1,1,1,1,1}, |
|||
{1,1,1,1,1} }; |
|||
divisor = 25; |
|||
} |
|||
if (preset == KernelPresets.GaussianBlur) |
|||
{ |
|||
values = new float[,] { { 1, 4, 6, 4, 1}, |
|||
{ 4,16,24,16, 4}, |
|||
{ 6,24,36,24, 6}, |
|||
{ 4,16,24,16, 4}, |
|||
{ 1, 4, 6, 4, 1} }; |
|||
divisor = 256; |
|||
} |
|||
if (preset == KernelPresets.EdgesDetection) |
|||
{ |
|||
values = new float[,] { {-1,-1,-1, -1,-1}, |
|||
{-1,-2,-2, -2,-1}, |
|||
{-1,-2, 33,-2,-1}, |
|||
{-1,-2,-2, -2,-1}, |
|||
{-1,-1,-1, -1,-1} }; |
|||
divisor = 1; |
|||
} |
|||
if (preset == KernelPresets.EnhanceEdges) |
|||
{ |
|||
values = new float[,] { { 0, 0, 0, 0, 0}, |
|||
{ 0, 1, 1, 1, 0}, |
|||
{ 0, 1,-7, 1, 0}, |
|||
{ 0, 1, 1, 1, 0}, |
|||
{ 0, 0, 0, 0, 0} }; |
|||
divisor = 1; |
|||
} |
|||
if (preset == KernelPresets.Sharpen) |
|||
{ |
|||
values = new float[,] { {-1,-1,-1, -1,-1}, |
|||
{-1, 2, 2, 2,-1}, |
|||
{-1, 2, 8, 2,-1}, |
|||
{-1, 2, 2, 2,-1}, |
|||
{-1,-1,-1, -1,-1} }; |
|||
divisor = 8; |
|||
} |
|||
if (preset == KernelPresets.Emboss) |
|||
{ |
|||
values = new float[,] { {-1,-1,-1,-1, 0}, |
|||
{-1,-1,-1, 0, 1}, |
|||
{-1,-1, 0, 1, 1}, |
|||
{-1, 0, 1, 1, 1}, |
|||
{ 0, 1, 1, 1, 1} }; |
|||
divisor = 1; |
|||
} |
|||
} |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as ConvolutionFilterNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
float divisor = tNode.GetConvolutionDivisor(); |
|||
float[,] values = new float[5,5]; |
|||
for (int row = 0; row < 5; ++row) |
|||
{ |
|||
for (int col = 0; col < 5; ++col) |
|||
{ |
|||
values[row,col] = tNode.GetConvolutionWeight(row,col); |
|||
} |
|||
} |
|||
|
|||
EditorGUILayout.BeginVertical(); |
|||
EditorGUI.BeginChangeCheck(); |
|||
|
|||
EditorGUILayout.LabelField("Kernel"); |
|||
KernelPresets kernelPresets = KernelPresets.Presets; |
|||
kernelPresets = (KernelPresets)EditorGUILayout.EnumPopup(kernelPresets); |
|||
ApplyPreset(kernelPresets, ref values, ref divisor); |
|||
|
|||
for (int col = 0; col < 5; ++col) |
|||
{ |
|||
EditorGUILayout.BeginHorizontal(); |
|||
for (int row = 0; row < 5; ++row) |
|||
{ |
|||
values[row, col] = EditorGUILayout.FloatField(values[row, col], GUILayout.Width(35)); |
|||
} |
|||
EditorGUILayout.EndHorizontal(); |
|||
} |
|||
EditorGUILayout.Space(); |
|||
|
|||
divisor = EditorGUILayout.FloatField("Divisor", divisor); |
|||
|
|||
EditorGUILayout.EndVertical(); |
|||
|
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
tNode.SetConvolutionDivisor(divisor); |
|||
for (int row = 0; row < 5; ++row) |
|||
{ |
|||
for (int col = 0; col < 5; ++col) |
|||
{ |
|||
tNode.SetConvolutionWeight(row, col, values[row, col]); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 10 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class ConvolutionFilterNodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<ConvolutionFilterControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f3a416c372d21b6479241e837d4257da |
|||
timeCreated: 1495705790 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine; |
|||
|
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
[Serializable] |
|||
class GradientContolPresenter : GraphControlPresenter |
|||
{ |
|||
private GradientObject gradientobj; |
|||
private SerializedObject hserializedObject; |
|||
private SerializedProperty hcolorGradient; |
|||
private UnityEngine.MaterialGraph.GradientNode prevnode; |
|||
|
|||
private string prevWindow = ""; |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var cNode = node as UnityEngine.MaterialGraph.GradientNode; |
|||
if (cNode == null) |
|||
return; |
|||
|
|||
if(gradientobj == null || prevnode != cNode) |
|||
{ |
|||
prevnode = cNode; |
|||
gradientobj = new GradientObject(); |
|||
hserializedObject = new SerializedObject(gradientobj); |
|||
hcolorGradient = hserializedObject.FindProperty("gradient"); |
|||
} |
|||
|
|||
EditorGUILayout.PropertyField(hcolorGradient, true, null); |
|||
hserializedObject.ApplyModifiedProperties(); |
|||
cNode.gradient = gradientobj.gradient; |
|||
|
|||
Event e = Event.current; |
|||
|
|||
if (EditorWindow.focusedWindow != null && prevWindow != EditorWindow.focusedWindow.ToString() && EditorWindow.focusedWindow.ToString() != "(UnityEditor.GradientPicker)") |
|||
{ |
|||
cNode.UpdateGradient(); |
|||
prevWindow = EditorWindow.focusedWindow.ToString(); |
|||
Debug.Log("Update Gradient Shader"); |
|||
} |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
|
|||
} |
|||
|
|||
[Serializable] |
|||
public class GradientNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<GradientContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter> { instance }; |
|||
} |
|||
} |
|||
|
|||
public class GradientObject : ScriptableObject |
|||
{ |
|||
public Gradient gradient = new Gradient(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 75dd92c51294c2f498d37158354fe0b1 |
|||
timeCreated: 1476707367 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
class Matrix2ControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Matrix2Node; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode[0] = EditorGUILayout.Vector2Field("", tNode[0]); |
|||
tNode[1] = EditorGUILayout.Vector2Field("", tNode[1]); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class Matrix2NodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<Matrix2ControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7a56e192798ff9a45a01f10c9113e539 |
|||
timeCreated: 1476871291 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
class Matrix3ControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Matrix3Node; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode[0] = EditorGUILayout.Vector3Field("", tNode[0]); |
|||
tNode[1] = EditorGUILayout.Vector3Field("", tNode[1]); |
|||
tNode[2] = EditorGUILayout.Vector3Field("", tNode[2]); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class Matrix3NodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<Matrix3ControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue