├── LICENSE
├── Nodes
├── Complex.meta
├── Complex
│ ├── ComplexNodes.cs
│ ├── ComplexNodes.cs.meta
│ └── README.md
├── Composite.meta
├── Composite
│ ├── CompositeNodes.cs
│ ├── CompositeNodes.cs.meta
│ └── README.md
├── Gilescoope.ShaderGraphNodes.Internal.asmref
├── Gilescoope.ShaderGraphNodes.Internal.asmref.meta
├── Halftone.meta
├── Halftone
│ ├── HalftoneNodes.cs
│ ├── HalftoneNodes.cs.meta
│ └── README.md
├── Lab Color.meta
├── Lab Color
│ ├── LabColorNodes.cs
│ ├── LabColorNodes.cs.meta
│ └── README.md
├── Pattern.meta
├── Pattern
│ ├── PatternNodes.cs
│ ├── PatternNodes.cs.meta
│ └── README.md
├── Pixel Perfect.meta
├── Pixel Perfect
│ ├── PixelPerfectNodes.cs
│ ├── PixelPerfectNodes.cs.meta
│ └── README.md
├── Quaternion.meta
├── Quaternion
│ ├── QuaternionNodes.cs
│ ├── QuaternionNodes.cs.meta
│ └── README.md
├── Random.meta
├── Random
│ ├── RandomNodes.cs
│ └── RandomNodes.cs.meta
├── SDF.meta
├── SDF
│ ├── README.md
│ ├── SDFNodes.cs
│ └── SDFNodes.cs.meta
├── Symmetry.meta
├── Symmetry
│ ├── SymmetryNodes.cs
│ └── SymmetryNodes.cs.meta
├── Truchet.meta
└── Truchet
│ ├── Examples.meta
│ ├── Examples
│ ├── Materials.meta
│ ├── Materials
│ │ ├── Truchet Hexagon.mat
│ │ ├── Truchet Hexagon.mat.meta
│ │ ├── Truchet Square.mat
│ │ ├── Truchet Square.mat.meta
│ │ ├── Truchet Triangle.mat
│ │ └── Truchet Triangle.mat.meta
│ ├── Shaders.meta
│ ├── Shaders
│ │ ├── Truchet Hexagon.ShaderGraph
│ │ ├── Truchet Hexagon.ShaderGraph.meta
│ │ ├── Truchet Square.ShaderGraph
│ │ ├── Truchet Square.ShaderGraph.meta
│ │ ├── Truchet Triangle.ShaderGraph
│ │ └── Truchet Triangle.ShaderGraph.meta
│ ├── Textures.meta
│ ├── Textures
│ │ ├── Hexagon_0.psd
│ │ ├── Hexagon_0.psd.meta
│ │ ├── Square_0.psd
│ │ ├── Square_0.psd.meta
│ │ ├── Square_1.psd
│ │ ├── Square_1.psd.meta
│ │ ├── Triangle_0.psd
│ │ └── Triangle_0.psd.meta
│ ├── Truchet Hexagon.prefab
│ ├── Truchet Hexagon.prefab.meta
│ ├── Truchet Square.prefab
│ ├── Truchet Square.prefab.meta
│ ├── Truchet Triangle.prefab
│ └── Truchet Triangle.prefab.meta
│ ├── README.md
│ ├── Texture2DArrayBehaviour.cs
│ ├── Texture2DArrayBehaviour.cs.meta
│ ├── TruchetNodes.cs
│ └── TruchetNodes.cs.meta
└── README.md
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 gilescoope
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Nodes/Complex.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a2a406c7db6058b4f9384d49896ef4c2
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Complex/ComplexNodes.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using UnityEditor.ShaderGraph;
5 | using UnityEngine;
6 |
7 |
8 | [Title("Math", "Complex", "Complex Conjugate")]
9 | internal class ComplexConjugateNode : CodeFunctionNode {
10 | public ComplexConjugateNode() {
11 | name = "Complex Conjugate";
12 | }
13 |
14 | protected override MethodInfo GetFunctionToConvert() {
15 | return GetType().GetMethod("ComplexConjugate", BindingFlags.Static | BindingFlags.NonPublic);
16 | }
17 |
18 | static string ComplexConjugate([Slot(0, Binding.None)] Vector2 A, [Slot(1, Binding.None)] out Vector2 Out) {
19 | Out = Vector2.zero;
20 | return @"
21 | {
22 | Out = float2(A.x, -A.y);
23 | }
24 | ";
25 | }
26 | }
27 |
28 | [Title("Math", "Complex", "Complex Reciprocal")]
29 | internal class ComplexReciprocalNode : CodeFunctionNode {
30 | public ComplexReciprocalNode() {
31 | name = "Complex Reciprocal";
32 | }
33 |
34 | protected override MethodInfo GetFunctionToConvert() {
35 | return GetType().GetMethod("ComplexReciprocal", BindingFlags.Static | BindingFlags.NonPublic);
36 | }
37 |
38 | static string ComplexReciprocal([Slot(0, Binding.None)] Vector2 A, [Slot(1, Binding.None)] out Vector2 Out) {
39 | Out = Vector2.zero;
40 | return @"
41 | {
42 | Out = float2(A.x, -A.y)/(A.x*A.x + A.y*A.y);
43 | }
44 | ";
45 | }
46 | }
47 |
48 | [Title("Math", "Complex", "Complex Multiply")]
49 | internal class ComplexMultiplyNode : CodeFunctionNode {
50 | public ComplexMultiplyNode() {
51 | name = "Complex Multiply";
52 | }
53 |
54 | protected override MethodInfo GetFunctionToConvert() {
55 | return GetType().GetMethod("ComplexMultiply", BindingFlags.Static | BindingFlags.NonPublic);
56 | }
57 |
58 | static string ComplexMultiply([Slot(0, Binding.None)] Vector2 A, [Slot(1, Binding.None)] Vector2 B, [Slot(2, Binding.None)] out Vector2 Out) {
59 | Out = Vector2.zero;
60 | return @"
61 | {
62 | Out = float2(A.x*B.x - A.y*B.y, A.x*B.y + A.y*B.x);
63 | }
64 | ";
65 | }
66 | }
67 |
68 | [Title("Math", "Complex", "Complex Divide")]
69 | internal class ComplexDivideNode : CodeFunctionNode {
70 | public ComplexDivideNode() {
71 | name = "Complex Divide";
72 | }
73 |
74 | protected override MethodInfo GetFunctionToConvert() {
75 | return GetType().GetMethod("ComplexDivide", BindingFlags.Static | BindingFlags.NonPublic);
76 | }
77 |
78 | static string ComplexDivide([Slot(0, Binding.None)] Vector2 A, [Slot(1, Binding.None)] Vector2 B, [Slot(2, Binding.None)] out Vector2 Out) {
79 | Out = Vector2.zero;
80 | return @"
81 | {
82 | Out = float2(A.x*B.x + A.y*B.y, A.y*B.x - A.x*B.y)/(B.x*B.x + B.y*B.y);
83 | }
84 | ";
85 | }
86 | }
87 |
88 | [Title("Math", "Complex", "Complex Exponential")]
89 | internal class ComplexExponentialNode : CodeFunctionNode {
90 | public ComplexExponentialNode() {
91 | name = "Complex Exponential";
92 | }
93 |
94 | protected override MethodInfo GetFunctionToConvert() {
95 | return GetType().GetMethod("ComplexExponential", BindingFlags.Static | BindingFlags.NonPublic);
96 | }
97 |
98 | static string ComplexExponential([Slot(0, Binding.None)] Vector2 A, [Slot(1, Binding.None)] out Vector2 Out) {
99 | Out = Vector2.zero;
100 | return @"
101 | {
102 | float Sin, Cos;
103 | sincos(A.y, Sin, Cos);
104 | Out = exp(A.x)*float2(Cos, Sin);
105 | }
106 | ";
107 | }
108 | }
109 |
110 | [Title("Math", "Complex", "Complex Logarithm")]
111 | internal class ComplexLogarithmNode : CodeFunctionNode {
112 | public ComplexLogarithmNode() {
113 | name = "Complex Logarithm";
114 | }
115 |
116 | protected override MethodInfo GetFunctionToConvert() {
117 | return GetType().GetMethod("ComplexLogarithm", BindingFlags.Static | BindingFlags.NonPublic);
118 | }
119 |
120 | static string ComplexLogarithm([Slot(0, Binding.None)] Vector2 A, [Slot(1, Binding.None)] out Vector2 Out) {
121 | Out = Vector2.zero;
122 | return @"
123 | {
124 | Out = float2(log(sqrt(A.x*A.x + A.y*A.y)), atan2(A.y, A.x));
125 | }
126 | ";
127 | }
128 | }
129 |
130 | [Title("Math", "Complex", "Complex Power")]
131 | internal class ComplexPowerNode : CodeFunctionNode {
132 | public ComplexPowerNode() {
133 | name = "Complex Power";
134 | }
135 |
136 | protected override MethodInfo GetFunctionToConvert() {
137 | return GetType().GetMethod("ComplexPower", BindingFlags.Static | BindingFlags.NonPublic);
138 | }
139 |
140 | static string ComplexPower([Slot(0, Binding.None)] Vector2 A, [Slot(1, Binding.None)] Vector2 B, [Slot(2, Binding.None)] out Vector2 Out) {
141 | Out = Vector2.zero;
142 | return @"
143 | {
144 | float arg = atan2(A.y, A.x);
145 | float len2 = A.x*A.x + A.y*A.y;
146 | float Sin, Cos;
147 | sincos(B.x*arg + 0.5*B.y*log(len2), Sin, Cos);
148 | Out = (pow(len2, 0.5*B.x)*exp(-B.y*arg))*float2(Cos, Sin);
149 | }
150 | ";
151 | }
152 | }
--------------------------------------------------------------------------------
/Nodes/Complex/ComplexNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f809e2bcd5bd59b4e81591259761c6c5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Complex/README.md:
--------------------------------------------------------------------------------
1 | # Complex
2 |
3 | These nodes allow complex arithmetic inside the shader graph. The x component of each Vector2 represents the real part of the complex number, the y component the imaginary part.
4 |
5 | | Node | Result |
6 | |---|---|
7 | | Complex Conjugate | Out = Ā |
8 | | Complex Reciprocal | Out = 1 / A |
9 | | Complex Multiply | Out = A × B |
10 | | Complex Divide | Out = A / B |
11 | | Complex Logarithm | Out = ln (A) |
12 | | Complex Exponential | Out = e ^ A |
13 | | Complex Power | Out = A ^ B |
14 |
15 | Addition and subtraction can be accomplished with the standard vector nodes. The modulus and argument of a complex number can be extracted using the polar coordinates node.
16 |
--------------------------------------------------------------------------------
/Nodes/Composite.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4c1fce38e6e19e141acd0e3e37987067
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Composite/CompositeNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using System;
3 | using UnityEditor.ShaderGraph;
4 | using System.Reflection;
5 | using UnityEditor.Graphing;
6 | using UnityEditor.ShaderGraph.Drawing.Controls;
7 | using UnityEngine;
8 |
9 | [Serializable]
10 | public enum CompositeMode
11 | {
12 | Over,
13 | In,
14 | Out,
15 | Atop,
16 | Xor
17 | }
18 |
19 | [Title("Compositing", "Composite")]
20 | internal class CompositeNode : CodeFunctionNode {
21 | [SerializeField]
22 | private CompositeMode m_CompositeMode = CompositeMode.Over;
23 |
24 | public CompositeNode() {
25 | name = "Composite";
26 | }
27 |
28 | private string GetCurrentBlendName()
29 | {
30 | return Enum.GetName(typeof (CompositeMode), (object) this.m_CompositeMode);
31 | }
32 |
33 | [EnumControl("Mode")]
34 | public CompositeMode compositeMode
35 | {
36 | get
37 | {
38 | return this.m_CompositeMode;
39 | }
40 | set
41 | {
42 | if (this.m_CompositeMode == value)
43 | return;
44 | this.m_CompositeMode = value;
45 | this.Dirty(ModificationScope.Graph);
46 | }
47 | }
48 |
49 | protected override MethodInfo GetFunctionToConvert()
50 | {
51 | return this.GetType().GetMethod(string.Format("Composite_{0}", (object) this.GetCurrentBlendName()), BindingFlags.Static | BindingFlags.NonPublic);
52 | }
53 |
54 | private static string Composite_Over([Slot(0, Binding.None)] Vector4 A, [Slot(1, Binding.None)] Vector4 B, [Slot(2, Binding.None)] out Vector4 Out) {
55 | Out = Vector4.zero;
56 | return @"
57 | {
58 | Out.w = A.w + B.w*(1-A.w);
59 | Out.xyz = (A.xyz*A.w + B.xyz*B.w*(1-A.w))/Out.w;
60 | }
61 | ";
62 | }
63 |
64 | private static string Composite_In([Slot(0, Binding.None)] Vector4 A, [Slot(1, Binding.None)] Vector4 B, [Slot(2, Binding.None)] out Vector4 Out) {
65 | Out = Vector4.zero;
66 | return @"
67 | {
68 | Out.w = A.w * B.w;
69 | Out.xyz = (A.xyz*A.w*B.w)/Out.w;
70 | }
71 | ";
72 | }
73 |
74 | private static string Composite_Out([Slot(0, Binding.None)] Vector4 A, [Slot(1, Binding.None)] Vector4 B, [Slot(2, Binding.None)] out Vector4 Out) {
75 | Out = Vector4.zero;
76 | return @"
77 | {
78 | Out.w = A.w * (1-B.w);
79 | Out.xyz = (A.xyz*A.w*(1-B.w))/Out.w;
80 | }
81 | ";
82 | }
83 |
84 | private static string Composite_Atop([Slot(0, Binding.None)] Vector4 A, [Slot(1, Binding.None)] Vector4 B, [Slot(2, Binding.None)] out Vector4 Out) {
85 | Out = Vector4.zero;
86 | return @"
87 | {
88 | Out.w = B.w;
89 | Out.xyz = (A.xyz*A.w*B.w + B.xyz*B.w*(1-A.w))/Out.w;
90 | }
91 | ";
92 | }
93 |
94 | private static string Composite_Xor([Slot(0, Binding.None)] Vector4 A, [Slot(1, Binding.None)] Vector4 B, [Slot(2, Binding.None)] out Vector4 Out) {
95 | Out = Vector4.zero;
96 | return @"
97 | {
98 | Out.w = A.w + B.w - 2*A.w*B.w;
99 | Out.xyz = (A.xyz*A.w*(1-B.w) + B.xyz*B.w*(1-A.w))/Out.w;
100 | }
101 | ";
102 | }
103 | }
104 | #endif
--------------------------------------------------------------------------------
/Nodes/Composite/CompositeNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5f0fcd58cf6140c4495e14f79427004c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Composite/README.md:
--------------------------------------------------------------------------------
1 | # Composite
2 |
3 | This Shader Graph node is for alpha compositing two rgba channels using Porter Duff equations.
4 |
5 | https://en.wikipedia.org/wiki/Alpha_compositing
6 |
7 | Here we see what happens if we composite a blue square A (71, 154, 239, 0.62) and a pink circle B (218, 31, 100, 0.62) using the different composite modes.
8 |
9 | | A | B |
10 | |---|---|
11 | |  |  |
12 |
13 | | A Over B | A In B | A Out B | A Atop B | A Xor B |
14 | |---|---|---|---|---|
15 | |  |  |  |  |  |
16 |
17 | Over is the regular painter's algorithm, equivalent to Blend > Normal in Photoshop.
18 |
19 | ## Usage
20 |
21 | Simply place the Composition > Composite node in your shader graph, plug in your A and B and select the desired blend node.
22 |
23 | 
24 |
25 | The trace colors here are just from .gif compression.
26 |
--------------------------------------------------------------------------------
/Nodes/Gilescoope.ShaderGraphNodes.Internal.asmref:
--------------------------------------------------------------------------------
1 | {
2 | "reference": "GUID:be0903cd8e1546f498710afdc59db5eb"
3 | }
--------------------------------------------------------------------------------
/Nodes/Gilescoope.ShaderGraphNodes.Internal.asmref.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9ec9568158df4a24a9c70fd5f68c34b5
3 | AssemblyDefinitionReferenceImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Nodes/Halftone.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f26409998a53c43acba8791e14ca047f
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Halftone/HalftoneNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using System;
3 | using UnityEditor.ShaderGraph;
4 | using System.Reflection;
5 | using UnityEditor.Graphing;
6 | using UnityEditor.ShaderGraph.Drawing.Controls;
7 | using UnityEngine;
8 |
9 | [Serializable]
10 | public enum HalftoneMode {
11 | Circle,
12 | Smooth,
13 | Square
14 | }
15 |
16 | [Title("Halftone", "Halftone Monochrome")]
17 | internal class HalftoneMonochromeNode : CodeFunctionNode {
18 | [SerializeField] private HalftoneMode m_HalftoneMode = HalftoneMode.Circle;
19 |
20 | public HalftoneMonochromeNode() {
21 | name = "Halftone Monochrome";
22 | }
23 |
24 | private string GetCurrentModeName() {
25 | return Enum.GetName(typeof(HalftoneMode), m_HalftoneMode);
26 | }
27 |
28 | [EnumControl("Mode")]
29 | public HalftoneMode halftoneMode {
30 | get { return m_HalftoneMode; }
31 | set {
32 | if (m_HalftoneMode == value)
33 | return;
34 | m_HalftoneMode = value;
35 | Dirty(ModificationScope.Graph);
36 | }
37 | }
38 |
39 | protected override MethodInfo GetFunctionToConvert() {
40 | return GetType().GetMethod(string.Format("HalftoneMonochrome_{0}", GetCurrentModeName()), BindingFlags.Static | BindingFlags.NonPublic);
41 | }
42 |
43 | private static string HalftoneMonochrome_Circle([Slot(0, Binding.None)] Vector1 Base, [Slot(1, Binding.WorldSpacePosition)] Vector2 UV, [Slot(2, Binding.None, 0.01f, 0, 0, 0)]
44 | Vector2 Offset, [Slot(3, Binding.None)] out Vector1 Out) {
45 | return @"
46 | {
47 | float Scale = 0.78;
48 | float2 Direction = Offset/dot(Offset, Offset);
49 | float2 Position = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
50 | Out = Scale*dot(Position, Position)/(0.25*(1-Base));
51 | Out = 1-saturate((1 - Out) / fwidth(Out));
52 | }
53 | ";
54 | }
55 |
56 | private static string HalftoneMonochrome_Smooth([Slot(0, Binding.None)] Vector1 Base, [Slot(1, Binding.WorldSpacePosition)] Vector2 UV, [Slot(2, Binding.None, 0.01f, 0, 0, 0)]
57 | Vector2 Offset, [Slot(3, Binding.None)] out Vector1 Out) {
58 | return @"
59 | {
60 | float2 Direction = Offset/dot(Offset, Offset);
61 | float2 Position1 = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
62 | float2 Position2 = fmod(Position1 + 1, 1) - 0.5;
63 | float P1P1 = dot(Position1, Position1);
64 | float P2P2 = dot(Position2, Position2);
65 | float T = P1P1/(P1P1 + P2P2);
66 | Out.x = (1-T)*(P1P1 - 0.25*(1-Base))-T*(P2P2 - 0.25*Base);
67 | Out = 1-saturate((-Out) / fwidth(Out));
68 |
69 | }
70 | ";
71 | }
72 |
73 | private static string HalftoneMonochrome_Square([Slot(0, Binding.None)] Vector1 Base, [Slot(1, Binding.WorldSpacePosition)] Vector2 UV, [Slot(2, Binding.None, 0.01f, 0, 0, 0)]
74 | Vector2 Offset, [Slot(3, Binding.None)] out Vector1 Out) {
75 | return @"
76 | {
77 | float2 Direction = Offset/dot(Offset, Offset);
78 | float2 Position = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
79 | float Radius = 0.5*sqrt(1-Base);
80 | Out = max(abs(Position.x), abs(Position.y))/Radius;
81 | Out = 1-saturate((1 - Out) / fwidth(Out));
82 | }
83 | ";
84 | }
85 | }
86 |
87 | [Title("Halftone", "Halftone Color")]
88 | internal class HalftoneColorNode : CodeFunctionNode {
89 | [SerializeField] private HalftoneMode m_HalftoneMode = HalftoneMode.Circle;
90 |
91 | public HalftoneColorNode() {
92 | name = "Halftone Color";
93 | }
94 |
95 | private string GetCurrentModeName() {
96 | return Enum.GetName(typeof(HalftoneMode), m_HalftoneMode);
97 | }
98 |
99 | [EnumControl("Mode")]
100 | public HalftoneMode halftoneMode {
101 | get { return m_HalftoneMode; }
102 | set {
103 | if (m_HalftoneMode == value)
104 | return;
105 | m_HalftoneMode = value;
106 | Dirty(ModificationScope.Graph);
107 | }
108 | }
109 |
110 | protected override MethodInfo GetFunctionToConvert() {
111 | return GetType().GetMethod(string.Format("HalftoneColor_{0}", GetCurrentModeName()), BindingFlags.Static | BindingFlags.NonPublic);
112 | }
113 |
114 | static string HalftoneColor_Circle([Slot(0, Binding.None)] Vector3 Base, [Slot(1, Binding.WorldSpacePosition)] Vector2 UV, [Slot(2, Binding.None, 0.01f, 0, 0, 0)]
115 | Vector2 OffsetR, [Slot(3, Binding.None, 0.00866f, 0.005f, 0, 0)]
116 | Vector2 OffsetG, [Slot(4, Binding.None, 0.005f, 0.00866f, 0, 0)]
117 | Vector2 OffsetB, [Slot(5, Binding.None)] out Vector3 Out) {
118 | Out = new Vector3();
119 | return @"
120 | {
121 | float Scale = 0.78;
122 | float2 Direction = OffsetR/dot(OffsetR, OffsetR);
123 | float2 Position = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
124 | Out.x = Scale*dot(Position, Position)/(0.25*(1-Base.x));
125 | Direction = OffsetG/dot(OffsetG, OffsetG);
126 | Position = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
127 | Out.y = Scale*dot(Position, Position)/(0.25*(1-Base.y));
128 | Direction = OffsetB/dot(OffsetB, OffsetB);
129 | Position = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
130 | Out.z = Scale*dot(Position, Position)/(0.25*(1-Base.z));
131 | Out = 1-saturate((1 - Out) / fwidth(Out));
132 | }
133 | ";
134 | }
135 |
136 | static string HalftoneColor_Smooth([Slot(0, Binding.None)] Vector3 Base, [Slot(1, Binding.WorldSpacePosition)] Vector2 UV, [Slot(2, Binding.None, 0.01f, 0, 0, 0)]
137 | Vector2 OffsetR, [Slot(3, Binding.None, 0.00866f, 0.005f, 0, 0)]
138 | Vector2 OffsetG, [Slot(4, Binding.None, 0.005f, 0.00866f, 0, 0)]
139 | Vector2 OffsetB, [Slot(5, Binding.None)] out Vector3 Out) {
140 | Out = new Vector3();
141 | return @"
142 | {
143 | float2 Direction = OffsetR/dot(OffsetR, OffsetR);
144 | float2 Position1 = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
145 | float2 Position2 = fmod(Position1 + 1, 1) - 0.5;
146 | float P1P1 = dot(Position1, Position1);
147 | float P2P2 = dot(Position2, Position2);
148 | float T = P1P1/(P1P1 + P2P2);
149 | Out.x = (1-T)*(P1P1 - 0.25*(1-Base.x))-T*(P2P2 - 0.25*Base.x);
150 | Direction = OffsetG/dot(OffsetG, OffsetG);
151 | Position1 = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
152 | Position2 = fmod(Position1 + 1, 1) - 0.5;
153 | P1P1 = dot(Position1, Position1);
154 | P2P2 = dot(Position2, Position2);
155 | T = P1P1/(P1P1 + P2P2);
156 | Out.y = (1-T)*(P1P1 - 0.25*(1-Base.y))-T*(P2P2 - 0.25*Base.y);
157 | Direction = OffsetB/dot(OffsetB, OffsetB);
158 | Position1 = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
159 | Position2 = fmod(Position1 + 1, 1) - 0.5;
160 | P1P1 = dot(Position1, Position1);
161 | P2P2 = dot(Position2, Position2);
162 | T = P1P1/(P1P1 + P2P2);
163 | Out.z = (1-T)*(P1P1 - 0.25*(1-Base.z))-T*(P2P2 - 0.25*Base.z);
164 | Out = 1-saturate((- Out) / fwidth(Out));
165 | }
166 | ";
167 | }
168 |
169 | static string HalftoneColor_Square([Slot(0, Binding.None)] Vector3 Base, [Slot(1, Binding.WorldSpacePosition)] Vector2 UV, [Slot(2, Binding.None, 0.01f, 0, 0, 0)]
170 | Vector2 OffsetR, [Slot(3, Binding.None, 0.00866f, 0.005f, 0, 0)]
171 | Vector2 OffsetG, [Slot(4, Binding.None, 0.005f, 0.00866f, 0, 0)]
172 | Vector2 OffsetB, [Slot(5, Binding.None)] out Vector3 Out) {
173 | Out = new Vector3();
174 | return @"
175 | {
176 | float2 Direction = OffsetR/dot(OffsetR, OffsetR);
177 | float2 Position = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
178 | float Radius = 0.5*sqrt(1-Base.x);
179 | Out.x = max(abs(Position.x), abs(Position.y))/Radius;
180 | Direction = OffsetG/dot(OffsetG, OffsetG);
181 | Position = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
182 | Radius = 0.5*sqrt(1-Base.y);
183 | Out.y = max(abs(Position.x), abs(Position.y))/Radius;
184 | Direction = OffsetB/dot(OffsetB, OffsetB);
185 | Position = fmod(abs(float2(dot(UV, Direction), -UV.x*Direction.y + UV.y*Direction.x)) + 0.5, 1) - 0.5;
186 | Radius = 0.5*sqrt(1-Base.z);
187 | Out.z = max(abs(Position.x), abs(Position.y))/Radius;
188 | Out = 1-saturate((1 - Out) / fwidth(Out));
189 | }
190 | ";
191 | }
192 | }
193 | #endif
--------------------------------------------------------------------------------
/Nodes/Halftone/HalftoneNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 580db6bf5bfb046029c0f8a4c2c43d5b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Halftone/README.md:
--------------------------------------------------------------------------------
1 | # Halftone
2 |
3 | This is a set of custom nodes for use with Shader Graph that allow you to do halftone rendering.
4 |
5 | 
6 |
7 | https://en.wikipedia.org/wiki/Halftone
8 |
9 | ## Halftone Circle
10 |
11 | The inks spots are circles.
12 |
13 | ## Halftone Square
14 |
15 | The ink spots are squares
16 |
17 | ## Halftone Smooth
18 |
19 | The ink spots blend between black circles and white circles for light and dark areas respectively.
20 |
21 | ## Usage
22 |
23 | All are available in monotone and three channel colour variants.
24 |
25 | The offset vector input defines the scale and angle of the halftone pattern.
26 |
27 | To use simply add the .cs file to your project then inside Shader Graph click Create Node > Halftone and use one of the nodes.
28 |
--------------------------------------------------------------------------------
/Nodes/Lab Color.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d7f6cdff6e485ac43834071ffbfbad1a
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Lab Color/LabColorNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using System;
3 | using UnityEditor.ShaderGraph;
4 | using System.Reflection;
5 | using UnityEditor.Graphing;
6 | using UnityEditor.ShaderGraph.Drawing.Controls;
7 | using UnityEngine;
8 |
9 | [Title("Artistic", "Utility", "Color Scheme Complimentary")]
10 | internal class ComplimentaryNode : CodeFunctionNode {
11 | public ComplimentaryNode() {
12 | name = "Color Scheme Complimentary";
13 | }
14 |
15 | protected override MethodInfo GetFunctionToConvert() {
16 | return GetType().GetMethod("Complimentary", BindingFlags.Static | BindingFlags.NonPublic);
17 | }
18 |
19 | private static string Complimentary([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
20 | Out = Vector4.zero;
21 | return @"
22 | {
23 | const float3x3 RGBXYZ = float3x3(0.4124564, 0.3575761, 0.1804375,
24 | 0.2126729, 0.7151522, 0.0721750,
25 | 0.0193339, 0.1191920, 0.9503041);
26 | const float3x3 XYZRGB = float3x3(3.2404542, -1.5371385, -0.4985314,
27 | -0.9692660, 1.8760108, 0.0415560,
28 | 0.0556434, -0.2040259, 1.0572252);
29 | const float3 n = float3(95.047, 100.000, 108.883);
30 | Out.w = In.w;
31 |
32 | float3 RGB = In.xyz;
33 | float3 XYZ = mul(RGBXYZ, RGB)/n;
34 | float3 f = float3(XYZ > 0.00885645167) ? pow(XYZ, 0.3333333333) : 7.7870370374 * XYZ + 0.13793103448;
35 | float3 Lab = float3(116 * f.y - 16, 500 * (f.x-f.y), 200 * (f.y-f.z));
36 |
37 | Lab = float3(Lab.x, -Lab.y, -Lab.z);
38 | XYZ = float3(Lab.y/500, 0, -Lab.z/200) + (Lab.x + 16)/116;
39 | XYZ = n * (float3(XYZ > 0.20689655172) ? XYZ*XYZ*XYZ : 0.12841854934 * (XYZ - 0.13793103448));
40 | RGB = mul(XYZRGB, XYZ);
41 | Out.xyz = RGB;
42 | }
43 | ";
44 | }
45 | }
46 |
47 | [Title("Artistic", "Utility", "Color Scheme Split")]
48 | internal class SplitNode : CodeFunctionNode {
49 | public SplitNode() {
50 | name = "Color Scheme Split";
51 | }
52 |
53 | protected override MethodInfo GetFunctionToConvert() {
54 | return GetType().GetMethod("Split", BindingFlags.Static | BindingFlags.NonPublic);
55 | }
56 |
57 | private static string Split([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None, 120, 0, 0, 0)] Vector1 Angle, [Slot(2, Binding.None)] out Vector4 Out1, [Slot(3, Binding.None)] out Vector4 Out2) {
58 | Out1 = Vector4.zero;
59 | Out2 = Vector4.zero;
60 | return @"
61 | {
62 | Angle = radians(Angle);
63 | const float3x3 RGBXYZ = float3x3(0.4124564, 0.3575761, 0.1804375,
64 | 0.2126729, 0.7151522, 0.0721750,
65 | 0.0193339, 0.1191920, 0.9503041);
66 | const float3x3 XYZRGB = float3x3(3.2404542, -1.5371385, -0.4985314,
67 | -0.9692660, 1.8760108, 0.0415560,
68 | 0.0556434, -0.2040259, 1.0572252);
69 | const float3 n = float3(95.047, 100.000, 108.883);
70 | Out1.w = In.w;
71 | Out2.w = In.w;
72 |
73 | float3 RGB = In.xyz;
74 | float3 XYZ = mul(RGBXYZ, RGB)/n;
75 | float3 f = float3(XYZ > 0.00885645167) ? pow(XYZ, 0.3333333333) : 7.7870370374 * XYZ + 0.13793103448;
76 | float3 Lab = float3(116 * f.y - 16, 500 * (f.x-f.y), 200 * (f.y-f.z));
77 | float3 LCH = float3(Lab.x, sqrt(Lab.y*Lab.y + Lab.z*Lab.z), (Lab.z == 0 && Lab.y == 0) ? 0 : atan2(Lab.z, Lab.y));
78 |
79 | Lab = float3(LCH.x, LCH.y*cos(LCH.z+ Angle), LCH.y*sin(LCH.z + Angle));
80 | XYZ = float3(Lab.y/500, 0, -Lab.z/200) + (Lab.x + 16)/116;
81 | XYZ = n * (float3(XYZ > 0.20689655172) ? XYZ*XYZ*XYZ : 0.12841854934 * (XYZ - 0.13793103448));
82 | RGB = mul(XYZRGB, XYZ);
83 | Out1.xyz = RGB;
84 |
85 | Lab = float3(LCH.x, LCH.y*cos(LCH.z - Angle), LCH.y*sin(LCH.z - Angle));
86 | XYZ = float3(Lab.y/500, 0, -Lab.z/200) + (Lab.x + 16)/116;
87 | XYZ = n * (float3(XYZ > 0.20689655172) ? XYZ*XYZ*XYZ : 0.12841854934 * (XYZ - 0.13793103448));
88 | RGB = mul(XYZRGB, XYZ);
89 | Out2.xyz = RGB;
90 | }
91 | ";
92 | }
93 | }
94 |
95 | [Title("Artistic", "Utility", "Color Scheme Dual")]
96 | internal class DualNode : CodeFunctionNode {
97 | public DualNode() {
98 | name = "Color Scheme Dual";
99 | }
100 |
101 | protected override MethodInfo GetFunctionToConvert() {
102 | return GetType().GetMethod("Dual", BindingFlags.Static | BindingFlags.NonPublic);
103 | }
104 |
105 | private static string Dual([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None, 90, 0, 0, 0)] Vector1 Angle, [Slot(2, Binding.None)] out Vector4 Out1, [Slot(3, Binding.None)] out Vector4 Out2, [Slot(4, Binding.None)] out Vector4 Out3) {
106 | Out1 = Vector4.zero;
107 | Out2 = Vector4.zero;
108 | Out3 = Vector4.zero;
109 | return @"
110 | {
111 | Angle = radians(Angle);
112 | const float3x3 RGBXYZ = float3x3(0.4124564, 0.3575761, 0.1804375,
113 | 0.2126729, 0.7151522, 0.0721750,
114 | 0.0193339, 0.1191920, 0.9503041);
115 | const float3x3 XYZRGB = float3x3(3.2404542, -1.5371385, -0.4985314,
116 | -0.9692660, 1.8760108, 0.0415560,
117 | 0.0556434, -0.2040259, 1.0572252);
118 | const float3 n = float3(95.047, 100.000, 108.883);
119 | Out1.w = In.w;
120 | Out2.w = In.w;
121 | Out3.w = In.w;
122 |
123 | float3 RGB = In.xyz;
124 | float3 XYZ = mul(RGBXYZ, RGB)/n;
125 | float3 f = float3(XYZ > 0.00885645167) ? pow(XYZ, 0.3333333333) : 7.7870370374 * XYZ + 0.13793103448;
126 | float3 Lab = float3(116 * f.y - 16, 500 * (f.x-f.y), 200 * (f.y-f.z));
127 | float3 LCH = float3(Lab.x, sqrt(Lab.y*Lab.y + Lab.z*Lab.z), (Lab.z == 0 && Lab.y == 0) ? 0 : atan2(Lab.z, Lab.y));
128 |
129 | Lab = float3(Lab.x, -Lab.y, -Lab.z);
130 | XYZ = float3(Lab.y/500, 0, -Lab.z/200) + (Lab.x + 16)/116;
131 | XYZ = n * (float3(XYZ > 0.20689655172) ? XYZ*XYZ*XYZ : 0.12841854934 * (XYZ - 0.13793103448));
132 | RGB = mul(XYZRGB, XYZ);
133 | Out2.xyz = RGB;
134 |
135 | Lab = float3(LCH.x, LCH.y*cos(LCH.z+ Angle), LCH.y*sin(LCH.z + Angle));
136 | XYZ = float3(Lab.y/500, 0, -Lab.z/200) + (Lab.x + 16)/116;
137 | XYZ = n * (float3(XYZ > 0.20689655172) ? XYZ*XYZ*XYZ : 0.12841854934 * (XYZ - 0.13793103448));
138 | RGB = mul(XYZRGB, XYZ);
139 | Out1.xyz = RGB;
140 |
141 | Lab = float3(Lab.x, -Lab.y, -Lab.z);
142 | XYZ = float3(Lab.y/500, 0, -Lab.z/200) + (Lab.x + 16)/116;
143 | XYZ = n * (float3(XYZ > 0.20689655172) ? XYZ*XYZ*XYZ : 0.12841854934 * (XYZ - 0.13793103448));
144 | RGB = mul(XYZRGB, XYZ);
145 | Out3.xyz = RGB;
146 | }
147 | ";
148 | }
149 | }
150 |
151 | [Serializable]
152 | public enum LabColorspace {
153 | RGB,
154 | Lab,
155 | LCH
156 | }
157 |
158 | [Serializable]
159 | public struct LabColorspaceConversion : IEnumConversion {
160 | public LabColorspace from;
161 | public LabColorspace to;
162 |
163 | public LabColorspaceConversion(LabColorspace from, LabColorspace to) {
164 | this.from = from;
165 | this.to = to;
166 | }
167 |
168 | Enum IEnumConversion.from {
169 | get { return from; }
170 | set { from = (LabColorspace) value; }
171 | }
172 |
173 | Enum IEnumConversion.to {
174 | get { return to; }
175 | set { to = (LabColorspace) value; }
176 | }
177 | }
178 |
179 | [Title("Artistic", "Utility", "Lab Colorspace Conversion")]
180 | internal class LabColorspaceConversionNode : CodeFunctionNode {
181 | [SerializeField] private LabColorspaceConversion m_Conversion = new LabColorspaceConversion(LabColorspace.RGB, LabColorspace.RGB);
182 |
183 | public LabColorspaceConversionNode() {
184 | name = "Lab Colorspace Conversion";
185 | }
186 |
187 | [EnumConversionControl]
188 | private LabColorspaceConversion conversion {
189 | get { return m_Conversion; }
190 | set {
191 | if (m_Conversion.Equals(value))
192 | return;
193 | m_Conversion = value;
194 | Dirty(ModificationScope.Graph);
195 | }
196 | }
197 |
198 | private string GetSpaceFrom() {
199 | return Enum.GetName(typeof(LabColorspace), conversion.from);
200 | }
201 |
202 | private string GetSpaceTo() {
203 | return Enum.GetName(typeof(LabColorspace), conversion.to);
204 | }
205 |
206 | protected override MethodInfo GetFunctionToConvert() {
207 | return GetType().GetMethod(string.Format("LabColorspaceConversion_{0}_{1}", GetSpaceFrom(), GetSpaceTo()), BindingFlags.Static | BindingFlags.NonPublic);
208 | }
209 |
210 | private static string LabColorspaceConversion_RGB_RGB([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
211 | Out = Vector4.zero;
212 | return @"
213 | {
214 | Out = In;
215 | }
216 | ";
217 | }
218 |
219 | private static string LabColorspaceConversion_RGB_Lab([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
220 | Out = Vector4.zero;
221 | return @"
222 | {
223 | const float3x3 RGBXYZ = float3x3(0.4124564, 0.3575761, 0.1804375,
224 | 0.2126729, 0.7151522, 0.0721750,
225 | 0.0193339, 0.1191920, 0.9503041);
226 | const float3 n = float3(95.047, 100.000, 108.883);
227 |
228 | float3 RGB = In.xyz;
229 | float3 XYZ = mul(RGBXYZ, RGB)/n;
230 | float3 f = float3(XYZ > 0.00885645167) ? pow(XYZ, 0.3333333333) : 7.7870370374 * XYZ + 0.13793103448;
231 | float3 Lab = float3(116 * f.y - 16, 500 * (f.x-f.y), 200 * (f.y-f.z));
232 | Out.xyz = Lab;
233 | Out.w = In.w;
234 | }
235 | ";
236 | }
237 |
238 | private static string LabColorspaceConversion_RGB_LCH([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
239 | Out = Vector4.zero;
240 | return @"
241 | {
242 | const float3x3 RGBXYZ = float3x3(0.4124564, 0.3575761, 0.1804375,
243 | 0.2126729, 0.7151522, 0.0721750,
244 | 0.0193339, 0.1191920, 0.9503041);
245 | const float3 n = float3(95.047, 100.000, 108.883);
246 |
247 | float3 RGB = In.xyz;
248 | float3 XYZ = mul(RGBXYZ, RGB)/n;
249 | float3 f = float3(XYZ > 0.00885645167) ? pow(XYZ, 0.3333333333) : 7.7870370374 * XYZ + 0.13793103448;
250 | float3 Lab = float3(116 * f.y - 16, 500 * (f.x-f.y), 200 * (f.y-f.z));
251 | float3 LCH = float3(Lab.x, sqrt(Lab.y*Lab.y + Lab.z*Lab.z), (Lab.z == 0 && Lab.y == 0) ? 0 : atan2(Lab.z, Lab.y));
252 | Out.xyz = LCH;
253 | Out.w = In.w;
254 | }
255 | ";
256 | }
257 |
258 | private static string LabColorspaceConversion_Lab_RGB([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
259 | Out = Vector4.zero;
260 | return @"
261 | {
262 | const float3x3 XYZRGB = float3x3(3.2404542, -1.5371385, -0.4985314,
263 | -0.9692660, 1.8760108, 0.0415560,
264 | 0.0556434, -0.2040259, 1.0572252);
265 | const float3 n = float3(95.047, 100.000, 108.883);
266 |
267 | float3 Lab = In.xyz;
268 | float3 XYZ = float3(Lab.y/500, 0, -Lab.z/200) + (Lab.x + 16)/116;
269 | XYZ = n * (float3(XYZ > 0.20689655172) ? XYZ*XYZ*XYZ : 0.12841854934 * (XYZ - 0.13793103448));
270 | float3 RGB = mul(XYZRGB, XYZ);
271 | Out.xyz = RGB;
272 | Out.w = In.w;
273 | }
274 | ";
275 | }
276 |
277 | private static string LabColorspaceConversion_Lab_Lab([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
278 | Out = Vector4.zero;
279 | return @"
280 | {
281 | Out = In;
282 | }
283 | ";
284 | }
285 |
286 | private static string LabColorspaceConversion_Lab_LCH([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
287 | Out = Vector4.zero;
288 | return @"
289 | {
290 | float3 Lab = In.xyz;
291 | float3 LCH = float3(Lab.x, sqrt(Lab.y*Lab.y + Lab.z*Lab.z), (Lab.z == 0 && Lab.y == 0) ? 0 : atan2(Lab.z, Lab.y));
292 | Out.xyz = LCH;
293 | Out.w = In.w;
294 | }
295 | ";
296 | }
297 |
298 | private static string LabColorspaceConversion_LCH_RGB([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
299 | Out = Vector4.zero;
300 | return @"
301 | {
302 | const float3x3 XYZRGB = float3x3(3.2404542, -1.5371385, -0.4985314,
303 | -0.9692660, 1.8760108, 0.0415560,
304 | 0.0556434, -0.2040259, 1.0572252);
305 | const float3 n = float3(95.047, 100.000, 108.883);
306 |
307 | float3 LCH = In.xyz;
308 | float3 Lab = float3(LCH.x, LCH.y*cos(LCH.z), LCH.y*sin(LCH.z));
309 | float3 XYZ = float3(Lab.y/500, 0, -Lab.z/200) + (Lab.x + 16)/116;
310 | XYZ = n * (float3(XYZ > 0.20689655172) ? XYZ*XYZ*XYZ : 0.12841854934 * (XYZ - 0.13793103448));
311 | float3 RGB = mul(XYZRGB, XYZ);
312 | Out.xyz = RGB;
313 | Out.w = In.w;
314 | }
315 | ";
316 | }
317 |
318 | private static string LabColorspaceConversion_LCH_Lab([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
319 | Out = Vector4.zero;
320 | return @"
321 | {
322 | float3 LCH = In.xyz;
323 | float3 Lab = float3(LCH.x, LCH.y*cos(LCH.z), LCH.y*sin(LCH.z));
324 | Out.xyz = Lab;
325 | Out.w = In.w;
326 | }
327 | ";
328 | }
329 |
330 | private static string LabColorspaceConversion_LCH_LCH([Slot(0, Binding.None)] Vector4 In, [Slot(1, Binding.None)] out Vector4 Out) {
331 | Out = Vector4.zero;
332 | return @"
333 | {
334 | Out = In;
335 | }
336 | ";
337 | }
338 | }
339 |
340 | #endif
--------------------------------------------------------------------------------
/Nodes/Lab Color/LabColorNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 021e39dfcc8e8f84a95635732dd83f8c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Lab Color/README.md:
--------------------------------------------------------------------------------
1 | # Lab Color
2 |
3 | These nodes are for doing color work in Lab and LCH color spaces.
4 |
5 | https://en.wikipedia.org/wiki/CIELAB_color_space
6 |
7 | Lab and LCH are designed to approximate human vision so can more useful than RGB and HSV when the perception of color is important.
8 |
9 | ## Lab Colorspace Conversion
10 |
11 | 
12 |
13 | This node converts between RGB, Lab and LCH color spaces. Alpha is preserved.
14 |
15 | ## Color Schemes
16 |
17 | These nodes use the LCH color space to output color schemes from the color wheel. According to color theory these colors should be harmonious with one another.
18 |
19 | |Complementary| Split| Dual|
20 | |---|---|---|
21 | ||||
22 | | Here the Out hue is opposite the In hue | The Out colors lie each an angle Angle away from In
An Angle < 90 will give an adjacent scheme
An Angle > 120 will give a split complementary scheme
An Angle = 120 will give a triadic scheme | The Out colors lie in a rectangle defined by In and Angle
An Angle = 90 will give a tetradic scheme |
23 |
--------------------------------------------------------------------------------
/Nodes/Pattern.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bcfab32ed4d2cff4f8b9deec589ad3e3
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Pattern/PatternNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using UnityEditor.ShaderGraph;
3 | using System.Reflection;
4 | using UnityEngine;
5 |
6 | [Title("Pattern", "Zig Zag")]
7 | internal class ZigZagNode : CodeFunctionNode {
8 | public ZigZagNode() {
9 | name = "Zig Zag";
10 | }
11 |
12 | protected override MethodInfo GetFunctionToConvert() {
13 | return GetType().GetMethod("ZigZag", BindingFlags.Static | BindingFlags.NonPublic);
14 | }
15 |
16 | static string ZigZag([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None, 0.1f, 0.1f, 0, 0)]
17 | Vector2 Widths, [Slot(2, Binding.None, 0.5f, 0, 0, 0)] Vector1 Wavelength, [Slot(3, Binding.None, 0.1f, 0, 0, 0)] Vector1 Amplitude, [Slot(4, Binding.None)] out Vector1 Out) {
18 | return @"
19 | {
20 | float Width = Widths.x + Widths.y;
21 | Out = ((UV.y - Amplitude * (1-2* abs(frac(UV.x/Wavelength) - 0.5)))%Width + Width) % Width;
22 | Out = abs(Out - 0.5*Width) - 0.5* Widths.y;
23 | Out = saturate(Out/fwidth(Out));
24 | }
25 | ";
26 | }
27 | }
28 |
29 | [Title("Pattern", "Sine Waves")]
30 | internal class SineWavesNode : CodeFunctionNode {
31 | public SineWavesNode() {
32 | name = "Sine Waves";
33 | }
34 |
35 | protected override MethodInfo GetFunctionToConvert() {
36 | return GetType().GetMethod("SineWaves", BindingFlags.Static | BindingFlags.NonPublic);
37 | }
38 |
39 | static string SineWaves([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None, 0.1f, 0.1f, 0, 0)]
40 | Vector2 Widths, [Slot(2, Binding.None, 0.5f, 0, 0, 0)] Vector1 Wavelength, [Slot(3, Binding.None, 0.1f, 0, 0, 0)] Vector1 Amplitude, [Slot(4, Binding.None)] out Vector1 Out) {
41 | return @"
42 | {
43 | float Width = Widths.x + Widths.y;
44 | float y = 0.5*Amplitude * sin(6.28318530718 * UV.x/Wavelength);
45 | Out = ((UV.y - y)%Width + Width) % Width;
46 | Out = abs(Out - 0.5*Width) - 0.5* Widths.y;
47 | Out = saturate(Out/fwidth(Out));
48 | }
49 | ";
50 | }
51 | }
52 |
53 | [Title("Pattern", "Round Waves")]
54 | internal class RoundWavesNode : CodeFunctionNode {
55 | public RoundWavesNode() {
56 | name = "Round Waves";
57 | }
58 |
59 | protected override MethodInfo GetFunctionToConvert() {
60 | return GetType().GetMethod("RoundWaves", BindingFlags.Static | BindingFlags.NonPublic);
61 | }
62 |
63 | static string RoundWaves([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None, 0.1f, 0.1f, 0, 0)]
64 | Vector2 Widths, [Slot(2, Binding.None, 0.5f, 0, 0, 0)] Vector1 Wavelength, [Slot(3, Binding.None, 0.1f, 0, 0, 0)] Vector1 Amplitude, [Slot(4, Binding.None)] out Vector1 Out) {
65 | return @"
66 | {
67 | float Width = Widths.x + Widths.y;
68 | float x = (((UV.x % Wavelength) + Wavelength) % Wavelength);
69 | float X = 0.25*Wavelength;
70 | float Y = 0.5*Amplitude;
71 | float Offset = (X*X - Y*Y)/(2*Y);
72 | float R = Offset + Y;
73 | float x2 = x < 0.5 * Wavelength ? 0.25 * Wavelength - x : 0.75*Wavelength - x;
74 | float y = (x < 0.5 * Wavelength ? 1 : -1) * (sqrt(R*R - x2*x2) - Offset);
75 | Out = ((UV.y - y)%Width + Width) % Width;
76 | Out = abs(Out - 0.5*Width) - 0.5* Widths.y;
77 | Out = saturate(Out/fwidth(Out));
78 | }
79 | ";
80 | }
81 | }
82 |
83 | [Title("Pattern", "Dots")]
84 | internal class DotsNode : CodeFunctionNode {
85 | public DotsNode() {
86 | name = "Dots";
87 | }
88 |
89 | protected override MethodInfo GetFunctionToConvert() {
90 | return GetType().GetMethod("Dots", BindingFlags.Static | BindingFlags.NonPublic);
91 | }
92 |
93 | static string Dots([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None, 0.2f, 0.2f, 0, 0)]
94 | Vector2 Spacing, [Slot(2, Binding.None, 0.1f, 0, 0, 0)] Vector1 Offset, [Slot(3, Binding.None, 0.05f, 0, 0, 0)]
95 | Vector1 Radius, [Slot(4, Binding.None)] out Vector1 Out) {
96 | return @"
97 | {
98 | float d = Spacing.x*Spacing.y;
99 | float tx = (Spacing.y*UV.x-Offset*UV.y)/d;
100 | float ty = Spacing.x*UV.y/d;
101 | tx = ((((tx + 0.5) % 1) + 1) %1)-0.5;
102 | ty = ((((ty + 0.5) % 1) + 1) %1)-0.5;
103 | float px = tx * Spacing.x + ty*Offset;
104 | float py = ty * Spacing.y;
105 | Out = px*px + py*py - Radius*Radius;
106 | Out = saturate(-Out/fwidth(Out));
107 | }
108 | ";
109 | }
110 | }
111 |
112 | [Title("Pattern", "Spiral")]
113 | internal class SpiralNode : CodeFunctionNode {
114 | public SpiralNode() {
115 | name = "Spiral";
116 | }
117 |
118 | protected override MethodInfo GetFunctionToConvert() {
119 | return GetType().GetMethod("Spiral", BindingFlags.Static | BindingFlags.NonPublic);
120 | }
121 |
122 | static string Spiral([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None, 0.1f, 0.1f, 0, 0)] Vector2 Widths, [Slot(5, Binding.None)] out Vector1 Out) {
123 | return @"
124 | {
125 | float Width = Widths.x + Widths.y;
126 | float r = length(UV);
127 | float theta = atan2(UV.y, UV.x);
128 | float k = (r/(Width/6.28318530718) - theta)/6.28318530718;
129 | Out = abs(r - ((Width/6.28318530718)*(theta + 6.28318530718*round(k)))) - 0.5*Widths.x;
130 | Out = saturate(-Out/fwidth(Out));
131 | }
132 | ";
133 | }
134 | }
135 |
136 |
137 | [Title("Pattern", "Whirl")]
138 | internal class WhirlNode : CodeFunctionNode {
139 | public WhirlNode() {
140 | name = "Whirl";
141 | }
142 |
143 | protected override MethodInfo GetFunctionToConvert() {
144 | return GetType().GetMethod("Whirl", BindingFlags.Static | BindingFlags.NonPublic);
145 | }
146 |
147 | static string Whirl([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None, 30, 30, 0, 0)] Vector2 Widths, [Slot(2, Binding.None, 1, 0, 0, 0)] Vector1 Whirl, [Slot(3, Binding.None)] out Vector1 Out) {
148 | return @"
149 | {
150 | float Width = Widths.x + Widths.y;
151 | float r = length(UV);
152 | float theta = 57.2958 * atan2(UV.y, UV.x) - Whirl*r;
153 | Out = ((((theta + 0.5*Width) % Width) + Width )%Width)- 0.5*Width;
154 | Out = abs(Out) - 0.5*Widths.x;
155 | Out = saturate(-Out/fwidth(Out));
156 | }
157 | ";
158 | }
159 | }
160 | #endif
--------------------------------------------------------------------------------
/Nodes/Pattern/PatternNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d564fb90010c33f4bb753497ff55d6f5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Pattern/README.md:
--------------------------------------------------------------------------------
1 | # Pattern
2 |
3 | This is a set of custom nodes for use with Shader Graph to make geometric patterns procedurally. All patterns are anti aliased.
4 |
5 | ## Zig Zags
6 |
7 | Stripes made up of zig zags.
8 |
9 | 
10 | - Widths controls the widths of the black and white stripes respectively.
11 | - Wavelength controls the wavelength of the wave.
12 | - Amplitude controls peak to peak amplitude of the wave.
13 |
14 | ## Sine Waves
15 |
16 | Stripes made up of sine waves.
17 |
18 | 
19 | - Widths controls the widths of the black and white stripes respectively.
20 | - Wavelength controls the wavelength of the wave.
21 | - Amplitude controls peak to peak amplitude of the wave.
22 | ## Round Waves
23 |
24 | Stripes made up of arc segments.
25 |
26 | 
27 | - Widths controls the widths of the black and white stripes respectively.
28 | - Wavelength controls the wavelength of the wave.
29 | - Amplitude controls peak to peak amplitude of the wave.
30 |
31 | ## Spiral
32 |
33 | An archimedean spiral.
34 |
35 | 
36 | - Widths controls the widths of the black and white stripes respectively.
37 |
38 | ## Whirl
39 |
40 | A swirling shape around a point.
41 |
42 | 
43 | - Widths controls the widths of the black and white stripes in angles respectively.
44 | - Whirl controls the amount of swirl.
45 |
46 | ## Dots
47 |
48 | 
49 | - Spacing controls the distances between the dots.
50 | - Offset controls the displacement of each row relative to the one below.
51 | - Radius controls the radius of the dots.
52 |
--------------------------------------------------------------------------------
/Nodes/Pixel Perfect.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: af02cb9560d4e4a85a3767302e7f08c8
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Pixel Perfect/PixelPerfectNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using UnityEditor.ShaderGraph;
3 | using System.Reflection;
4 | using UnityEngine;
5 |
6 | [Title("Pixel Perfect", "Pixel Point")]
7 | internal class PixelPointNode : CodeFunctionNode {
8 | public PixelPointNode() {
9 | name = "Pixel Point";
10 | }
11 |
12 | protected override MethodInfo GetFunctionToConvert() {
13 | return GetType().GetMethod("PixelPoint", BindingFlags.Static | BindingFlags.NonPublic);
14 | }
15 |
16 | static string PixelPoint([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None)] out Vector1 Out) {
17 | return @"
18 | {
19 | float2 f = UV - Position;
20 | float2 ddxUV = ddx(UV);
21 | float2 ddyUV = ddy(UV);
22 |
23 | float InvD = 1/(ddxUV.x*ddyUV.y-ddxUV.y*ddyUV.x);
24 |
25 | float tx = (ddyUV.y*f.x-ddyUV.x*f.y)*InvD;
26 | float ty = (-ddxUV.y*f.x+ddxUV.x*f.y)*InvD;
27 |
28 | Out = (tx > -0.5 && tx <= 0.5) && (ty > -0.5 && ty <= 0.5) ? 1 : 0;
29 | }
30 | ";
31 | }
32 | }
33 |
34 | [Title("Pixel Perfect", "Pixel Point Grid")]
35 | internal class PixelPointGridNode : CodeFunctionNode {
36 | public PixelPointGridNode() {
37 | name = "Pixel Point Grid";
38 | }
39 |
40 | protected override MethodInfo GetFunctionToConvert() {
41 | return GetType().GetMethod("PixelPointGrid", BindingFlags.Static | BindingFlags.NonPublic);
42 | }
43 |
44 | static string PixelPointGrid([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None, 0.1f, 0, 0, 0)] Vector1 Width, [Slot(3, Binding.None)] out Vector1 Out) {
45 | return @"
46 | {
47 | float2 f = UV - Position;
48 | float2 rounded = {round(f.x/Width), round(f.y/Width)};
49 | f = f - Width * rounded;
50 | float2 ddxUV = ddx(UV);
51 | float2 ddyUV = ddy(UV);
52 |
53 | float InvD = 1/(ddxUV.x*ddyUV.y-ddxUV.y*ddyUV.x);
54 |
55 | float tx = (ddyUV.y*f.x-ddyUV.x*f.y)*InvD;
56 | float ty = (-ddxUV.y*f.x+ddxUV.x*f.y)*InvD;
57 |
58 | Out = (tx > -0.5 && tx <= 0.5) && (ty > -0.5 && ty <= 0.5) ? 1 : 0;
59 | }
60 | ";
61 | }
62 | }
63 |
64 | [Title("Pixel Perfect", "Pixel Ray")]
65 | internal class PixelRayNode : CodeFunctionNode {
66 | public PixelRayNode() {
67 | name = "Pixel Ray";
68 | }
69 |
70 | protected override MethodInfo GetFunctionToConvert() {
71 | return GetType().GetMethod("PixelRay", BindingFlags.Static | BindingFlags.NonPublic);
72 | }
73 |
74 | static string PixelRay([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None, 1, 0, 0, 0)] Vector2 Direction, [Slot(3, Binding.None)] out Vector1 Out) {
75 | return @"
76 | {
77 | float2 d = Direction;
78 | float2 f = UV - Position;
79 | float2 ddxUV = ddx(UV);
80 | float2 ddyUV = ddy(UV);
81 |
82 | float tq1 = (d.x * f.y - d.y * f.x) / (ddxUV.y * d.x - ddxUV.x * d.y);
83 | float tq2 = (d.x * f.y - d.y * f.x) / (ddyUV.y * d.x - ddyUV.x * d.y);
84 |
85 | Out = (tq1 > -0.5 && tq1 <= 0.5) || (tq2 > -0.5 && tq2 <= 0.5) ? 1 : 0;
86 | }
87 | ";
88 | }
89 | }
90 |
91 | [Title("Pixel Perfect", "Pixel Rays")]
92 | internal class PixelRaysNode : CodeFunctionNode {
93 | public PixelRaysNode() {
94 | name = "Pixel Rays";
95 | }
96 |
97 | protected override MethodInfo GetFunctionToConvert() {
98 | return GetType().GetMethod("PixelRays", BindingFlags.Static | BindingFlags.NonPublic);
99 | }
100 |
101 | static string PixelRays([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None, 1, 0, 0, 0)] Vector2 Direction, [Slot(3, Binding.None, 0.1f, 0, 0, 0)] Vector1 Width, [Slot(4, Binding.None)] out Vector1 Out) {
102 | return @"
103 | {
104 | float2 d = Direction;
105 | float2 n = {-Direction.y, Direction.x};
106 | n = normalize(n);
107 | float2 f = UV - Position;
108 | f = f - Width * round(dot(n, f)/Width) * n;
109 | float2 ddxUV = ddx(UV);
110 | float2 ddyUV = ddy(UV);
111 |
112 | float tq1 = (d.x * f.y - d.y * f.x) / (ddxUV.y * d.x - ddxUV.x * d.y);
113 | float tq2 = (d.x * f.y - d.y * f.x) / (ddyUV.y * d.x - ddyUV.x * d.y);
114 |
115 | Out = (tq1 > -0.5 && tq1 <= 0.5) || (tq2 > -0.5 && tq2 <= 0.5) ? 1 : 0;
116 | }
117 | ";
118 | }
119 | }
120 |
121 | [Title("Pixel Perfect", "Pixel Line")]
122 | internal class PixelLineNode : CodeFunctionNode {
123 | public PixelLineNode() {
124 | name = "Pixel Line";
125 | }
126 |
127 | protected override MethodInfo GetFunctionToConvert() {
128 | return GetType().GetMethod("PixelLine", BindingFlags.Static | BindingFlags.NonPublic);
129 | }
130 |
131 | static string PixelLine([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position1, [Slot(2, Binding.None)] Vector2 Position2, [Slot(3, Binding.None)] out Vector1 Out) {
132 | return @"
133 |
134 | {
135 | float2 d = Position2 - Position1;
136 | float2 f = UV - Position1;
137 | float2 ddxUV = ddx(UV);
138 | float2 ddyUV = ddy(UV);
139 |
140 | float InvD1 = 1/(ddxUV.y * d.x - ddxUV.x * d.y);
141 | float InvD2 = 1/(ddyUV.y * d.x - ddyUV.x * d.y);
142 |
143 | float tp1 = -(ddxUV.x * f.y - ddxUV.y * f.x) * InvD1;
144 | float tq1 = (d.x * f.y - d.y * f.x) * InvD1;
145 |
146 | float tp2 = -(ddyUV.x * f.y - ddyUV.y * f.x) * InvD2;
147 | float tq2 = (d.x * f.y - d.y * f.x) * InvD2;
148 |
149 | Out = (tp1 >= 0 && tp1 <= 1 && tq1 > -0.5 && tq1 <= 0.5) || (tp2 >= 0 && tp2 <= 1 && tq2 > -0.5 && tq2 <= 0.5) ? 1 : 0;
150 | }
151 | ";
152 | }
153 | }
154 |
155 | [Title("Pixel Perfect", "Pixel Lines")]
156 | internal class PixelLinesNode : CodeFunctionNode {
157 | public PixelLinesNode() {
158 | name = "Pixel Lines";
159 | }
160 |
161 | protected override MethodInfo GetFunctionToConvert() {
162 | return GetType().GetMethod("PixelLines", BindingFlags.Static | BindingFlags.NonPublic);
163 | }
164 |
165 | static string PixelLines([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position1, [Slot(2, Binding.None)] Vector2 Position2, [Slot(3, Binding.None, 0.1f, 0, 0, 0)] Vector1 Width, [Slot(4, Binding.None)] out Vector1 Out) {
166 | return @"
167 |
168 | {
169 | float2 d = Position2 - Position1;
170 | float2 n = {-d.y, d.x};
171 | n = normalize(n);
172 | float2 f = UV - Position1;
173 | f = f - Width * round(dot(n, f)/Width) * n;
174 | float2 ddxUV = ddx(UV);
175 | float2 ddyUV = ddy(UV);
176 |
177 | float InvD1 = 1/(ddxUV.y * d.x - ddxUV.x * d.y);
178 | float InvD2 = 1/(ddyUV.y * d.x - ddyUV.x * d.y);
179 |
180 | float tp1 = -(ddxUV.x * f.y - ddxUV.y * f.x) * InvD1;
181 | float tq1 = (d.x * f.y - d.y * f.x) * InvD1;
182 |
183 | float tp2 = -(ddyUV.x * f.y - ddyUV.y * f.x) * InvD2;
184 | float tq2 = (d.x * f.y - d.y * f.x) * InvD2;
185 |
186 | Out = (tp1 >= 0 && tp1 <= 1 && tq1 > -0.5 && tq1 <= 0.5) || (tp2 >= 0 && tp2 <= 1 && tq2 > -0.5 && tq2 <= 0.5) ? 1 : 0;
187 | }
188 | ";
189 | }
190 | }
191 |
192 | [Title("Pixel Perfect", "Pixel Circle")]
193 | internal class PixelCircleNode : CodeFunctionNode {
194 | public PixelCircleNode() {
195 | name = "Pixel Circle";
196 | }
197 |
198 | protected override MethodInfo GetFunctionToConvert() {
199 | return GetType().GetMethod("PixelCircle", BindingFlags.Static | BindingFlags.NonPublic);
200 | }
201 |
202 | static string PixelCircle([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Center, [Slot(2, Binding.None, 0.5f, 0, 0, 0)] Vector1 Radius, [Slot(3, Binding.None)] out Vector1 Out) {
203 | return @"
204 |
205 | {
206 | float2 f = UV - Center;
207 | float2 ddxUV = ddx(UV);
208 | float2 ddyUV = ddy(UV);
209 |
210 | float r2 = Radius * Radius;
211 |
212 | float2 fx1, fx2, fy1, fy2;
213 | fx1 = f - 0.5*ddxUV;
214 | fx2 = f + 0.5*ddxUV;
215 | fy1 = f - 0.5*ddyUV;
216 | fy2 = f + 0.5*ddyUV;
217 |
218 | Out = ((dot(fx1, fx1) - r2) * (dot(fx2, fx2) - r2) <= 0 || (dot(fy1, fy1) - r2) * (dot(fy2, fy2) - r2) <= 0) ? 1 : 0;
219 | }
220 | ";
221 | }
222 | }
223 |
224 | [Title("Pixel Perfect", "Pixel Polygon")]
225 | internal class PixelPolygonNode : CodeFunctionNode {
226 | public PixelPolygonNode() {
227 | name = "Pixel Polygon";
228 | }
229 |
230 | protected override MethodInfo GetFunctionToConvert() {
231 | return GetType().GetMethod("PixelPolygon", BindingFlags.Static | BindingFlags.NonPublic);
232 | }
233 |
234 | static string PixelPolygon([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Center, [Slot(2, Binding.None, 0.5f, 0, 0, 0)] Vector1 Radius, [Slot(3, Binding.None, 6, 0, 0, 0)] Vector1 Sides, [Slot(4, Binding.None)] Vector1 Angle, [Slot(5, Binding.None)] out Vector1 Out) {
235 | return @"
236 |
237 | {
238 | float2 f = UV - Center;
239 | float angle = 6.2831853071/Sides;
240 | Angle = 0.0174533*Angle;
241 |
242 | // Apply rotation
243 | float sinAngle, cosAngle;
244 | sincos(Angle, sinAngle, cosAngle);
245 | f = float2(f.y * sinAngle + f.x * cosAngle, f.y * cosAngle - f.x * sinAngle);
246 |
247 | float theta = atan2(f.y, f.x);
248 |
249 | float SinSide, CosSide;
250 | sincos(round(theta / angle) * angle, SinSide, CosSide);
251 |
252 | float2 d = float2(SinSide, -CosSide);
253 | float2 n = float2(CosSide, SinSide);
254 | f = f - n*Radius;
255 | float2 ddxUV = ddx(UV);
256 | float2 ddyUV = ddy(UV);
257 |
258 | float tq1 = (d.x * f.y - d.y * f.x) / (ddxUV.y * d.x - ddxUV.x * d.y);
259 | float tq2 = (d.x * f.y - d.y * f.x) / (ddyUV.y * d.x - ddyUV.x * d.y);
260 |
261 | Out = (tq1 > -0.5 && tq1 <= 0.5) || (tq2 > -0.5 && tq2 <= 0.5) ? 1 : 0;
262 | }
263 | ";
264 | }
265 | }
266 |
267 | #endif
268 |
--------------------------------------------------------------------------------
/Nodes/Pixel Perfect/PixelPerfectNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 730a4af4c9ca04078b2c0210dcd2a448
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Pixel Perfect/README.md:
--------------------------------------------------------------------------------
1 | # Pixel Perfect
2 |
3 | This is a set of custom nodes for use with Shader Graph that allow you to do pixel perfect drawing of primitives. The lines and points will be exactly one pixel wide regardless of the distance and perspective of the object being rendered to.
4 |
5 | ## Pixel Point / Pixel Point Grid
6 |
7 | An individual point or square grid of points. Posiiton controls the position of one of the points, width the distance between adjacent points.
8 |
9 | ## Pixel Ray / Pixel Rays / Pixel Line / Pixel Lines
10 |
11 | 
12 |
13 | A pixel-wide line determined by two endpoints. The pixel ray extends to infinity rather than terminating at the endpoints. Width controls the distance between the multiple lines or rays for these nodes.
14 |
15 | ## Pixel Circle
16 |
17 | 
18 |
19 | A pixel-wide circle. Center controls the center of the circle while Radius controls the radius.
20 |
21 | ## Pixel Polygon
22 |
23 | 
24 |
25 | A pixel-wide polygon. Center controls the center of the polygon while Radius controls the radius. Sides is the number of sides, this needn't be an integer. Angle is the orientation of the whole shape in degrees.
26 |
27 | To use simply add the .cs file to your project then inside Shader Graph click Create Node > Pixel Perfect and use one of the nodes.
28 |
--------------------------------------------------------------------------------
/Nodes/Quaternion.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9b4b2dfc3b3544ab697e0c0acebf0111
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Quaternion/QuaternionNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using UnityEditor.ShaderGraph;
3 | using System.Reflection;
4 | using UnityEngine;
5 |
6 | [Title("Math", "Quaternion", "Quaternion Inverse")]
7 | internal class QuaternionInverseNode : CodeFunctionNode {
8 | public QuaternionInverseNode() {
9 | name = "Quaternion Inverse";
10 | }
11 |
12 | protected override MethodInfo GetFunctionToConvert() {
13 | return GetType().GetMethod("QuaternionInverse", BindingFlags.Static | BindingFlags.NonPublic);
14 | }
15 |
16 | static string QuaternionInverse([Slot(0, Binding.None, 0, 0, 0, 1)] Vector4 Q, [Slot(1, Binding.None)] out Vector4 Out) {
17 | Out = Vector4.zero;
18 | return @"
19 | {
20 | Out.xyz = -Q.xyz;
21 | Out.w = Q.w;
22 | }
23 | ";
24 | }
25 | }
26 |
27 | [Title("Math", "Quaternion", "Quaternion From Euler")]
28 | internal class QuaternionFromEulerNode : CodeFunctionNode {
29 | public QuaternionFromEulerNode() {
30 | name = "Quaternion From Euler";
31 | }
32 |
33 | protected override MethodInfo GetFunctionToConvert() {
34 | return GetType().GetMethod("QuaternionFromEuler", BindingFlags.Static | BindingFlags.NonPublic);
35 | }
36 |
37 | static string QuaternionFromEuler([Slot(0, Binding.None)] Vector3 V, [Slot(1, Binding.None)] out Vector4 Out) {
38 | Out = Vector4.zero;
39 | return @"
40 | {
41 | float3 Sin, Cos;
42 | sincos(0.5 * 0.0174533 * V, Sin, Cos);
43 | Out.x = Cos.y * Sin.x * Cos.z + Sin.y * Cos.x * Sin.z;
44 | Out.y = Sin.y * Cos.x * Cos.z - Cos.y * Sin.x * Sin.z;
45 | Out.z = Cos.y * Cos.x * Sin.z - Sin.y * Sin.x * Cos.z;
46 | Out.w = Cos.y * Cos.x * Cos.z + Sin.y * Sin.x * Sin.z;
47 | }
48 | ";
49 | }
50 | }
51 |
52 | [Title("Math", "Quaternion", "Quaternion From Angle Axis")]
53 | internal class QuaternionFromAngleAxisNode : CodeFunctionNode {
54 | public QuaternionFromAngleAxisNode() {
55 | name = "Quaternion From Angle Axis";
56 | }
57 |
58 | protected override MethodInfo GetFunctionToConvert() {
59 | return GetType().GetMethod("QuaternionFromAngleAxis", BindingFlags.Static | BindingFlags.NonPublic);
60 | }
61 |
62 | static string QuaternionFromAngleAxis([Slot(0, Binding.None)] Vector1 Angle, [Slot(1, Binding.None, 1, 0, 0, 0)] Vector3 Axis, [Slot(2, Binding.None)] out Vector4 Out) {
63 | Out = Vector4.zero;
64 | return @"
65 | {
66 | float Sin, Cos;
67 | sincos(0.5 * 0.0174533 * Angle, Sin, Cos);
68 | Out.xyz = Sin * Axis;
69 | Out.w = Cos;
70 | }
71 | ";
72 | }
73 | }
74 |
75 | [Title("Math", "Quaternion", "Quaternion To Angle Axis")]
76 | internal class QuaternionToAngleAxisNode : CodeFunctionNode {
77 | public QuaternionToAngleAxisNode() {
78 | name = "Quaternion To Angle Axis";
79 | }
80 |
81 | protected override MethodInfo GetFunctionToConvert() {
82 | return GetType().GetMethod("QuaternionToAngleAxis", BindingFlags.Static | BindingFlags.NonPublic);
83 | }
84 |
85 | static string QuaternionToAngleAxis([Slot(0, Binding.None, 0, 0, 0, 1)] Vector4 Q, [Slot(1, Binding.None)] out Vector1 Angle, [Slot(2, Binding.None)] out Vector3 Axis) {
86 | Axis = Vector3.zero;
87 | return @"
88 | {
89 | float Length = sqrt(dot(Q.xyz, Q.xyz));
90 | Axis = 1 / Length * Q.xyz;
91 | Angle = 57.2958 * 2 * atan2(Length, Q.w);
92 | }
93 | ";
94 | }
95 | }
96 |
97 | [Title("Math", "Quaternion", "Quaternion From To Rotation")]
98 | internal class QuaternionFromToRotationNode : CodeFunctionNode {
99 | public QuaternionFromToRotationNode() {
100 | name = "Quaternion From To Rotation Node";
101 | }
102 |
103 | protected override MethodInfo GetFunctionToConvert() {
104 | return GetType().GetMethod("QuaternionFromToRotation", BindingFlags.Static | BindingFlags.NonPublic);
105 | }
106 |
107 | static string QuaternionFromToRotation([Slot(0, Binding.None)] Vector3 From, [Slot(1, Binding.None)] Vector3 To, [Slot(2, Binding.None)] out Vector4 Out) {
108 | Out = Vector4.zero;
109 | return @"
110 | {
111 | Out.xyz = cross(From, To);
112 | Out.w = sqrt(dot(From,From)*dot(To,To)) + dot(From, To);
113 | }
114 | ";
115 | }
116 | }
117 |
118 | [Title("Math", "Quaternion", "Quaternion Multiply")]
119 | internal class QuaternionMultiplyNode : CodeFunctionNode {
120 | public QuaternionMultiplyNode() {
121 | name = "Quaternion Multiply";
122 | }
123 |
124 | protected override MethodInfo GetFunctionToConvert() {
125 | return GetType().GetMethod("QuaternionMultiply", BindingFlags.Static | BindingFlags.NonPublic);
126 | }
127 |
128 | static string QuaternionMultiply([Slot(0, Binding.None, 0, 0, 0, 1)] Vector4 P, [Slot(1, Binding.None, 0, 0, 0, 1)] Vector4 Q, [Slot(2, Binding.None)] out Vector4 Out) {
129 | Out = Vector4.zero;
130 | return @"
131 | {
132 | Out.xyz = P.w * Q.xyz + Q.w * P.xyz + cross(P.xyz, Q.xyz);
133 | Out.w = P.w * Q.w - dot(P.xyz, Q.xyz);
134 | }
135 | ";
136 | }
137 | }
138 |
139 | [Title("Math", "Quaternion", "Quaternion Rotate Vector")]
140 | internal class QuaternionRotateVectorNode : CodeFunctionNode {
141 | public QuaternionRotateVectorNode() {
142 | name = "Quaternion Rotate Vector";
143 | }
144 |
145 | protected override MethodInfo GetFunctionToConvert() {
146 | return GetType().GetMethod("QuaternionRotateVector", BindingFlags.Static | BindingFlags.NonPublic);
147 | }
148 |
149 | static string QuaternionRotateVector([Slot(0, Binding.None)] Vector3 V, [Slot(1, Binding.None, 0, 0, 0, 1)] Vector4 Q, [Slot(2, Binding.None)] out Vector3 Out) {
150 | Out = Vector3.zero;
151 | return @"
152 | {
153 | float3 Q1 = Q.w * V - Q.xyz - cross(Q.xyz, V);
154 | Out = (Q.w + dot(Q.xyz, V)) * Q.xyz + Q.w * Q1 + cross(Q1, Q.xyz);
155 | }
156 | ";
157 | }
158 | }
159 |
160 | [Title("Math", "Quaternion", "Quaternion Slerp")]
161 | internal class QuaternionSlerpNode : CodeFunctionNode {
162 | public QuaternionSlerpNode() {
163 | name = "Quaternion Slerp";
164 | }
165 |
166 | protected override MethodInfo GetFunctionToConvert() {
167 | return GetType().GetMethod("QuaternionSlerp", BindingFlags.Static | BindingFlags.NonPublic);
168 | }
169 |
170 | static string QuaternionSlerp([Slot(0, Binding.None, 0, 0, 0, 1)] Vector4 P, [Slot(1, Binding.None, 0, 0, 0, 1)] Vector4 Q, [Slot(2, Binding.None)] Vector1 T, [Slot(3, Binding.None)] out Vector4 Out) {
171 | Out = new Vector4(0, 0, 0, 1);
172 | return @"
173 | {
174 | float CosHalfAngle = P.w * Q.w + dot(P.xyz, Q.xyz);
175 | float HalfAngle = acos(CosHalfAngle);
176 | float CosecHalfAngle = 1 / sin(HalfAngle);
177 | Out = normalize((sin(HalfAngle * (1 - T)) * CosecHalfAngle) * (CosHalfAngle > 0 ? P : -P) + (sin(HalfAngle * T) * CosecHalfAngle) * Q);
178 | }
179 | ";
180 | }
181 | }
182 | #endif
--------------------------------------------------------------------------------
/Nodes/Quaternion/QuaternionNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9fa6397e8d7344d08b4efff30afd0d58
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Quaternion/README.md:
--------------------------------------------------------------------------------
1 | # Quaternion
2 |
3 | This is a set of custom nodes for use with Shader Graph that allow you to do quaternion calculations inside the graph.
4 |
5 | Quaternions are inputted and outputted as Vector4 values. Quaternions here describe rotations so at times may be assumed to have a magnitude of 1.
6 |
7 | | Node | In | Out |
8 | |---|---|---|
9 | | Quaternion Inverse | Q | Out: Q ^ -1 , the inverse rotation |
10 | | Quaternion From Euler | V | Out: rotation that rotates V.z degrees around the z axis, V.x degrees around the x axis, and V.y degrees around the y axis |
11 | | Quaternion From Angle Axis | Angle
Axis | Out: rotation which rotates Angle degrees around Axis |
12 | | Quaternion To Angle Axis | Q | Angle: angle of rotation in degrees
Axis = axis of rotation |
13 | | Quaternion From To Rotation | From
To | Out: rotation that rotates from From to To |
14 | | Quaternion Multiply | P
Q | Out: P ⋅ Q |
15 | | Quaternion Rotate Vector | V
Q | Out: The vector V rotated by the quaternion Q |
16 | | Quaternion Slerp | P
Q
T | Out: rotation give by spherical linear interpolation of P to Q by factor T |
17 |
18 | To use simply add the .cs file to your project then inside Shader Graph click Create Node > Math > Quaternion and use one of the nodes.
19 |
--------------------------------------------------------------------------------
/Nodes/Random.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0d38c19ee973629438e67dafbe4a484b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Random/RandomNodes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Reflection;
5 | using UnityEditor.Graphing;
6 | using UnityEditor.ShaderGraph;
7 | using UnityEditor.ShaderGraph.Drawing.Controls;
8 | using UnityEngine;
9 |
10 |
11 | [Title("Math", "Random", "Random Integer Range")]
12 | internal class RandomIntegerNode : CodeFunctionNode {
13 | public RandomIntegerNode() {
14 | name = "Random Integer Range";
15 | }
16 |
17 | protected override MethodInfo GetFunctionToConvert() {
18 | return GetType().GetMethod("RandomIntegerRange", BindingFlags.Static | BindingFlags.NonPublic);
19 | }
20 |
21 | static string RandomIntegerRange([Slot(0, Binding.None)] Vector2 Seed, [Slot(1, Binding.None)] Vector1 Min, [Slot(2, Binding.None, 10, 0, 0, 0)] Vector1 Max, [Slot(3, Binding.None)] out Vector1 Out) {
22 | return @"
23 | {
24 | float r = frac(sin(dot(Seed, float2(127.1,311.7))) * 43758.5453);
25 | Min = ceiling(Min);
26 | Max = ceiling(Max);
27 | return Min + (Max-Min)*floor(r * (Max-Min));
28 | }
29 | ";
30 | }
31 | }
32 |
33 | [Serializable]
34 | public enum RandomMode {
35 | In,
36 | On
37 | }
38 |
39 | [Title("Math", "Random", "Random Circle")]
40 | internal class RandomCircleNode : CodeFunctionNode {
41 | [SerializeField] private RandomMode m_RandomMode = RandomMode.In;
42 |
43 | public RandomCircleNode() {
44 | name = "Random Circle";
45 | }
46 |
47 | private string GetCurrentModeName() {
48 | return Enum.GetName(typeof(RandomMode), m_RandomMode);
49 | }
50 |
51 | [EnumControl("Mode")]
52 | public RandomMode randomMode {
53 | get { return m_RandomMode; }
54 | set {
55 | if (m_RandomMode == value)
56 | return;
57 | m_RandomMode = value;
58 | Dirty(ModificationScope.Graph);
59 | }
60 | }
61 |
62 | protected override MethodInfo GetFunctionToConvert() {
63 | return GetType().GetMethod(string.Format("RandomCircle_{0}", GetCurrentModeName()), BindingFlags.Static | BindingFlags.NonPublic);
64 | }
65 |
66 | static string RandomCircle_In([Slot(0, Binding.None)] Vector2 Seed, [Slot(1, Binding.None)] out Vector2 Out) {
67 | Out = Vector2.zero;
68 | return @"
69 | {
70 | float2 r = frac(sin(float2(dot(Seed, float2(127.1,311.7)), dot(Seed, float2(269.5,183.3)))) * 43758.5453);
71 | float Sin, Cos;
72 | sincos(r.x*6.28318530718, Sin, Cos);
73 | Out = sqrt(r.y) * float2(Cos, Sin);
74 | }
75 | ";
76 | }
77 |
78 | static string RandomCircle_On([Slot(0, Binding.None)] Vector2 Seed, [Slot(1, Binding.None)] out Vector2 Out) {
79 | Out = Vector2.zero;
80 | return @"
81 | {
82 | float r = frac(sin(dot(Seed, float2(127.1,311.7))) * 43758.5453);
83 | float Sin, Cos;
84 | sincos(r*6.28318530718, Sin, Cos);
85 | Out = float2(Cos, Sin);
86 | }
87 | ";
88 | }
89 | }
90 |
91 | [Title("Math", "Random", "Random Sphere")]
92 | internal class RandomSphereNode : CodeFunctionNode {
93 | [SerializeField] private RandomMode m_RandomMode = RandomMode.In;
94 |
95 | public RandomSphereNode() {
96 | name = "Random Sphere";
97 | }
98 |
99 | private string GetCurrentModeName() {
100 | return Enum.GetName(typeof(RandomMode), m_RandomMode);
101 | }
102 |
103 | [EnumControl("Mode")]
104 | public RandomMode randomMode {
105 | get { return m_RandomMode; }
106 | set {
107 | if (m_RandomMode == value)
108 | return;
109 | m_RandomMode = value;
110 | Dirty(ModificationScope.Graph);
111 | }
112 | }
113 |
114 | protected override MethodInfo GetFunctionToConvert() {
115 | return GetType().GetMethod(string.Format("RandomSphere_{0}", GetCurrentModeName()), BindingFlags.Static | BindingFlags.NonPublic);
116 | }
117 |
118 | static string RandomSphere_In([Slot(0, Binding.None)] Vector2 Seed, [Slot(1, Binding.None)] out Vector3 Out) {
119 | Out = Vector3.zero;
120 | return @"
121 | {
122 | float3 r = frac(sin(float3(dot(Seed, float2(127.1,311.7)), dot(Seed, float2(269.5,183.3)), dot(Seed, float2(419.2,371.9)))) * 43758.5453);
123 | float SinTheta, CosTheta;
124 | sincos(r.x*6.28318530718, SinTheta, CosTheta);
125 | float CosPhi = 2*r.y - 1;
126 | float SinPhi = sqrt(1-CosPhi*CosPhi);
127 | Out = pow(r.z, 1/3) * float3(CosTheta*SinPhi, SinTheta*SinPhi, CosPhi);
128 | }
129 | ";
130 | }
131 |
132 | static string RandomSphere_On([Slot(0, Binding.None)] Vector2 Seed, [Slot(1, Binding.None)] out Vector3 Out) {
133 | Out = Vector3.zero;
134 | return @"
135 | {
136 | float2 r = frac(sin(float2(dot(Seed, float2(127.1,311.7)), dot(Seed, float2(269.5,183.3)))) * 43758.5453);
137 | float SinTheta, CosTheta;
138 | sincos(r.x*6.28318530718, SinTheta, CosTheta);
139 | float CosPhi = 2*r.y - 1;
140 | float SinPhi = sqrt(1-CosPhi*CosPhi);
141 | Out = float3(CosTheta*SinPhi, SinTheta*SinPhi, CosPhi);
142 | }
143 | ";
144 | }
145 | }
146 |
147 | [Title("Math", "Random", "Random Rotation")]
148 | internal class RandomRotationNode : CodeFunctionNode {
149 | public RandomRotationNode() {
150 | name = "Random Rotation";
151 | }
152 |
153 | protected override MethodInfo GetFunctionToConvert() {
154 | return GetType().GetMethod("RandomRotation", BindingFlags.Static | BindingFlags.NonPublic);
155 | }
156 |
157 | static string RandomRotation([Slot(0, Binding.None)] Vector2 Seed, [Slot(1, Binding.None)] out Vector4 Out) {
158 | Out = Vector4.zero;
159 | return @"
160 | {
161 | float3 r = frac(sin(float3(dot(Seed, float2(127.1,311.7)), dot(Seed, float2(269.5,183.3)), dot(Seed, float2(419.2,371.9)))) * 43758.5453);
162 | float SinY, CosY, SinZ, CosZ;
163 | sincos(r.y*6.28318530718, SinY, CosY);
164 | sincos(r.z*6.28318530718, SinZ, CosZ);
165 | Out = sqrt(r.x) * float4(0, 0, SinZ, CosZ) + sqrt(1-r.x) * float4(SinY, CosY, 0, 0);
166 | }
167 | ";
168 | }
169 | }
170 |
171 | [Title("Math", "Random", "Random Color")]
172 | internal class RandomColorNode : CodeFunctionNode {
173 | public RandomColorNode() {
174 | name = "Random Color";
175 | }
176 |
177 | protected override MethodInfo GetFunctionToConvert() {
178 | return GetType().GetMethod("RandomColor", BindingFlags.Static | BindingFlags.NonPublic);
179 | }
180 |
181 | static string RandomColor([Slot(0, Binding.None)] Vector2 Seed, [Slot(1, Binding.None)] Vector3 MinHSV, [Slot(2, Binding.None, 1, 1, 1, 0)] Vector3 MaxHSV, [Slot(3, Binding.None)] out Vector3 RGB, [Slot(4, Binding.None)] out Vector3 HSV) {
182 | HSV = Vector3.zero;
183 | RGB = Vector3.zero;
184 | return @"
185 | {
186 | float3 r = frac(sin(float3(dot(Seed, float2(127.1,311.7)), dot(Seed, float2(269.5,183.3)), dot(Seed, float2(419.2,371.9)))) * 43758.5453);
187 | HSV = MaxHSV - MinHSV;
188 | HSV = MinHSV + (HSV < 0 ? frac(HSV) : HSV) * r;
189 | HSV = float3(frac(HSV.x), clamp(HSV.y, 0, 1), clamp(HSV.z, 0, 1));
190 | RGB = saturate(float3(abs(HSV.x * 6 - 3) - 1,2 - abs(HSV.x * 6 - 2),2 - abs(HSV.x * 6 - 4)));
191 | RGB = ((RGB - 1) * HSV.y + 1) * HSV.z;
192 | }
193 | ";
194 | }
195 | }
--------------------------------------------------------------------------------
/Nodes/Random/RandomNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4568d86b77d75884ea19603de49d93b5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/SDF.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2567401bb47fe5241b9a7917c362fcfb
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/SDF/README.md:
--------------------------------------------------------------------------------
1 | # SDF
2 |
3 | Signed distance functions give a single float value for each pixel that represents the distance to some boundary. They can be used for rendering crisp text at any resolution or used for produral art.
4 |
5 | https://en.wikipedia.org/wiki/Signed_distance_function
6 |
7 | ## Primitives
8 |
9 | These nodes create signed distance functions for primitive shapes. These can be translated and rotated, but any other transformation (scale, shear) may result in unexpected behaviour.
10 |
11 | These SDFs can be sampled with the SDF Sample nodes and combined with the SDF Boolean nodes.
12 |
13 | | Line | Circle |
14 | |---|---|
15 | |  |  |
16 | | A vertical line passing through (Position, 0)
with width Width| A circle centered at Position with radius Radius |
17 |
18 | | Rectangle | Polygon |
19 | |---|---|
20 | |  |  |
21 | | A Rectangle centered at Position with width Width and height Height. Increasing the Corner Radius creates a rounded rectangle | A regular polygon centered at Position
with radius Radius and number of sides Sides (not necessarily an integer). Increasing the Corner Radius creates a rounded polygon |
22 |
23 | ## Sampling
24 |
25 | These nodes can sample the SDFs to give clear shapes. They are anti-aliased at the edges.
26 |
27 | | SDF Sample | SDF Sample Strip |
28 | |---|---|
29 | |  |  |
30 | | Outputs values less than Offset as white and values greater as black | Outputs values between Offset.x and Offset.y as white and others as black |
31 |
32 | ## Boolean operators
33 |
34 | These nodes allow the combining of SDFs with each other and creation of new SDFs as a result. There are both hard and soft boolean operators. Here we use a primitive Square A and a primitive Circle B to show the possibilities.
35 |
36 | || A | B |
37 | |---|---|---|
38 | | SDF |  |  |
39 | |Sampled|  |  |
40 |
41 | | A Union B | A Intersect B | A Difference B |
42 | |---|---|---|
43 | |  |  |  |
44 | |  |  |  |
45 |
46 | | A Soft Union B | A Soft Intersect B | A Soft Difference B |
47 | |---|---|---|
48 | |  |  |  |
49 | |  |  |  |
50 |
51 | The Smoothing input controls the amount of smoothing between the two primitives.
52 |
--------------------------------------------------------------------------------
/Nodes/SDF/SDFNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using System;
3 | using UnityEditor.ShaderGraph;
4 | using System.Reflection;
5 | using UnityEditor.Graphing;
6 | using UnityEditor.ShaderGraph.Drawing.Controls;
7 | using UnityEngine;
8 |
9 | [Title("SDF", "SDF Line")]
10 | internal class SDFLineNode: CodeFunctionNode {
11 | public SDFLineNode() {
12 | name = "SDF Line";
13 | }
14 |
15 | protected override MethodInfo GetFunctionToConvert()
16 | {
17 | return GetType().GetMethod("SDFLine", BindingFlags.Static | BindingFlags.NonPublic);
18 | }
19 |
20 | private static string SDFLine([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector1 Position, [Slot(2, Binding.None, 0.1f, 0, 0, 0)] Vector1 Width, [Slot(3, Binding.None)] out Vector1 SDF) {
21 | return @"
22 | {
23 | SDF = abs(UV.x - Position) - 0.5*Width;
24 | }
25 | ";
26 | }
27 | }
28 |
29 | [Title("SDF", "SDF Circle")]
30 | internal class SDFCircleNode: CodeFunctionNode {
31 | public SDFCircleNode() {
32 | name = "SDF Circle";
33 | }
34 |
35 | protected override MethodInfo GetFunctionToConvert()
36 | {
37 | return GetType().GetMethod("SDFCircle", BindingFlags.Static | BindingFlags.NonPublic);
38 | }
39 |
40 | private static string SDFCircle([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None, 0.25f, 0, 0, 0)] Vector1 Radius, [Slot(3, Binding.None)] out Vector1 SDF) {
41 | return @"
42 | {
43 | SDF = length(UV - Position) - Radius;
44 | }
45 | ";
46 | }
47 | }
48 |
49 | [Title("SDF", "SDF Rectangle")]
50 | internal class SDFRectangleNode: CodeFunctionNode {
51 | public SDFRectangleNode() {
52 | name = "SDF Rectangle";
53 | }
54 |
55 | protected override MethodInfo GetFunctionToConvert()
56 | {
57 | return GetType().GetMethod("SDFRectangle", BindingFlags.Static | BindingFlags.NonPublic);
58 | }
59 |
60 | private static string SDFRectangle([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None, 0.5f, 0, 0, 0)] Vector1 Width, [Slot(3, Binding.None, 0.5f, 0, 0, 0)] Vector1 Height, [Slot(4, Binding.None)] Vector1 CornerRadius, [Slot(5, Binding.None)] out Vector1 SDF) {
61 | return @"
62 | {
63 | float2 d = abs(UV - Position) - 0.5*float2(Width, Height);
64 | SDF = min(max(d.x,d.y), 0) + length(max(d, 0));
65 | SDF = SDF - CornerRadius;
66 | }
67 | ";
68 | }
69 | }
70 |
71 | [Title("SDF", "SDF Polygon")]
72 | internal class SDFPolygonNode: CodeFunctionNode {
73 | public SDFPolygonNode() {
74 | name = "SDF Polygon";
75 | }
76 |
77 | protected override MethodInfo GetFunctionToConvert()
78 | {
79 | return GetType().GetMethod("SDFPolygon", BindingFlags.Static | BindingFlags.NonPublic);
80 | }
81 |
82 | private static string SDFPolygon([Slot(0, Binding.WorldSpacePosition)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None, 0.25f, 0, 0, 0)] Vector1 Radius, [Slot(3, Binding.None, 6, 0, 0, 0)] Vector1 Sides, [Slot(4, Binding.None)] Vector1 CornerRadius, [Slot(5, Binding.None)] out Vector1 SDF) {
83 | return @"
84 | {
85 | float2 f = UV - Position;
86 | float theta = atan2(f.y, f.x);
87 | float angle = 6.2831853071/Sides;
88 |
89 | float SinSide, CosSide;
90 | sincos(round(theta / angle) * angle, SinSide, CosSide);
91 |
92 | float2 d = float2(SinSide, -CosSide);
93 | float2 n = float2(CosSide, SinSide);
94 | float t = dot(d, f);
95 | float sideLength = Radius * tan(0.5*angle);
96 | SDF = abs(t) < Radius * tan(0.5*angle) ? dot(f, n) - Radius : length(f - (Radius * n + d * clamp(dot(d, f), -sideLength, sideLength)));
97 | SDF = SDF - CornerRadius;
98 | }
99 | ";
100 | }
101 | }
102 |
103 | [Title("SDF", "SDF Sample")]
104 | internal class SDFSampleNode: CodeFunctionNode {
105 | public SDFSampleNode() {
106 | name = "SDF Sample";
107 | }
108 |
109 | protected override MethodInfo GetFunctionToConvert()
110 | {
111 | return GetType().GetMethod("SDFSample", BindingFlags.Static | BindingFlags.NonPublic);
112 | }
113 |
114 | private static string SDFSample([Slot(0, Binding.None)] Vector1 SDF, [Slot(1, Binding.None)] Vector1 Offset, [Slot(2, Binding.None)] out Vector1 Out) {
115 | return @"
116 | {
117 | Out = SDF - Offset;
118 | Out = saturate(-Out / fwidth(Out));
119 | }
120 | ";
121 | }
122 | }
123 |
124 | [Title("SDF", "SDF Sample Strip")]
125 | internal class SDFSampleStripNode: CodeFunctionNode {
126 | public SDFSampleStripNode() {
127 | name = "SDF Sample Strip";
128 | }
129 |
130 | protected override MethodInfo GetFunctionToConvert()
131 | {
132 | return GetType().GetMethod("SDFSampleStrip", BindingFlags.Static | BindingFlags.NonPublic);
133 | }
134 |
135 | private static string SDFSampleStrip([Slot(0, Binding.None)] Vector1 SDF, [Slot(1, Binding.None, -0.05f, 0.05f, 0, 0)] Vector2 Offset, [Slot(2, Binding.None)] out Vector1 Out) {
136 | return @"
137 | {
138 | Out = max(-(SDF - Offset.x), SDF - Offset.y);
139 | Out = saturate(-Out / fwidth(Out));
140 | }
141 | ";
142 | }
143 | }
144 |
145 | public enum BooleanMode
146 | {
147 | Union,
148 | Intersection,
149 | Difference
150 | }
151 |
152 | [Title("SDF", "SDF Boolean")]
153 | internal class SDFBooleanNode: CodeFunctionNode {
154 | [SerializeField]
155 | private BooleanMode m_BooleanMode = BooleanMode.Union;
156 |
157 | public SDFBooleanNode() {
158 | name = "SDF Boolean";
159 | }
160 |
161 | private string GetCurrentBlendName()
162 | {
163 | return Enum.GetName(typeof (BooleanMode), m_BooleanMode);
164 | }
165 |
166 | [EnumControl("Mode")]
167 | public BooleanMode booleanMode
168 | {
169 | get
170 | {
171 | return m_BooleanMode;
172 | }
173 | set
174 | {
175 | if (m_BooleanMode == value)
176 | return;
177 | m_BooleanMode = value;
178 | Dirty(ModificationScope.Graph);
179 | }
180 | }
181 |
182 | protected override MethodInfo GetFunctionToConvert()
183 | {
184 | return GetType().GetMethod(string.Format("SDFBoolean_{0}", GetCurrentBlendName()), BindingFlags.Static | BindingFlags.NonPublic);
185 | }
186 |
187 | private static string SDFBoolean_Union([Slot(0, Binding.None)] Vector1 A, [Slot(1, Binding.None)] Vector1 B, [Slot(2, Binding.None)] out Vector1 Out) {
188 | return @"
189 | {
190 | Out = min(A, B);
191 | }
192 | ";
193 | }
194 |
195 | private static string SDFBoolean_Intersection([Slot(0, Binding.None)] Vector1 A, [Slot(1, Binding.None)] Vector1 B, [Slot(2, Binding.None)] out Vector1 Out) {
196 | return @"
197 | {
198 | Out = max(A, B);
199 | }
200 | ";
201 | }
202 |
203 | private static string SDFBoolean_Difference([Slot(0, Binding.None)] Vector1 A, [Slot(1, Binding.None)] Vector1 B, [Slot(2, Binding.None)] out Vector1 Out) {
204 | return @"
205 | {
206 | Out = max(A, -B);
207 | }
208 | ";
209 | }
210 |
211 | }
212 |
213 | [Title("SDF", "SDF Boolean Soft")]
214 | internal class SDFBooleanSoftNode: CodeFunctionNode {
215 | [SerializeField]
216 | private BooleanMode m_BooleanMode = BooleanMode.Union;
217 |
218 | public SDFBooleanSoftNode() {
219 | name = "SDF Boolean Soft";
220 | }
221 |
222 | private string GetCurrentBlendName()
223 | {
224 | return Enum.GetName(typeof (BooleanMode), m_BooleanMode);
225 | }
226 |
227 | [EnumControl("Mode")]
228 | public BooleanMode booleanMode
229 | {
230 | get
231 | {
232 | return m_BooleanMode;
233 | }
234 | set
235 | {
236 | if (m_BooleanMode == value)
237 | return;
238 | m_BooleanMode = value;
239 | Dirty(ModificationScope.Graph);
240 | }
241 | }
242 |
243 | protected override MethodInfo GetFunctionToConvert()
244 | {
245 | return GetType().GetMethod(string.Format("SDFBooleanSoft_{0}", GetCurrentBlendName()), BindingFlags.Static | BindingFlags.NonPublic);
246 | }
247 |
248 | private static string SDFBooleanSoft_Union([Slot(0, Binding.None)] Vector1 A, [Slot(1, Binding.None)] Vector1 B, [Slot(2, Binding.None, 0.1f, 0, 0, 0)] Vector1 Smoothing, [Slot(3, Binding.None)] out Vector1 Out) {
249 | return @"
250 | {
251 | float t = clamp(0.5 * (1 + (B - A) / Smoothing), 0, 1);
252 | Out = lerp(B, A, t) - Smoothing * t * (1 - t);
253 | }
254 | ";
255 | }
256 |
257 | private static string SDFBooleanSoft_Intersection([Slot(0, Binding.None)] Vector1 A, [Slot(1, Binding.None)] Vector1 B, [Slot(2, Binding.None, 0.1f, 0, 0, 0)] Vector1 Smoothing, [Slot(3, Binding.None)] out Vector1 Out) {
258 | return @"
259 | {
260 | float t = clamp(0.5 * (1 + (A - B) / Smoothing), 0, 1);
261 | Out = -(lerp(-B, -A, t) - Smoothing * t * (1 - t));
262 | }
263 | ";
264 | }
265 |
266 | private static string SDFBooleanSoft_Difference([Slot(0, Binding.None)] Vector1 A, [Slot(1, Binding.None)] Vector1 B, [Slot(2, Binding.None, 0.1f, 0, 0, 0)] Vector1 Smoothing, [Slot(3, Binding.None)] out Vector1 Out) {
267 | return @"
268 | {
269 | float t = clamp(0.5 * (1 + (A + B) / Smoothing), 0, 1);
270 | Out = -(lerp(B, -A, t) - Smoothing * t * (1 - t));
271 | }
272 | ";
273 | }
274 |
275 | }
276 |
277 | #endif
278 |
--------------------------------------------------------------------------------
/Nodes/SDF/SDFNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 716830ba28f1c4840b5bdbd4843fa74d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Symmetry.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7d32b7c5d9ee2f64eb52ed3ae78375f1
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Symmetry/SymmetryNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using System;
3 | using UnityEditor.ShaderGraph;
4 | using System.Reflection;
5 | using UnityEditor.Graphing;
6 | using UnityEditor.ShaderGraph.Drawing.Controls;
7 | using UnityEngine;
8 |
9 | [Title("Symmetry", "Reflection Symmetry")]
10 | internal class ReflectionNode: CodeFunctionNode {
11 | public ReflectionNode() {
12 | name = "Reflection Symmetry";
13 | }
14 |
15 | protected override MethodInfo GetFunctionToConvert()
16 | {
17 | return GetType().GetMethod("Reflection", BindingFlags.Static | BindingFlags.NonPublic);
18 | }
19 |
20 | private static string Reflection([Slot(0, Binding.None)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None, 0, 1, 0, 0)] Vector2 Direction, [Slot(3, Binding.None)] Vector1 Glide, [Slot(4, Binding.None)] out Vector2 Out) {
21 | Out = Vector2.zero;
22 | return @"
23 | {
24 | UV = UV - Position;
25 | float2 Normal = float2(Direction.y, -Direction.x);
26 | float distance = dot(Normal, UV);
27 | Out = (dot(Direction, UV) + (distance < 0 ? -Glide : 0)) * Direction + abs(distance) * Normal;
28 | Out = Out + Position;
29 | }
30 | ";
31 | }
32 | }
33 |
34 | [Title("Symmetry", "Rotation Symmetry")]
35 | internal class RotationNode: CodeFunctionNode {
36 | public RotationNode() {
37 | name = "Rotation Symmetry";
38 | }
39 |
40 | protected override MethodInfo GetFunctionToConvert()
41 | {
42 | return GetType().GetMethod("Rotation", BindingFlags.Static | BindingFlags.NonPublic);
43 | }
44 |
45 | private static string Rotation([Slot(0, Binding.None)] Vector2 UV, [Slot(1, Binding.None)] Vector2 Position, [Slot(2, Binding.None)] Vector1 Angle, [Slot(3, Binding.None, 2, 0, 0, 0)] Vector1 Order, [Slot(4, Binding.None)] out Vector2 Out) {
46 | Out = Vector2.zero;
47 | return @"
48 | {
49 | UV = UV - Position;
50 | float angle = atan2(UV.y, UV.x) - Angle;
51 | float rotation = -floor(angle * Order * 0.15915494309) / (Order * 0.15915494309);
52 | float Sin, Cos;
53 | sincos(rotation, Sin, Cos);
54 | Out.x = Cos * UV.x - Sin * UV.y;
55 | Out.y = Sin * UV.x + Cos * UV.y;
56 | Out = Out + Position;
57 | }
58 | ";
59 | }
60 | }
61 |
62 | [Serializable]
63 | public enum TilingMode {
64 | Square,
65 | Hexagon,
66 | Triangle,
67 | Herringbone
68 | }
69 |
70 |
71 | [Title("Symmetry", "Tiling Symmetry")]
72 | internal class TilingNode : CodeFunctionNode {
73 | [SerializeField] private TilingMode m_TilingMode = TilingMode.Square;
74 |
75 | public TilingNode() {
76 | name = "Tiling Symmetry";
77 | }
78 |
79 | private string GetCurrentModeName() {
80 | return Enum.GetName(typeof(TilingMode), m_TilingMode);
81 | }
82 |
83 | [EnumControl("Mode")]
84 | public TilingMode tilingMode {
85 | get { return m_TilingMode; }
86 | set {
87 | if (m_TilingMode == value)
88 | return;
89 | m_TilingMode = value;
90 | Dirty(ModificationScope.Graph);
91 | }
92 | }
93 |
94 | protected override MethodInfo GetFunctionToConvert() {
95 | return GetType().GetMethod(string.Format("Tiling_{0}", GetCurrentModeName()), BindingFlags.Static | BindingFlags.NonPublic);
96 | }
97 |
98 | private static string Tiling_Square([Slot(0, Binding.None)] Vector2 UV, [Slot(1, Binding.None, 1, 0, 0, 0)] Vector1 CellSize, [Slot(2, Binding.None)] Vector1 Offset, [Slot(3, Binding.None)] out Vector2 Out, [Slot(4, Binding.None)] out Vector2 CellIndex, [Slot(5, Binding.None)] out Vector2 CellPosition) {
99 | Out = Vector2.zero;
100 | CellIndex = Vector2.zero;
101 | CellPosition = Vector2.zero;
102 | return @"
103 | {
104 | float2 UV2 = UV/CellSize;
105 | CellIndex.y = round(UV2.y);
106 | UV2.x = UV2.x - Offset/CellSize * CellIndex.y;
107 | CellIndex.x = round(UV2.x);
108 | CellPosition = CellIndex * CellSize + Offset * float2(CellIndex.y, 0);
109 | Out = UV - CellPosition;
110 | }
111 | ";
112 | }
113 |
114 | private static string Tiling_Hexagon([Slot(0, Binding.None)] Vector2 UV, [Slot(1, Binding.None, 1, 0, 0, 0)] Vector1 CellSize, [Slot(2, Binding.None)] Vector1 Offset, [Slot(3, Binding.None)] out Vector2 Out, [Slot(4, Binding.None)] out Vector2 CellIndex, [Slot(5, Binding.None)] out Vector2 CellPosition) {
115 | Out = Vector2.zero;
116 | CellIndex = Vector2.zero;
117 | CellPosition = Vector2.zero;
118 | return @"
119 | {
120 | const float root3 = 1.73205080757;
121 |
122 | const float2x2 XHex = float2x2(1, -root3, 2, 0);
123 | const float2x2 YHex = float2x2(1, root3, -1, root3);
124 | const float2x2 PositionIndex = float2x2(1, 0.5, 0, 0.5*root3);
125 |
126 | float2 UV2 = UV/CellSize;
127 |
128 | float2 X = floor(mul(XHex, UV2));
129 | float2 Y = floor(mul(YHex, UV2));
130 | CellIndex = floor((float2(X.x + X.y, Y.x + Y.y) + 2)/3);
131 | CellPosition = CellSize*mul(PositionIndex, CellIndex);
132 | Out = UV - CellPosition;
133 | }
134 | ";
135 | }
136 |
137 | private static string Tiling_Triangle([Slot(0, Binding.None)] Vector2 UV, [Slot(1, Binding.None, 1, 0, 0, 0)] Vector1 CellSize, [Slot(2, Binding.None)] Vector1 Offset, [Slot(3, Binding.None)] out Vector2 Out, [Slot(4, Binding.None)] out Vector2 CellIndex, [Slot(5, Binding.None)] out Vector2 CellPosition) {
138 | Out = Vector2.zero;
139 | CellIndex = Vector2.zero;
140 | CellPosition = Vector2.zero;
141 | return @"
142 | { //-0.57735026919, 1.15470053838
143 | const float2x2 Tri = float2x2(1, -0.57735026919, 0, 1.15470053838);
144 |
145 | float2 UV2 = UV/CellSize;
146 | float2 P = mul(Tri, UV2);
147 | float Z = floor(frac(P.x) + frac(P.y));
148 | float2 floorP = floor(P);
149 | CellIndex = float2(2 * floorP.x + Z, floorP.y);
150 | CellPosition = CellSize * (float2(floorP.x + 0.5*floorP.y, 0.86602540378*floorP.y) + (2 + 2*Z) * float2(0.25, 0.14433756729));
151 | Out = (2*Z-1)*(UV - CellPosition);
152 | }
153 | ";
154 | }
155 |
156 | private static string Tiling_Herringbone([Slot(0, Binding.None)] Vector2 UV, [Slot(1, Binding.None, 1, 0, 0, 0)] Vector1 CellSize, [Slot(2, Binding.None)] Vector1 Offset, [Slot(3, Binding.None)] out Vector2 Out, [Slot(4, Binding.None)] out Vector2 CellIndex, [Slot(5, Binding.None)] out Vector2 CellPosition) {
157 | Out = Vector2.zero;
158 | CellIndex = Vector2.zero;
159 | CellPosition = Vector2.zero;
160 | return @"
161 | {
162 | const float2x2 RotA = float2x2(0.7071068, 0.7071068, -0.7071068, 0.7071068);
163 | const float2x2 RotB = float2x2(0.7071068, -0.7071068, 0.7071068, 0.7071068);
164 |
165 | const float root2 = 1.73205080757;
166 |
167 | float Width = 0.5*CellSize;
168 |
169 | float2 P = 2*round(0.5*(UV.xx/Width - float2(0, 1))) + float2(0, 1);
170 |
171 | float2 X = UV.xx - Width * P;
172 | float2 Y = UV.yy - 0.5*P;
173 | float2 Q = round(Y - X * float2(1, -1));
174 | Y = Y - Q;
175 | float2 A = mul(RotA, float2(X.x, Y.x));
176 | float2 B = mul(RotB, float2(X.y, Y.y));
177 |
178 | if(abs(X.x + Y.x) < Width){
179 | Out = A;
180 | CellIndex = float2(P.x, Q.x);
181 | } else {
182 | Out = B;
183 | CellIndex = float2(P.y, Q.y);
184 | }
185 |
186 | CellPosition = float2(CellIndex.x * Width, 0.5*CellIndex.x + CellIndex.y);
187 | }
188 | ";
189 | }
190 | }
191 |
192 | #endif
193 |
--------------------------------------------------------------------------------
/Nodes/Symmetry/SymmetryNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bb1fc886e00fb0a4389f34c632731ec0
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Truchet.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 03aab5aaf09131249970319a0ebdb906
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 98defc69c81803f459c138d076732402
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Materials.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 461f1b0f9b52551438fd0e04d41e71eb
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Materials/Truchet Hexagon.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Truchet Hexagon
10 | m_Shader: {fileID: 4800000, guid: e9965e1b72436ee40b09bbe3f4d6956d, type: 3}
11 | m_ShaderKeywords:
12 | m_LightmapFlags: 4
13 | m_EnableInstancingVariants: 0
14 | m_DoubleSidedGI: 0
15 | m_CustomRenderQueue: -1
16 | stringTagMap: {}
17 | disabledShaderPasses: []
18 | m_SavedProperties:
19 | serializedVersion: 3
20 | m_TexEnvs:
21 | - Texture2DArray_EE8B4240:
22 | m_Texture: {fileID: 0}
23 | m_Scale: {x: 1, y: 1}
24 | m_Offset: {x: 0, y: 0}
25 | - _BumpMap:
26 | m_Texture: {fileID: 0}
27 | m_Scale: {x: 1, y: 1}
28 | m_Offset: {x: 0, y: 0}
29 | - _DetailAlbedoMap:
30 | m_Texture: {fileID: 0}
31 | m_Scale: {x: 1, y: 1}
32 | m_Offset: {x: 0, y: 0}
33 | - _DetailMask:
34 | m_Texture: {fileID: 0}
35 | m_Scale: {x: 1, y: 1}
36 | m_Offset: {x: 0, y: 0}
37 | - _DetailNormalMap:
38 | m_Texture: {fileID: 0}
39 | m_Scale: {x: 1, y: 1}
40 | m_Offset: {x: 0, y: 0}
41 | - _EmissionMap:
42 | m_Texture: {fileID: 0}
43 | m_Scale: {x: 1, y: 1}
44 | m_Offset: {x: 0, y: 0}
45 | - _MainTex:
46 | m_Texture: {fileID: 0}
47 | m_Scale: {x: 1, y: 1}
48 | m_Offset: {x: 0, y: 0}
49 | - _MetallicGlossMap:
50 | m_Texture: {fileID: 0}
51 | m_Scale: {x: 1, y: 1}
52 | m_Offset: {x: 0, y: 0}
53 | - _OcclusionMap:
54 | m_Texture: {fileID: 0}
55 | m_Scale: {x: 1, y: 1}
56 | m_Offset: {x: 0, y: 0}
57 | - _ParallaxMap:
58 | m_Texture: {fileID: 0}
59 | m_Scale: {x: 1, y: 1}
60 | m_Offset: {x: 0, y: 0}
61 | - _SpecGlossMap:
62 | m_Texture: {fileID: 0}
63 | m_Scale: {x: 1, y: 1}
64 | m_Offset: {x: 0, y: 0}
65 | - _Texture2DArrayAsset_4FD2253_Out:
66 | m_Texture: {fileID: 0}
67 | m_Scale: {x: 1, y: 1}
68 | m_Offset: {x: 0, y: 0}
69 | - _Textures:
70 | m_Texture: {fileID: 0}
71 | m_Scale: {x: 1, y: 1}
72 | m_Offset: {x: 0, y: 0}
73 | m_Floats:
74 | - _AlphaClip: 0
75 | - _Blend: 0
76 | - _BumpScale: 1
77 | - _Cull: 2
78 | - _Cutoff: 0.5
79 | - _DetailNormalMapScale: 1
80 | - _DstBlend: 0
81 | - _GlossMapScale: 1
82 | - _Glossiness: 0.5
83 | - _GlossyReflections: 1
84 | - _Metallic: 0
85 | - _OcclusionStrength: 1
86 | - _Parallax: 0.02
87 | - _SmoothnessTextureChannel: 0
88 | - _SpecularHighlights: 1
89 | - _SrcBlend: 1
90 | - _Surface: 0
91 | - _UVSec: 0
92 | - _WorkflowMode: 1
93 | - _ZWrite: 1
94 | m_Colors:
95 | - _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
96 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
97 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
98 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Materials/Truchet Hexagon.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e25fc405fe32b694e8b477a81a21c16f
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Materials/Truchet Square.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Truchet Square
10 | m_Shader: {fileID: 4800000, guid: 6eeb1ab77c1d3444488fa5a50d2acfb5, type: 3}
11 | m_ShaderKeywords:
12 | m_LightmapFlags: 4
13 | m_EnableInstancingVariants: 0
14 | m_DoubleSidedGI: 0
15 | m_CustomRenderQueue: -1
16 | stringTagMap: {}
17 | disabledShaderPasses: []
18 | m_SavedProperties:
19 | serializedVersion: 3
20 | m_TexEnvs:
21 | - _BumpMap:
22 | m_Texture: {fileID: 0}
23 | m_Scale: {x: 1, y: 1}
24 | m_Offset: {x: 0, y: 0}
25 | - _DetailAlbedoMap:
26 | m_Texture: {fileID: 0}
27 | m_Scale: {x: 1, y: 1}
28 | m_Offset: {x: 0, y: 0}
29 | - _DetailMask:
30 | m_Texture: {fileID: 0}
31 | m_Scale: {x: 1, y: 1}
32 | m_Offset: {x: 0, y: 0}
33 | - _DetailNormalMap:
34 | m_Texture: {fileID: 0}
35 | m_Scale: {x: 1, y: 1}
36 | m_Offset: {x: 0, y: 0}
37 | - _EmissionMap:
38 | m_Texture: {fileID: 0}
39 | m_Scale: {x: 1, y: 1}
40 | m_Offset: {x: 0, y: 0}
41 | - _MainTex:
42 | m_Texture: {fileID: 0}
43 | m_Scale: {x: 1, y: 1}
44 | m_Offset: {x: 0, y: 0}
45 | - _MetallicGlossMap:
46 | m_Texture: {fileID: 0}
47 | m_Scale: {x: 1, y: 1}
48 | m_Offset: {x: 0, y: 0}
49 | - _OcclusionMap:
50 | m_Texture: {fileID: 0}
51 | m_Scale: {x: 1, y: 1}
52 | m_Offset: {x: 0, y: 0}
53 | - _ParallaxMap:
54 | m_Texture: {fileID: 0}
55 | m_Scale: {x: 1, y: 1}
56 | m_Offset: {x: 0, y: 0}
57 | - _SpecGlossMap:
58 | m_Texture: {fileID: 0}
59 | m_Scale: {x: 1, y: 1}
60 | m_Offset: {x: 0, y: 0}
61 | - _Textures:
62 | m_Texture: {fileID: 0}
63 | m_Scale: {x: 1, y: 1}
64 | m_Offset: {x: 0, y: 0}
65 | m_Floats:
66 | - _AlphaClip: 0
67 | - _Blend: 0
68 | - _BumpScale: 1
69 | - _Cull: 2
70 | - _Cutoff: 0.5
71 | - _DetailNormalMapScale: 1
72 | - _DstBlend: 0
73 | - _GlossMapScale: 1
74 | - _Glossiness: 0.5
75 | - _GlossyReflections: 1
76 | - _Metallic: 0
77 | - _OcclusionStrength: 1
78 | - _Parallax: 0.02
79 | - _SmoothnessTextureChannel: 0
80 | - _SpecularHighlights: 1
81 | - _SrcBlend: 1
82 | - _Surface: 0
83 | - _UVSec: 0
84 | - _WorkflowMode: 1
85 | - _ZWrite: 1
86 | m_Colors:
87 | - _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
88 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
89 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
90 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Materials/Truchet Square.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60b8a1cf1dfbda046ae34359cdba6b54
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Materials/Truchet Triangle.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Truchet Triangle
10 | m_Shader: {fileID: 4800000, guid: f079d1a2afea5f94d8278ad3df2beef5, type: 3}
11 | m_ShaderKeywords:
12 | m_LightmapFlags: 4
13 | m_EnableInstancingVariants: 0
14 | m_DoubleSidedGI: 0
15 | m_CustomRenderQueue: -1
16 | stringTagMap: {}
17 | disabledShaderPasses: []
18 | m_SavedProperties:
19 | serializedVersion: 3
20 | m_TexEnvs:
21 | - _BumpMap:
22 | m_Texture: {fileID: 0}
23 | m_Scale: {x: 1, y: 1}
24 | m_Offset: {x: 0, y: 0}
25 | - _DetailAlbedoMap:
26 | m_Texture: {fileID: 0}
27 | m_Scale: {x: 1, y: 1}
28 | m_Offset: {x: 0, y: 0}
29 | - _DetailMask:
30 | m_Texture: {fileID: 0}
31 | m_Scale: {x: 1, y: 1}
32 | m_Offset: {x: 0, y: 0}
33 | - _DetailNormalMap:
34 | m_Texture: {fileID: 0}
35 | m_Scale: {x: 1, y: 1}
36 | m_Offset: {x: 0, y: 0}
37 | - _EmissionMap:
38 | m_Texture: {fileID: 0}
39 | m_Scale: {x: 1, y: 1}
40 | m_Offset: {x: 0, y: 0}
41 | - _MainTex:
42 | m_Texture: {fileID: 0}
43 | m_Scale: {x: 1, y: 1}
44 | m_Offset: {x: 0, y: 0}
45 | - _MetallicGlossMap:
46 | m_Texture: {fileID: 0}
47 | m_Scale: {x: 1, y: 1}
48 | m_Offset: {x: 0, y: 0}
49 | - _OcclusionMap:
50 | m_Texture: {fileID: 0}
51 | m_Scale: {x: 1, y: 1}
52 | m_Offset: {x: 0, y: 0}
53 | - _ParallaxMap:
54 | m_Texture: {fileID: 0}
55 | m_Scale: {x: 1, y: 1}
56 | m_Offset: {x: 0, y: 0}
57 | - _SpecGlossMap:
58 | m_Texture: {fileID: 0}
59 | m_Scale: {x: 1, y: 1}
60 | m_Offset: {x: 0, y: 0}
61 | - _Textures:
62 | m_Texture: {fileID: 0}
63 | m_Scale: {x: 1, y: 1}
64 | m_Offset: {x: 0, y: 0}
65 | m_Floats:
66 | - _AlphaClip: 0
67 | - _Blend: 0
68 | - _BumpScale: 1
69 | - _Cull: 2
70 | - _Cutoff: 0.5
71 | - _DetailNormalMapScale: 1
72 | - _DstBlend: 0
73 | - _GlossMapScale: 1
74 | - _Glossiness: 0.5
75 | - _GlossyReflections: 1
76 | - _Metallic: 0
77 | - _OcclusionStrength: 1
78 | - _Parallax: 0.02
79 | - _SmoothnessTextureChannel: 0
80 | - _SpecularHighlights: 1
81 | - _SrcBlend: 1
82 | - _Surface: 0
83 | - _UVSec: 0
84 | - _WorkflowMode: 1
85 | - _ZWrite: 1
86 | m_Colors:
87 | - _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
88 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
89 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
90 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Materials/Truchet Triangle.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 68587b94531e22a418682284cca3d2ed
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Shaders.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: acb872d537d572c41b6c67dd39c40dd9
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Shaders/Truchet Hexagon.ShaderGraph:
--------------------------------------------------------------------------------
1 | {
2 | "m_SerializedProperties": [
3 | {
4 | "typeInfo": {
5 | "fullName": "UnityEditor.ShaderGraph.Texture2DArrayShaderProperty"
6 | },
7 | "JSONnodeData": "{\n \"m_Value\": {\n \"m_SerializedTexture\": \"\",\n \"m_Guid\": \"\"\n },\n \"m_Name\": \"Textures\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Guid\": {\n \"m_GuidSerialized\": \"e7c0a7c0-e9a3-4334-80ea-1877feb138a2\"\n },\n \"m_OverrideReferenceName\": \"_Textures\",\n \"m_Modifiable\": true\n}"
8 | }
9 | ],
10 | "m_GUID": {
11 | "m_GuidSerialized": "49b8163e-81b2-4c2d-998a-931c0af2e9ee"
12 | },
13 | "m_SerializableNodes": [
14 | {
15 | "typeInfo": {
16 | "fullName": "UnityEditor.ShaderGraph.SampleTexture2DArrayNode"
17 | },
18 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"6e87f3c5-eb7b-4182-9c68-c00682865d03\",\n \"m_Name\": \"Sample Texture 2D Array\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -356.55999755859377,\n \"y\": -39.5,\n \"width\": 0.0,\n \"height\": 0.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DArrayInputMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Texture Array\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Texture Array\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_TextureArray\\\": {\\n \\\"m_SerializedTexture\\\": \\\"\\\",\\n \\\"m_Guid\\\": \\\"\\\"\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"Index\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Index\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.UVMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Channel\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.SamplerStateMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Sampler\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sampler\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
19 | },
20 | {
21 | "typeInfo": {
22 | "fullName": "UnityEditor.ShaderGraph.UnlitMasterNode"
23 | },
24 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"0bf0a55c-539d-4c16-8428-149aa0729d19\",\n \"m_Name\": \"Unlit Master\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 4.0,\n \"y\": -63.0,\n \"width\": 208.0,\n \"height\": 350.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 9,\\n \\\"m_DisplayName\\\": \\\"Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Position\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.5,\\n \\\"y\\\": 0.5,\\n \\\"z\\\": 0.5\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_SerializableSubShaders\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEngine.Experimental.Rendering.LightweightPipeline.LightWeightUnlitSubShader\"\n },\n \"JSONnodeData\": \"{}\"\n }\n ],\n \"m_SurfaceType\": 0,\n \"m_AlphaMode\": 0,\n \"m_TwoSided\": false\n}"
25 | },
26 | {
27 | "typeInfo": {
28 | "fullName": "UnityEditor.ShaderGraph.PropertyNode"
29 | },
30 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"1bfc3ca8-42a4-4000-aff1-e7372a692740\",\n \"m_Name\": \"Property\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -531.5,\n \"y\": -75.5,\n \"width\": 107.0,\n \"height\": 77.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DArrayMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Textures\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_PropertyGuidSerialized\": \"e7c0a7c0-e9a3-4334-80ea-1877feb138a2\"\n}"
31 | },
32 | {
33 | "typeInfo": {
34 | "fullName": "TruchetNode"
35 | },
36 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"c83f3103-7000-4c97-bc46-7974e24591d0\",\n \"m_Name\": \"Truchet\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -626.5,\n \"y\": 73.5,\n \"width\": 208.0,\n \"height\": 431.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Position\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Space\\\": 2\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Size\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Size\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.25,\\n \\\"m_DefaultValue\\\": 0.25\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Number\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Number\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Seed\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Seed\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.BooleanMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"Rotate\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Rotate\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": true,\\n \\\"m_DefaultValue\\\": false\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.BooleanMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"Reflect\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Reflect\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": true,\\n \\\"m_DefaultValue\\\": false\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"Index\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Index\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_TruchetMode\": 2\n}"
37 | }
38 | ],
39 | "m_SerializableEdges": [
40 | {
41 | "typeInfo": {
42 | "fullName": "UnityEditor.Graphing.Edge"
43 | },
44 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"6e87f3c5-eb7b-4182-9c68-c00682865d03\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"0bf0a55c-539d-4c16-8428-149aa0729d19\"\n }\n}"
45 | },
46 | {
47 | "typeInfo": {
48 | "fullName": "UnityEditor.Graphing.Edge"
49 | },
50 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"1bfc3ca8-42a4-4000-aff1-e7372a692740\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"6e87f3c5-eb7b-4182-9c68-c00682865d03\"\n }\n}"
51 | },
52 | {
53 | "typeInfo": {
54 | "fullName": "UnityEditor.Graphing.Edge"
55 | },
56 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 6,\n \"m_NodeGUIDSerialized\": \"c83f3103-7000-4c97-bc46-7974e24591d0\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 8,\n \"m_NodeGUIDSerialized\": \"6e87f3c5-eb7b-4182-9c68-c00682865d03\"\n }\n}"
57 | },
58 | {
59 | "typeInfo": {
60 | "fullName": "UnityEditor.Graphing.Edge"
61 | },
62 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 7,\n \"m_NodeGUIDSerialized\": \"c83f3103-7000-4c97-bc46-7974e24591d0\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"6e87f3c5-eb7b-4182-9c68-c00682865d03\"\n }\n}"
63 | }
64 | ],
65 | "m_PreviewData": {
66 | "serializedMesh": {
67 | "m_SerializedMesh": "",
68 | "m_Guid": ""
69 | }
70 | },
71 | "m_Path": ""
72 | }
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Shaders/Truchet Hexagon.ShaderGraph.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9965e1b72436ee40b09bbe3f4d6956d
3 | ScriptedImporter:
4 | fileIDToRecycleName:
5 | 4800000: MainAsset
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
11 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Shaders/Truchet Square.ShaderGraph:
--------------------------------------------------------------------------------
1 | {
2 | "m_SerializedProperties": [
3 | {
4 | "typeInfo": {
5 | "fullName": "UnityEditor.ShaderGraph.Texture2DArrayShaderProperty"
6 | },
7 | "JSONnodeData": "{\n \"m_Value\": {\n \"m_SerializedTexture\": \"\",\n \"m_Guid\": \"\"\n },\n \"m_Name\": \"Textures\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Guid\": {\n \"m_GuidSerialized\": \"afed003d-9be6-42db-8b10-aa6d4d4ed598\"\n },\n \"m_OverrideReferenceName\": \"_Textures\",\n \"m_Modifiable\": true\n}"
8 | }
9 | ],
10 | "m_GUID": {
11 | "m_GuidSerialized": "93a7fa96-82c8-43d9-a1b0-ace7c68aedcb"
12 | },
13 | "m_SerializableNodes": [
14 | {
15 | "typeInfo": {
16 | "fullName": "UnityEditor.ShaderGraph.UnlitMasterNode"
17 | },
18 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"2604a4f2-d5ca-454b-8c15-24edd47a982d\",\n \"m_Name\": \"Unlit Master\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 203.0,\n \"y\": 55.0,\n \"width\": 208.0,\n \"height\": 350.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 9,\\n \\\"m_DisplayName\\\": \\\"Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Position\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.5,\\n \\\"y\\\": 0.5,\\n \\\"z\\\": 0.5\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_SerializableSubShaders\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEngine.Experimental.Rendering.LightweightPipeline.LightWeightUnlitSubShader\"\n },\n \"JSONnodeData\": \"{}\"\n }\n ],\n \"m_SurfaceType\": 0,\n \"m_AlphaMode\": 0,\n \"m_TwoSided\": false\n}"
19 | },
20 | {
21 | "typeInfo": {
22 | "fullName": "UnityEditor.ShaderGraph.PropertyNode"
23 | },
24 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"74cecceb-d271-4186-9cd5-28a703d43e70\",\n \"m_Name\": \"Property\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -305.0,\n \"y\": 29.5,\n \"width\": 107.0,\n \"height\": 77.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DArrayMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Textures\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_PropertyGuidSerialized\": \"afed003d-9be6-42db-8b10-aa6d4d4ed598\"\n}"
25 | },
26 | {
27 | "typeInfo": {
28 | "fullName": "UnityEditor.ShaderGraph.SampleTexture2DArrayNode"
29 | },
30 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"497541c6-0466-4744-a1da-b9beaa71c76f\",\n \"m_Name\": \"Sample Texture 2D Array\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -139.0,\n \"y\": 78.5,\n \"width\": 208.0,\n \"height\": 374.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DArrayInputMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Texture Array\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Texture Array\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_TextureArray\\\": {\\n \\\"m_SerializedTexture\\\": \\\"\\\",\\n \\\"m_Guid\\\": \\\"\\\"\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"Index\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Index\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.UVMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Channel\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.SamplerStateMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Sampler\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sampler\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
31 | },
32 | {
33 | "typeInfo": {
34 | "fullName": "TruchetNode"
35 | },
36 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"0ed831c7-90ca-4d0a-ba9d-74a22f67f33e\",\n \"m_Name\": \"Truchet\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -472.0,\n \"y\": 179.5,\n \"width\": 208.0,\n \"height\": 431.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Position\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Space\\\": 2\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Size\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Size\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.25,\\n \\\"m_DefaultValue\\\": 0.25\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Number\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Number\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 2.0,\\n \\\"m_DefaultValue\\\": 1.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Seed\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Seed\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.BooleanMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"Rotate\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Rotate\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": true,\\n \\\"m_DefaultValue\\\": false\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.BooleanMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"Reflect\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Reflect\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": true,\\n \\\"m_DefaultValue\\\": false\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"Index\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Index\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_TruchetMode\": 0\n}"
37 | }
38 | ],
39 | "m_SerializableEdges": [
40 | {
41 | "typeInfo": {
42 | "fullName": "UnityEditor.Graphing.Edge"
43 | },
44 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"74cecceb-d271-4186-9cd5-28a703d43e70\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"497541c6-0466-4744-a1da-b9beaa71c76f\"\n }\n}"
45 | },
46 | {
47 | "typeInfo": {
48 | "fullName": "UnityEditor.Graphing.Edge"
49 | },
50 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"497541c6-0466-4744-a1da-b9beaa71c76f\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"2604a4f2-d5ca-454b-8c15-24edd47a982d\"\n }\n}"
51 | },
52 | {
53 | "typeInfo": {
54 | "fullName": "UnityEditor.Graphing.Edge"
55 | },
56 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 6,\n \"m_NodeGUIDSerialized\": \"0ed831c7-90ca-4d0a-ba9d-74a22f67f33e\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 8,\n \"m_NodeGUIDSerialized\": \"497541c6-0466-4744-a1da-b9beaa71c76f\"\n }\n}"
57 | },
58 | {
59 | "typeInfo": {
60 | "fullName": "UnityEditor.Graphing.Edge"
61 | },
62 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 7,\n \"m_NodeGUIDSerialized\": \"0ed831c7-90ca-4d0a-ba9d-74a22f67f33e\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"497541c6-0466-4744-a1da-b9beaa71c76f\"\n }\n}"
63 | }
64 | ],
65 | "m_PreviewData": {
66 | "serializedMesh": {
67 | "m_SerializedMesh": "",
68 | "m_Guid": ""
69 | }
70 | },
71 | "m_Path": ""
72 | }
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Shaders/Truchet Square.ShaderGraph.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6eeb1ab77c1d3444488fa5a50d2acfb5
3 | ScriptedImporter:
4 | fileIDToRecycleName:
5 | 4800000: MainAsset
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
11 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Shaders/Truchet Triangle.ShaderGraph:
--------------------------------------------------------------------------------
1 | {
2 | "m_SerializedProperties": [
3 | {
4 | "typeInfo": {
5 | "fullName": "UnityEditor.ShaderGraph.Texture2DArrayShaderProperty"
6 | },
7 | "JSONnodeData": "{\n \"m_Value\": {\n \"m_SerializedTexture\": \"\",\n \"m_Guid\": \"\"\n },\n \"m_Name\": \"Textures\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Guid\": {\n \"m_GuidSerialized\": \"fc91209a-1258-4800-a4db-172752c4518d\"\n },\n \"m_OverrideReferenceName\": \"_Textures\",\n \"m_Modifiable\": true\n}"
8 | }
9 | ],
10 | "m_GUID": {
11 | "m_GuidSerialized": "788e4e67-09cf-474d-9c80-cdc0c20895f9"
12 | },
13 | "m_SerializableNodes": [
14 | {
15 | "typeInfo": {
16 | "fullName": "UnityEditor.ShaderGraph.UnlitMasterNode"
17 | },
18 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"22a8aff9-a654-4b13-83c7-b8a6aa9fa3ed\",\n \"m_Name\": \"Unlit Master\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 0.0,\n \"y\": 0.0,\n \"width\": 0.0,\n \"height\": 0.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 9,\\n \\\"m_DisplayName\\\": \\\"Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Position\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.5,\\n \\\"y\\\": 0.5,\\n \\\"z\\\": 0.5\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_SerializableSubShaders\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEngine.Experimental.Rendering.LightweightPipeline.LightWeightUnlitSubShader\"\n },\n \"JSONnodeData\": \"{}\"\n }\n ],\n \"m_SurfaceType\": 0,\n \"m_AlphaMode\": 0,\n \"m_TwoSided\": false\n}"
19 | },
20 | {
21 | "typeInfo": {
22 | "fullName": "UnityEditor.ShaderGraph.SampleTexture2DArrayNode"
23 | },
24 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"cec4504f-8dd2-49cd-87ab-812bda6c2f13\",\n \"m_Name\": \"Sample Texture 2D Array\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -325.6220703125,\n \"y\": -10.247529029846192,\n \"width\": 208.0,\n \"height\": 374.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DArrayInputMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Texture Array\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Texture Array\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_TextureArray\\\": {\\n \\\"m_SerializedTexture\\\": \\\"\\\",\\n \\\"m_Guid\\\": \\\"\\\"\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"Index\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Index\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.UVMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Channel\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.SamplerStateMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Sampler\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sampler\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
25 | },
26 | {
27 | "typeInfo": {
28 | "fullName": "UnityEditor.ShaderGraph.PropertyNode"
29 | },
30 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"97c4c5b2-2af4-4994-9f65-14f30cfd8ca5\",\n \"m_Name\": \"Property\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -493.4373779296875,\n \"y\": -56.3270263671875,\n \"width\": 107.0,\n \"height\": 77.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DArrayMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Textures\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_PropertyGuidSerialized\": \"fc91209a-1258-4800-a4db-172752c4518d\"\n}"
31 | },
32 | {
33 | "typeInfo": {
34 | "fullName": "TruchetNode"
35 | },
36 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"cc152bcb-604e-41f1-a681-99dcb2d444d8\",\n \"m_Name\": \"Truchet\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -604.0,\n \"y\": 140.0,\n \"width\": 208.0,\n \"height\": 431.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Position\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Space\\\": 2\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Size\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Size\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.25,\\n \\\"m_DefaultValue\\\": 0.25\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Number\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Number\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Seed\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Seed\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.BooleanMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"Rotate\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Rotate\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": true,\\n \\\"m_DefaultValue\\\": false\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.BooleanMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"Reflect\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Reflect\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": true,\\n \\\"m_DefaultValue\\\": false\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"Index\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Index\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_TruchetMode\": 1\n}"
37 | }
38 | ],
39 | "m_SerializableEdges": [
40 | {
41 | "typeInfo": {
42 | "fullName": "UnityEditor.Graphing.Edge"
43 | },
44 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"97c4c5b2-2af4-4994-9f65-14f30cfd8ca5\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"cec4504f-8dd2-49cd-87ab-812bda6c2f13\"\n }\n}"
45 | },
46 | {
47 | "typeInfo": {
48 | "fullName": "UnityEditor.Graphing.Edge"
49 | },
50 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"cec4504f-8dd2-49cd-87ab-812bda6c2f13\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"22a8aff9-a654-4b13-83c7-b8a6aa9fa3ed\"\n }\n}"
51 | },
52 | {
53 | "typeInfo": {
54 | "fullName": "UnityEditor.Graphing.Edge"
55 | },
56 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 6,\n \"m_NodeGUIDSerialized\": \"cc152bcb-604e-41f1-a681-99dcb2d444d8\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 8,\n \"m_NodeGUIDSerialized\": \"cec4504f-8dd2-49cd-87ab-812bda6c2f13\"\n }\n}"
57 | },
58 | {
59 | "typeInfo": {
60 | "fullName": "UnityEditor.Graphing.Edge"
61 | },
62 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 7,\n \"m_NodeGUIDSerialized\": \"cc152bcb-604e-41f1-a681-99dcb2d444d8\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"cec4504f-8dd2-49cd-87ab-812bda6c2f13\"\n }\n}"
63 | }
64 | ],
65 | "m_PreviewData": {
66 | "serializedMesh": {
67 | "m_SerializedMesh": "",
68 | "m_Guid": ""
69 | }
70 | },
71 | "m_Path": ""
72 | }
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Shaders/Truchet Triangle.ShaderGraph.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f079d1a2afea5f94d8278ad3df2beef5
3 | ScriptedImporter:
4 | fileIDToRecycleName:
5 | 4800000: MainAsset
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
11 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 839f6e2f96eb7a449813172e68088ddd
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures/Hexagon_0.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neon-age/shader-graph-nodes/8e0526b3558f0d3d50ad98b02e5bab50f71baa9f/Nodes/Truchet/Examples/Textures/Hexagon_0.psd
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures/Hexagon_0.psd.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3a7b61808f5981d4ca5170c4c1116ebb
3 | TextureImporter:
4 | fileIDToRecycleName: {}
5 | externalObjects: {}
6 | serializedVersion: 6
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 0
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 1
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: -1
38 | wrapV: -1
39 | wrapW: -1
40 | nPOTScale: 1
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 0
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 1
52 | alphaIsTransparency: 0
53 | spriteTessellationDetail: -1
54 | textureType: 0
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 2
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 0
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | - serializedVersion: 2
73 | buildTarget: Standalone
74 | maxTextureSize: 2048
75 | resizeAlgorithm: 0
76 | textureFormat: -1
77 | textureCompression: 0
78 | compressionQuality: 50
79 | crunchedCompression: 0
80 | allowsAlphaSplitting: 0
81 | overridden: 0
82 | androidETC2FallbackOverride: 0
83 | - serializedVersion: 2
84 | buildTarget: iPhone
85 | maxTextureSize: 2048
86 | resizeAlgorithm: 0
87 | textureFormat: -1
88 | textureCompression: 0
89 | compressionQuality: 50
90 | crunchedCompression: 0
91 | allowsAlphaSplitting: 0
92 | overridden: 0
93 | androidETC2FallbackOverride: 0
94 | - serializedVersion: 2
95 | buildTarget: Android
96 | maxTextureSize: 2048
97 | resizeAlgorithm: 0
98 | textureFormat: -1
99 | textureCompression: 0
100 | compressionQuality: 50
101 | crunchedCompression: 0
102 | allowsAlphaSplitting: 0
103 | overridden: 0
104 | androidETC2FallbackOverride: 0
105 | spriteSheet:
106 | serializedVersion: 2
107 | sprites: []
108 | outline: []
109 | physicsShape: []
110 | bones: []
111 | spriteID:
112 | vertices: []
113 | indices:
114 | edges: []
115 | weights: []
116 | spritePackingTag:
117 | userData:
118 | assetBundleName:
119 | assetBundleVariant:
120 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures/Square_0.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neon-age/shader-graph-nodes/8e0526b3558f0d3d50ad98b02e5bab50f71baa9f/Nodes/Truchet/Examples/Textures/Square_0.psd
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures/Square_0.psd.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ab377c06effbabb4da29bd0730fa8726
3 | TextureImporter:
4 | fileIDToRecycleName: {}
5 | externalObjects: {}
6 | serializedVersion: 6
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 1
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 1
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: 0
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: -1
38 | wrapV: -1
39 | wrapW: -1
40 | nPOTScale: 1
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 0
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 1
52 | alphaIsTransparency: 0
53 | spriteTessellationDetail: -1
54 | textureType: 0
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 2
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 0
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | - serializedVersion: 2
73 | buildTarget: Standalone
74 | maxTextureSize: 2048
75 | resizeAlgorithm: 0
76 | textureFormat: -1
77 | textureCompression: 0
78 | compressionQuality: 50
79 | crunchedCompression: 0
80 | allowsAlphaSplitting: 0
81 | overridden: 0
82 | androidETC2FallbackOverride: 0
83 | - serializedVersion: 2
84 | buildTarget: iPhone
85 | maxTextureSize: 2048
86 | resizeAlgorithm: 0
87 | textureFormat: -1
88 | textureCompression: 0
89 | compressionQuality: 50
90 | crunchedCompression: 0
91 | allowsAlphaSplitting: 0
92 | overridden: 0
93 | androidETC2FallbackOverride: 0
94 | - serializedVersion: 2
95 | buildTarget: Android
96 | maxTextureSize: 2048
97 | resizeAlgorithm: 0
98 | textureFormat: -1
99 | textureCompression: 0
100 | compressionQuality: 50
101 | crunchedCompression: 0
102 | allowsAlphaSplitting: 0
103 | overridden: 0
104 | androidETC2FallbackOverride: 0
105 | spriteSheet:
106 | serializedVersion: 2
107 | sprites: []
108 | outline: []
109 | physicsShape: []
110 | bones: []
111 | spriteID:
112 | vertices: []
113 | indices:
114 | edges: []
115 | weights: []
116 | spritePackingTag:
117 | userData:
118 | assetBundleName:
119 | assetBundleVariant:
120 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures/Square_1.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neon-age/shader-graph-nodes/8e0526b3558f0d3d50ad98b02e5bab50f71baa9f/Nodes/Truchet/Examples/Textures/Square_1.psd
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures/Square_1.psd.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bbf7cbf387d3ba043bd14c01a045ac0f
3 | TextureImporter:
4 | fileIDToRecycleName: {}
5 | externalObjects: {}
6 | serializedVersion: 6
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 1
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 1
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: 0
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: -1
38 | wrapV: -1
39 | wrapW: -1
40 | nPOTScale: 1
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 0
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 1
52 | alphaIsTransparency: 0
53 | spriteTessellationDetail: -1
54 | textureType: 0
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 2
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 0
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | - serializedVersion: 2
73 | buildTarget: Standalone
74 | maxTextureSize: 2048
75 | resizeAlgorithm: 0
76 | textureFormat: -1
77 | textureCompression: 0
78 | compressionQuality: 50
79 | crunchedCompression: 0
80 | allowsAlphaSplitting: 0
81 | overridden: 0
82 | androidETC2FallbackOverride: 0
83 | - serializedVersion: 2
84 | buildTarget: iPhone
85 | maxTextureSize: 2048
86 | resizeAlgorithm: 0
87 | textureFormat: -1
88 | textureCompression: 0
89 | compressionQuality: 50
90 | crunchedCompression: 0
91 | allowsAlphaSplitting: 0
92 | overridden: 0
93 | androidETC2FallbackOverride: 0
94 | - serializedVersion: 2
95 | buildTarget: Android
96 | maxTextureSize: 2048
97 | resizeAlgorithm: 0
98 | textureFormat: -1
99 | textureCompression: 0
100 | compressionQuality: 50
101 | crunchedCompression: 0
102 | allowsAlphaSplitting: 0
103 | overridden: 0
104 | androidETC2FallbackOverride: 0
105 | spriteSheet:
106 | serializedVersion: 2
107 | sprites: []
108 | outline: []
109 | physicsShape: []
110 | bones: []
111 | spriteID:
112 | vertices: []
113 | indices:
114 | edges: []
115 | weights: []
116 | spritePackingTag:
117 | userData:
118 | assetBundleName:
119 | assetBundleVariant:
120 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures/Triangle_0.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neon-age/shader-graph-nodes/8e0526b3558f0d3d50ad98b02e5bab50f71baa9f/Nodes/Truchet/Examples/Textures/Triangle_0.psd
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Textures/Triangle_0.psd.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c562333d4321d5745aa9a0b547c612cc
3 | TextureImporter:
4 | fileIDToRecycleName: {}
5 | externalObjects: {}
6 | serializedVersion: 6
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 0
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 1
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: -1
38 | wrapV: -1
39 | wrapW: -1
40 | nPOTScale: 1
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 0
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 1
52 | alphaIsTransparency: 0
53 | spriteTessellationDetail: -1
54 | textureType: 0
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 2
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 0
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | - serializedVersion: 2
73 | buildTarget: Standalone
74 | maxTextureSize: 2048
75 | resizeAlgorithm: 0
76 | textureFormat: -1
77 | textureCompression: 0
78 | compressionQuality: 50
79 | crunchedCompression: 0
80 | allowsAlphaSplitting: 0
81 | overridden: 0
82 | androidETC2FallbackOverride: 0
83 | - serializedVersion: 2
84 | buildTarget: iPhone
85 | maxTextureSize: 2048
86 | resizeAlgorithm: 0
87 | textureFormat: -1
88 | textureCompression: 0
89 | compressionQuality: 50
90 | crunchedCompression: 0
91 | allowsAlphaSplitting: 0
92 | overridden: 0
93 | androidETC2FallbackOverride: 0
94 | - serializedVersion: 2
95 | buildTarget: Android
96 | maxTextureSize: 2048
97 | resizeAlgorithm: 0
98 | textureFormat: -1
99 | textureCompression: 0
100 | compressionQuality: 50
101 | crunchedCompression: 0
102 | allowsAlphaSplitting: 0
103 | overridden: 0
104 | androidETC2FallbackOverride: 0
105 | spriteSheet:
106 | serializedVersion: 2
107 | sprites: []
108 | outline: []
109 | physicsShape: []
110 | bones: []
111 | spriteID:
112 | vertices: []
113 | indices:
114 | edges: []
115 | weights: []
116 | spritePackingTag:
117 | userData:
118 | assetBundleName:
119 | assetBundleVariant:
120 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Truchet Hexagon.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1001 &100100000
4 | Prefab:
5 | m_ObjectHideFlags: 1
6 | serializedVersion: 2
7 | m_Modification:
8 | m_TransformParent: {fileID: 0}
9 | m_Modifications: []
10 | m_RemovedComponents: []
11 | m_SourcePrefab: {fileID: 0}
12 | m_RootGameObject: {fileID: 1156002556828918}
13 | m_IsPrefabAsset: 1
14 | --- !u!1 &1156002556828918
15 | GameObject:
16 | m_ObjectHideFlags: 0
17 | m_CorrespondingSourceObject: {fileID: 0}
18 | m_PrefabInternal: {fileID: 100100000}
19 | serializedVersion: 6
20 | m_Component:
21 | - component: {fileID: 4111320266724544}
22 | - component: {fileID: 33530097820898628}
23 | - component: {fileID: 23649198459928748}
24 | - component: {fileID: 114103656921292654}
25 | m_Layer: 0
26 | m_Name: Truchet Hexagon
27 | m_TagString: Untagged
28 | m_Icon: {fileID: 0}
29 | m_NavMeshLayer: 0
30 | m_StaticEditorFlags: 0
31 | m_IsActive: 1
32 | --- !u!4 &4111320266724544
33 | Transform:
34 | m_ObjectHideFlags: 1
35 | m_CorrespondingSourceObject: {fileID: 0}
36 | m_PrefabInternal: {fileID: 100100000}
37 | m_GameObject: {fileID: 1156002556828918}
38 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
39 | m_LocalPosition: {x: 0, y: 0, z: 0}
40 | m_LocalScale: {x: 1, y: 1, z: 1}
41 | m_Children: []
42 | m_Father: {fileID: 0}
43 | m_RootOrder: 0
44 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
45 | --- !u!23 &23649198459928748
46 | MeshRenderer:
47 | m_ObjectHideFlags: 1
48 | m_CorrespondingSourceObject: {fileID: 0}
49 | m_PrefabInternal: {fileID: 100100000}
50 | m_GameObject: {fileID: 1156002556828918}
51 | m_Enabled: 1
52 | m_CastShadows: 1
53 | m_ReceiveShadows: 1
54 | m_DynamicOccludee: 1
55 | m_MotionVectors: 1
56 | m_LightProbeUsage: 1
57 | m_ReflectionProbeUsage: 1
58 | m_RenderingLayerMask: 4294967295
59 | m_Materials:
60 | - {fileID: 2100000, guid: e25fc405fe32b694e8b477a81a21c16f, type: 2}
61 | m_StaticBatchInfo:
62 | firstSubMesh: 0
63 | subMeshCount: 0
64 | m_StaticBatchRoot: {fileID: 0}
65 | m_ProbeAnchor: {fileID: 0}
66 | m_LightProbeVolumeOverride: {fileID: 0}
67 | m_ScaleInLightmap: 1
68 | m_PreserveUVs: 0
69 | m_IgnoreNormalsForChartDetection: 0
70 | m_ImportantGI: 0
71 | m_StitchLightmapSeams: 0
72 | m_SelectedEditorRenderState: 3
73 | m_MinimumChartSize: 4
74 | m_AutoUVMaxDistance: 0.5
75 | m_AutoUVMaxAngle: 89
76 | m_LightmapParameters: {fileID: 0}
77 | m_SortingLayerID: 0
78 | m_SortingLayer: 0
79 | m_SortingOrder: 0
80 | --- !u!33 &33530097820898628
81 | MeshFilter:
82 | m_ObjectHideFlags: 1
83 | m_CorrespondingSourceObject: {fileID: 0}
84 | m_PrefabInternal: {fileID: 100100000}
85 | m_GameObject: {fileID: 1156002556828918}
86 | m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
87 | --- !u!114 &114103656921292654
88 | MonoBehaviour:
89 | m_ObjectHideFlags: 1
90 | m_CorrespondingSourceObject: {fileID: 0}
91 | m_PrefabInternal: {fileID: 100100000}
92 | m_GameObject: {fileID: 1156002556828918}
93 | m_Enabled: 1
94 | m_EditorHideFlags: 0
95 | m_Script: {fileID: 11500000, guid: 7474ffb9155df4f4ab894a5202ebb041, type: 3}
96 | m_Name:
97 | m_EditorClassIdentifier:
98 | _textures:
99 | - {fileID: 2800000, guid: 3a7b61808f5981d4ca5170c4c1116ebb, type: 3}
100 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Truchet Hexagon.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f2e0a01206030754fa3b4cafa911f246
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 100100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Truchet Square.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1001 &100100000
4 | Prefab:
5 | m_ObjectHideFlags: 1
6 | serializedVersion: 2
7 | m_Modification:
8 | m_TransformParent: {fileID: 0}
9 | m_Modifications: []
10 | m_RemovedComponents: []
11 | m_SourcePrefab: {fileID: 0}
12 | m_RootGameObject: {fileID: 1156002556828918}
13 | m_IsPrefabAsset: 1
14 | --- !u!1 &1156002556828918
15 | GameObject:
16 | m_ObjectHideFlags: 0
17 | m_CorrespondingSourceObject: {fileID: 0}
18 | m_PrefabInternal: {fileID: 100100000}
19 | serializedVersion: 6
20 | m_Component:
21 | - component: {fileID: 4111320266724544}
22 | - component: {fileID: 33530097820898628}
23 | - component: {fileID: 23649198459928748}
24 | - component: {fileID: 114103656921292654}
25 | m_Layer: 0
26 | m_Name: Truchet Square
27 | m_TagString: Untagged
28 | m_Icon: {fileID: 0}
29 | m_NavMeshLayer: 0
30 | m_StaticEditorFlags: 0
31 | m_IsActive: 1
32 | --- !u!4 &4111320266724544
33 | Transform:
34 | m_ObjectHideFlags: 1
35 | m_CorrespondingSourceObject: {fileID: 0}
36 | m_PrefabInternal: {fileID: 100100000}
37 | m_GameObject: {fileID: 1156002556828918}
38 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
39 | m_LocalPosition: {x: 0, y: 0, z: 0}
40 | m_LocalScale: {x: 1, y: 1, z: 1}
41 | m_Children: []
42 | m_Father: {fileID: 0}
43 | m_RootOrder: 0
44 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
45 | --- !u!23 &23649198459928748
46 | MeshRenderer:
47 | m_ObjectHideFlags: 1
48 | m_CorrespondingSourceObject: {fileID: 0}
49 | m_PrefabInternal: {fileID: 100100000}
50 | m_GameObject: {fileID: 1156002556828918}
51 | m_Enabled: 1
52 | m_CastShadows: 1
53 | m_ReceiveShadows: 1
54 | m_DynamicOccludee: 1
55 | m_MotionVectors: 1
56 | m_LightProbeUsage: 1
57 | m_ReflectionProbeUsage: 1
58 | m_RenderingLayerMask: 4294967295
59 | m_Materials:
60 | - {fileID: 2100000, guid: 60b8a1cf1dfbda046ae34359cdba6b54, type: 2}
61 | m_StaticBatchInfo:
62 | firstSubMesh: 0
63 | subMeshCount: 0
64 | m_StaticBatchRoot: {fileID: 0}
65 | m_ProbeAnchor: {fileID: 0}
66 | m_LightProbeVolumeOverride: {fileID: 0}
67 | m_ScaleInLightmap: 1
68 | m_PreserveUVs: 0
69 | m_IgnoreNormalsForChartDetection: 0
70 | m_ImportantGI: 0
71 | m_StitchLightmapSeams: 0
72 | m_SelectedEditorRenderState: 3
73 | m_MinimumChartSize: 4
74 | m_AutoUVMaxDistance: 0.5
75 | m_AutoUVMaxAngle: 89
76 | m_LightmapParameters: {fileID: 0}
77 | m_SortingLayerID: 0
78 | m_SortingLayer: 0
79 | m_SortingOrder: 0
80 | --- !u!33 &33530097820898628
81 | MeshFilter:
82 | m_ObjectHideFlags: 1
83 | m_CorrespondingSourceObject: {fileID: 0}
84 | m_PrefabInternal: {fileID: 100100000}
85 | m_GameObject: {fileID: 1156002556828918}
86 | m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
87 | --- !u!114 &114103656921292654
88 | MonoBehaviour:
89 | m_ObjectHideFlags: 1
90 | m_CorrespondingSourceObject: {fileID: 0}
91 | m_PrefabInternal: {fileID: 100100000}
92 | m_GameObject: {fileID: 1156002556828918}
93 | m_Enabled: 1
94 | m_EditorHideFlags: 0
95 | m_Script: {fileID: 11500000, guid: 7474ffb9155df4f4ab894a5202ebb041, type: 3}
96 | m_Name:
97 | m_EditorClassIdentifier:
98 | _textures:
99 | - {fileID: 2800000, guid: ab377c06effbabb4da29bd0730fa8726, type: 3}
100 | - {fileID: 2800000, guid: bbf7cbf387d3ba043bd14c01a045ac0f, type: 3}
101 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Truchet Square.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 80af436e0620f6b459ba8cabb991554b
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Truchet Triangle.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1001 &100100000
4 | Prefab:
5 | m_ObjectHideFlags: 1
6 | serializedVersion: 2
7 | m_Modification:
8 | m_TransformParent: {fileID: 0}
9 | m_Modifications: []
10 | m_RemovedComponents: []
11 | m_SourcePrefab: {fileID: 0}
12 | m_RootGameObject: {fileID: 1156002556828918}
13 | m_IsPrefabAsset: 1
14 | --- !u!1 &1156002556828918
15 | GameObject:
16 | m_ObjectHideFlags: 0
17 | m_CorrespondingSourceObject: {fileID: 0}
18 | m_PrefabInternal: {fileID: 100100000}
19 | serializedVersion: 6
20 | m_Component:
21 | - component: {fileID: 4111320266724544}
22 | - component: {fileID: 33530097820898628}
23 | - component: {fileID: 23649198459928748}
24 | - component: {fileID: 114103656921292654}
25 | m_Layer: 0
26 | m_Name: Truchet Triangle
27 | m_TagString: Untagged
28 | m_Icon: {fileID: 0}
29 | m_NavMeshLayer: 0
30 | m_StaticEditorFlags: 0
31 | m_IsActive: 1
32 | --- !u!4 &4111320266724544
33 | Transform:
34 | m_ObjectHideFlags: 1
35 | m_CorrespondingSourceObject: {fileID: 0}
36 | m_PrefabInternal: {fileID: 100100000}
37 | m_GameObject: {fileID: 1156002556828918}
38 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
39 | m_LocalPosition: {x: 0, y: 0, z: 0}
40 | m_LocalScale: {x: 1, y: 1, z: 1}
41 | m_Children: []
42 | m_Father: {fileID: 0}
43 | m_RootOrder: 0
44 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
45 | --- !u!23 &23649198459928748
46 | MeshRenderer:
47 | m_ObjectHideFlags: 1
48 | m_CorrespondingSourceObject: {fileID: 0}
49 | m_PrefabInternal: {fileID: 100100000}
50 | m_GameObject: {fileID: 1156002556828918}
51 | m_Enabled: 1
52 | m_CastShadows: 1
53 | m_ReceiveShadows: 1
54 | m_DynamicOccludee: 1
55 | m_MotionVectors: 1
56 | m_LightProbeUsage: 1
57 | m_ReflectionProbeUsage: 1
58 | m_RenderingLayerMask: 4294967295
59 | m_Materials:
60 | - {fileID: 2100000, guid: 68587b94531e22a418682284cca3d2ed, type: 2}
61 | m_StaticBatchInfo:
62 | firstSubMesh: 0
63 | subMeshCount: 0
64 | m_StaticBatchRoot: {fileID: 0}
65 | m_ProbeAnchor: {fileID: 0}
66 | m_LightProbeVolumeOverride: {fileID: 0}
67 | m_ScaleInLightmap: 1
68 | m_PreserveUVs: 0
69 | m_IgnoreNormalsForChartDetection: 0
70 | m_ImportantGI: 0
71 | m_StitchLightmapSeams: 0
72 | m_SelectedEditorRenderState: 3
73 | m_MinimumChartSize: 4
74 | m_AutoUVMaxDistance: 0.5
75 | m_AutoUVMaxAngle: 89
76 | m_LightmapParameters: {fileID: 0}
77 | m_SortingLayerID: 0
78 | m_SortingLayer: 0
79 | m_SortingOrder: 0
80 | --- !u!33 &33530097820898628
81 | MeshFilter:
82 | m_ObjectHideFlags: 1
83 | m_CorrespondingSourceObject: {fileID: 0}
84 | m_PrefabInternal: {fileID: 100100000}
85 | m_GameObject: {fileID: 1156002556828918}
86 | m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
87 | --- !u!114 &114103656921292654
88 | MonoBehaviour:
89 | m_ObjectHideFlags: 1
90 | m_CorrespondingSourceObject: {fileID: 0}
91 | m_PrefabInternal: {fileID: 100100000}
92 | m_GameObject: {fileID: 1156002556828918}
93 | m_Enabled: 1
94 | m_EditorHideFlags: 0
95 | m_Script: {fileID: 11500000, guid: 7474ffb9155df4f4ab894a5202ebb041, type: 3}
96 | m_Name:
97 | m_EditorClassIdentifier:
98 | _textures:
99 | - {fileID: 2800000, guid: c562333d4321d5745aa9a0b547c612cc, type: 3}
100 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Examples/Truchet Triangle.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4c593d91632aa534c96b8284763b1934
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Nodes/Truchet/README.md:
--------------------------------------------------------------------------------
1 | # Truchet
2 |
3 | This is a set of custom nodes for use with Shader Graph to make random Truchet tilings procedurally.
4 |
5 | https://en.wikipedia.org/wiki/Truchet_tiles
6 |
7 | ## Square
8 |
9 | A grid of squares. Here we use these two tiles.
10 |
11 | 
12 | 
13 |
14 | The tiles are placed, rotated and reflected randomly as so.
15 |
16 | 
17 |
18 | Here's the final result.
19 |
20 | 
21 |
22 | ## Triangle
23 |
24 | A grid of equilateral triangles. This produces a hexagonal looking result.
25 |
26 | 
27 |
28 | ## Hexagon
29 |
30 | A grid of regular hexagons.
31 |
32 | 
33 |
34 | Here we can see the different patterns that can be produced from the same tile as above. Firstly without rotation or reflection.
35 |
36 | 
37 |
38 | Here the tile is only reflected horizontally.
39 |
40 | 
41 |
42 | ## Usage
43 |
44 | 
45 |
46 | The three shape nodes all work the same way.
47 |
48 | - The position input takes the input position of the pixel considered. Recommended inputs are the world/object position or UV.
49 | - Size controls the scale of the pattern.
50 | - Number is the numbers of different tiles you have, if you have a Texture2dArray this would be the size of the array.
51 | - Seed is a seed value for the pseudorandom number generator. Change this for a new pattern.
52 | - Rotate controls whether to allow rotation of the tiles.
53 | - Reflect controls whether to allow horizontal reflection of the tiles.
54 |
55 | - The Index output is an integer in the range \[0, Number) that says which tile should be drawn, here it is used as an input for the Texture2DArray
56 | - The UV output is a Vector2 that is the UV coordinate of the pixel on the tile. For a square the tile texture is the same as the whole tile, the hexagon fills the tile horizontally and is centred, the triangle has a vertex at the top that touches the edge of the tile and is centred.
57 |
58 | As well as texture arrays we can use these UVS to reference procedural shapes. Here is an example where some rectangles rotate over time.
59 |
60 | 
61 |
--------------------------------------------------------------------------------
/Nodes/Truchet/Texture2DArrayBehaviour.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class Texture2DArrayBehaviour : MonoBehaviour {
6 | public Texture2D[] _textures;
7 |
8 | void Start() {
9 | Texture2DArray texture2DArray = new Texture2DArray(_textures[0].width, _textures[0].height, _textures.Length, TextureFormat.RGBA32, false, false);
10 |
11 | texture2DArray.filterMode = FilterMode.Bilinear;
12 | texture2DArray.wrapMode = TextureWrapMode.Repeat;
13 |
14 | for (int i = 0; i < _textures.Length; i++) {
15 | texture2DArray.SetPixels(_textures[i].GetPixels(0), i, 0);
16 | }
17 |
18 | texture2DArray.Apply();
19 | gameObject.GetComponent().sharedMaterial.SetTexture("_Textures", texture2DArray);
20 | }
21 | }
--------------------------------------------------------------------------------
/Nodes/Truchet/Texture2DArrayBehaviour.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7474ffb9155df4f4ab894a5202ebb041
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Nodes/Truchet/TruchetNodes.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using System;
3 | using UnityEditor.ShaderGraph;
4 | using System.Reflection;
5 | using UnityEditor.Graphing;
6 | using UnityEditor.ShaderGraph.Drawing.Controls;
7 | using UnityEngine;
8 |
9 |
10 | [Serializable]
11 | public enum TruchetMode {
12 | Square,
13 | Triangle,
14 | Hexagon
15 | }
16 |
17 | [Title("Truchet", "Truchet")]
18 | internal class TruchetNode : CodeFunctionNode {
19 | [SerializeField] private TruchetMode m_TruchetMode = TruchetMode.Square;
20 |
21 | public TruchetNode() {
22 | name = "Truchet";
23 | }
24 |
25 | private string GetCurrentModeName() {
26 | return Enum.GetName(typeof(TruchetMode), m_TruchetMode);
27 | }
28 |
29 | [EnumControl("Mode")]
30 | public TruchetMode truchetMode {
31 | get { return m_TruchetMode; }
32 | set {
33 | if (m_TruchetMode == value)
34 | return;
35 | m_TruchetMode = value;
36 | Dirty(ModificationScope.Graph);
37 | }
38 | }
39 |
40 | protected override MethodInfo GetFunctionToConvert() {
41 | return GetType().GetMethod(string.Format("Truchet_{0}", GetCurrentModeName()), BindingFlags.Static | BindingFlags.NonPublic);
42 | }
43 |
44 | static string Truchet_Hexagon([Slot(0, Binding.WorldSpacePosition)] Vector2 Position, [Slot(1, Binding.None, 0.25f, 0, 0, 0)]
45 | Vector1 Size, [Slot(2, Binding.None, 1, 0, 0, 0)] Vector1 Number, [Slot(3, Binding.None)] Vector1 Seed, [Slot(4, Binding.None)] CodeFunctionNode.Boolean Rotate, [Slot(5, Binding.None)] CodeFunctionNode.Boolean Reflect, [Slot(6, Binding.None)] out Vector1 Index, [Slot(7, Binding.None)] out Vector2 UV) {
46 | UV = Vector2.zero;
47 | return @"
48 | {
49 | const float3 Cos = float3(1, 0.5, -0.5);
50 | const float3 Sin = float3(0, 0.86602540378, 0.86602540378);
51 |
52 | const float2 a = float2(1, 0);
53 | const float2 b = float2(0.5, 0.86602540378);
54 |
55 | UV = 2 * Position / Size;
56 | float d = (a.x*b.y-a.y*b.x);
57 | float ta = (b.y*UV.x-b.x*UV.y)/d;
58 | float tb = (a.x*UV.y-a.y*UV.x)/d;
59 |
60 | float3 cell3 = floor(float3(ta, tb, frac(ta) +frac(tb)));
61 | float mod = cell3.x - cell3.y;
62 | mod = mod - 3 * floor(mod*0.33333333333);
63 | float2 cell = float2(cell3.x + (mod == 0 ? cell3.z : 0) + (mod == 2 ? 1 : 0), cell3.y + (mod == 0 ? cell3.z : 0) + (mod == 1 ? 1 : 0));
64 | float rand = frac(sin(dot(cell.xy + Seed, float2(12.9898,78.233))) * 43758.5453);
65 | float nRotation = Rotate ? 6 : 1;
66 | float nReflection = Reflect ? 2 : 1;
67 | float randInt = floor(rand * Number * nRotation * nReflection);
68 | Index = randInt % Number;
69 | randInt = floor(randInt / Number);
70 | float Rot = randInt % nRotation;
71 | randInt = floor(randInt / nRotation);
72 | float Refl = randInt % nReflection;
73 | UV = UV - a * cell.x - b*cell.y;
74 | UV.x = (1-2*Refl) * UV.x;
75 | UV = 0.5+ 0.5*(Rot >= 3 ? -1 : 1) * float2(UV.x*Cos[Rot%3] + UV.y *-Sin[Rot%3], UV.x*Sin[Rot%3] + UV.y *Cos[Rot%3]);
76 | }
77 | ";
78 | }
79 |
80 | static string Truchet_Square([Slot(0, Binding.WorldSpacePosition)] Vector2 Position, [Slot(1, Binding.None, 0.25f, 0, 0, 0)] Vector1 Size, [Slot(2, Binding.None, 1, 0, 0, 0)] Vector1 Number, [Slot(3, Binding.None)] Vector1 Seed, [Slot(4, Binding.None)] CodeFunctionNode.Boolean Rotate, [Slot(5, Binding.None)] CodeFunctionNode.Boolean Reflect, [Slot(6, Binding.None)] out Vector1 Index, [Slot(7, Binding.None)] out Vector2 UV) {
81 | UV = Vector2.zero;
82 | return @"
83 | {
84 | const float4 Cos = float4(1, 0, -1, 0);
85 | const float4 Sin = float4(0, 1, 0, -1);
86 | UV = Position / Size;
87 | float2 cell = floor(UV);
88 | float rand = frac(sin(dot(cell.xy + Seed, float2(12.9898,78.233))) * 43758.5453);
89 | float nRotation = Rotate ? 4 : 1;
90 | float nReflection = Reflect ? 2 : 1;
91 | float randInt = floor(rand * Number * nRotation * nReflection);
92 | Index = randInt % Number;
93 | randInt = floor(randInt / Number);
94 | float Rot = randInt % nRotation;
95 | randInt = floor(randInt / nRotation);
96 | float Refl = randInt % nReflection;
97 | UV = UV - cell - 0.5;
98 | UV.x = (1-2*Refl) * UV.x;
99 | UV = 0.5 + float2(UV.x*Cos[Rot] + UV.y *-Sin[Rot], UV.x*Sin[Rot] + UV.y *Cos[Rot]);
100 | }
101 | ";
102 | }
103 |
104 | static string Truchet_Triangle([Slot(0, Binding.WorldSpacePosition)] Vector2 Position, [Slot(1, Binding.None, 0.25f, 0, 0, 0)] Vector1 Size, [Slot(2, Binding.None, 1, 0, 0, 0)] Vector1 Number, [Slot(3, Binding.None)] Vector1 Seed, [Slot(4, Binding.None)] CodeFunctionNode.Boolean Rotate, [Slot(5, Binding.None)] CodeFunctionNode.Boolean Reflect, [Slot(6, Binding.None)] out Vector1 Index, [Slot(7, Binding.None)] out Vector2 UV) {
105 | UV = Vector2.zero;
106 | return @"
107 | {
108 | const float3 Cos = float3(1, 0.5, -0.5);
109 | const float3 Sin = float3(0, 0.86602540378, 0.86602540378);
110 |
111 | const float2 a = float2(1, 0);
112 | const float2 b = float2(0.5, 0.86602540378);
113 |
114 | UV = Position / Size;
115 | float d = (a.x*b.y-a.y*b.x);
116 | float ta = (b.y*UV.x-b.x*UV.y)/d;
117 | float tb = (a.x*UV.y-a.y*UV.x)/d;
118 |
119 | float3 cell = floor(float3(ta, tb, frac(ta) +frac(tb)));
120 | float rand = frac(sin(dot(cell + Seed, float3(12.9898,78.233, 45.652))) * 43758.5453);
121 | float nRotation = Rotate ? 3 : 1;
122 | float nReflection = Reflect ? 2 : 1;
123 | float randInt = floor(rand * Number * nRotation * nReflection);
124 | Index = randInt % Number;
125 | randInt = floor(randInt / Number);
126 | float Rot = cell.z + 2*(randInt % nRotation);
127 | randInt = floor(randInt / nRotation);
128 | float Refl = randInt % nReflection;
129 | UV = UV - a*(cell.x + 0.3333333333*(1 + cell.z)) - b*(cell.y + 0.3333333333*(1 + cell.z));
130 | UV.x = (1-2*Refl) * UV.x;
131 | UV = 1.73205080757*UV;
132 | UV = 0.5+ 0.5*(Rot >= 3 ? -1 : 1) * float2(UV.x*Cos[Rot%3] + UV.y *-Sin[Rot%3], UV.x*Sin[Rot%3] + UV.y *Cos[Rot%3]);
133 | }
134 | ";
135 | }
136 | }
137 | #endif
--------------------------------------------------------------------------------
/Nodes/Truchet/TruchetNodes.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8e736e92ff480ab499d7e7d53911309f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # shader-graph-nodes
2 |
3 | Custom Nodes for Unity Shader Graph, to be used in newer Unity versions with the SRP / URP / HDRP.\
4 | It uses CodeFunctionNode API, which was made internal in 2018.2, but is now accessible using
5 | [AsmRef](https://docs.unity.cn/2019.4/Documentation/Manual/class-AssemblyDefinitionReferenceImporter.html).
6 |
7 | **Requires Unity 2019.4 or higher.**\
8 | If you wish to use it in older versions, you'll need to remove .asmref file in Nodes folder.
9 |
10 | [SDF](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/SDF)
11 |
12 | 
13 |
14 | Signed distance functions for interesting procedural effects.
15 |
16 | [Truchet](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Truchet)
17 |
18 | 
19 |
20 | Truchet tiling nodes to make irregular patterns.
21 |
22 | [Composite](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Composite)
23 |
24 | 
25 |
26 | Complete set of Porter Duff transparency operations.
27 |
28 | [Halftone](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Halftone)
29 |
30 | 
31 |
32 | Halftone rendering, monochrome or color.
33 |
34 | [Lab Color](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Lab%20Color)
35 |
36 | 
37 |
38 | Manipulate colors in the perception-based color spaces.
39 |
40 | [Pattern](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Pattern)
41 |
42 | 
43 |
44 | Procedural geometric patterns.
45 |
46 | [Pixel Perfect](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Pixel%20Perfect)
47 |
48 | 
49 |
50 | Pixel-wide primitives, no matter what the surface.
51 |
52 | [Complex](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Complex)
53 |
54 | 
55 |
56 | Do complex arithmetic in shader graph.
57 |
58 | [Quaternion](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Quaternion)
59 |
60 | 
61 |
62 | Quaternion algebra for rotation calculations in the graph.
63 |
64 | [Symmetry](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Symmetry)
65 |
66 | Reflection, rotation and tiling symmetry nodes.
67 |
68 | [Random](https://github.com/gilescoope/shader-graph-nodes/tree/master/Nodes/Random)
69 |
70 | Generate pseudorandom vectors, colors and quaternions.
71 |
--------------------------------------------------------------------------------