From 0ad1cd59d8cefa1d8303174b272e05fdc12f9bf6 Mon Sep 17 00:00:00 2001 From: max Date: Wed, 3 Feb 2021 22:13:59 +0100 Subject: [PATCH] Switched to Houdini vector packing --- Runtime/Scripts/ModelBaker/AnimationBaker.cs | 2 +- Runtime/Scripts/ModelBaker/VectorUtils.cs | 93 +++++- Runtime/Shaders/Graphs/Lit.ShaderGraph | 274 ++++++++---------- .../Shaders/HLSL/VectorEncodingDecoding.hlsl | 106 +++---- Runtime/Shaders/HLSL/VertexAnimation.hlsl | 4 +- Runtime/Shaders/SubGraphs/VA.shadersubgraph | 88 ++---- .../Shaders/SubGraphs/VA_ARRAY.shadersubgraph | 68 ++--- .../DecodeVector1ToVector3.shadersubgraph | 6 +- 8 files changed, 335 insertions(+), 306 deletions(-) diff --git a/Runtime/Scripts/ModelBaker/AnimationBaker.cs b/Runtime/Scripts/ModelBaker/AnimationBaker.cs index 86a98fb..0d84ba0 100644 --- a/Runtime/Scripts/ModelBaker/AnimationBaker.cs +++ b/Runtime/Scripts/ModelBaker/AnimationBaker.cs @@ -151,7 +151,7 @@ namespace TAO.VertexAnimation { positionMap.SetPixel(x, y, new Color(verts[v].x, verts[v].y, verts[v].z, - VectorUtils.Float3ToFloat(normals[v])) + VectorUtils.EncodeFloat3ToFloat1(normals[v])) ); x++; diff --git a/Runtime/Scripts/ModelBaker/VectorUtils.cs b/Runtime/Scripts/ModelBaker/VectorUtils.cs index 09fa5fe..a6bf540 100644 --- a/Runtime/Scripts/ModelBaker/VectorUtils.cs +++ b/Runtime/Scripts/ModelBaker/VectorUtils.cs @@ -4,9 +4,11 @@ namespace TAO.VertexAnimation { public static class VectorUtils { + #region Custom Packing + // Encode. public static Vector2 Float3ToFloat2(this Vector3 f3) { - Vector3 rotation = Vector3.Normalize(new Vector3(f3.x, 0, f3.z)); + Vector3 rotation = Vector3.Normalize(new Vector3(f3.x, 0, f3.y)); Vector2 f2 = new Vector2(); f2.x = Mathf.Acos(Vector3.Dot(rotation, new Vector3(1, 0, 0))) * Mathf.Sign(f3.z); @@ -30,5 +32,94 @@ namespace TAO.VertexAnimation { return Float2ToFloat(Float3ToFloat2(f3)); } + + // Decode. + public static Vector2 FloatToFloat2(float f1) + { + f1 *= 256; + + Vector2 f2; + f2.x = (f1 % 16) / 15; + f2.y = ((f1 / 256) * 16); + f2.y = Mathf.Floor(f2.y) / 15; + + return f2; + } + + public static Vector3 Float2ToFloat3(Vector2 f2) + { + float dist = 1 - Mathf.Abs((f2.y - 0.5f) * 2); + float temp = (f2.x * (Mathf.PI * 2)) - Mathf.PI; + + Vector3 f3; + f3.x = Mathf.Sin(temp + (Mathf.PI * 2)) * dist; + f3.z = Mathf.Cos((temp - Mathf.PI) + (Mathf.PI * 2)) * dist; + + f3.y = (f2.y - 0.5f) * -2; + + f3 = f3.normalized; + + return f3; + } + + public static Vector3 FloatToFloat3(float f1) + { + return Float2ToFloat3(FloatToFloat2(f1)); + } + #endregion + + #region Houdini Style Packing + // Encode. + public static float EncodeFloat3ToFloat1(Vector3 f3) + { + float f1; + + float z = Mathf.Sqrt(f3.z * 8 + 8); + float y = (f3.y / z + 0.5f) * 31; + float x = Mathf.Floor((f3.x / z + 0.5f) * 31) * 32; + f1 = (x + y) / 1023; + + return f1; + } + + // Decode. + public static Vector2 DecodeFloat1ToFloat2(float f1) + { + Vector2 f2; + + f1 *= 1024; + f2.x = Mathf.Floor(f1 / 32.0f) / 31.5f; + f2.y = (f1 - (Mathf.Floor(f1 / 32.0f) * 32.0f)) / 31.5f; + + return f2; + } + + public static Vector3 DecodeFloat2ToFloat3(Vector2 f2) + { + Vector3 f3; + + f2 *= 4; + f2.x -= 2; + f2.y -= 2; + + float f2dot = Vector3.Dot(f2, f2); + + f3.x = Mathf.Sqrt(1 - (f2dot / 4.0f)) * f2.x; + f3.y = Mathf.Sqrt(1 - (f2dot / 4.0f)) * f2.y; + f3.z = 1 - (f2dot / 2.0f); + + //f3.x = Mathf.Clamp(f3.x, -1.0f, 1.0f); + //f3.y = Mathf.Clamp(f3.x, -1.0f, 1.0f); + //f3.z = Mathf.Clamp(f3.x, -1.0f, 1.0f); + f3 = Vector3.ClampMagnitude(f3, 1); + + return f3; + } + + public static Vector3 DecodeFloat1ToFloat3(float f1) + { + return DecodeFloat2ToFloat3(DecodeFloat1ToFloat2(f1)); + } + #endregion } } \ No newline at end of file diff --git a/Runtime/Shaders/Graphs/Lit.ShaderGraph b/Runtime/Shaders/Graphs/Lit.ShaderGraph index f29dfa1..b8d69cd 100644 --- a/Runtime/Shaders/Graphs/Lit.ShaderGraph +++ b/Runtime/Shaders/Graphs/Lit.ShaderGraph @@ -178,9 +178,6 @@ { "m_Id": "c47cc0596567412d88b52ea0fa261628" }, - { - "m_Id": "78836319debc4bd88eaaa22e16d981cd" - }, { "m_Id": "155b2a79aff0451982bb11fd968560d5" }, @@ -219,6 +216,9 @@ }, { "m_Id": "bf6a6ccd714c4a999ee308d087095428" + }, + { + "m_Id": "4177ee1cab5b432b94f24cad8c3cafb0" } ], "m_GroupDatas": [ @@ -307,9 +307,9 @@ }, "m_InputSlot": { "m_Node": { - "m_Id": "78836319debc4bd88eaaa22e16d981cd" + "m_Id": "4177ee1cab5b432b94f24cad8c3cafb0" }, - "m_SlotId": 654627568 + "m_SlotId": 1192378022 } }, { @@ -368,6 +368,20 @@ "m_SlotId": 0 } }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "4177ee1cab5b432b94f24cad8c3cafb0" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c849f13f567b40d3958127703bf029e0" + }, + "m_SlotId": 1 + } + }, { "m_OutputSlot": { "m_Node": { @@ -578,20 +592,6 @@ "m_SlotId": 2 } }, - { - "m_OutputSlot": { - "m_Node": { - "m_Id": "78836319debc4bd88eaaa22e16d981cd" - }, - "m_SlotId": 1 - }, - "m_InputSlot": { - "m_Node": { - "m_Id": "c849f13f567b40d3958127703bf029e0" - }, - "m_SlotId": 1 - } - }, { "m_OutputSlot": { "m_Node": { @@ -1301,9 +1301,9 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -1833.9998779296875, - "y": 814.9999389648438, - "width": 165.0, + "x": -1802.0, + "y": 815.0, + "width": 159.0, "height": 34.0 } }, @@ -1443,10 +1443,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -1805.0, - "y": -212.0, - "width": 239.99998474121095, - "height": 398.0 + "x": -1782.0, + "y": -213.00001525878907, + "width": 240.00001525878907, + "height": 398.0000305175781 } }, "m_Slots": [ @@ -1472,7 +1472,7 @@ "m_Id": "2054d1ea961d498e81aa28ce02f6f4b8" }, { - "m_Id": "5e78cda84b034004945d34da219c9a6b" + "m_Id": "5e7c8686ec53471ca1d3d2b523b75a19" } ], "synonyms": [], @@ -1824,6 +1824,21 @@ "m_Value": false } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "284c9f5598ee4145938bd61ffab50baa", + "m_Id": 1192378022, + "m_DisplayName": "Vector1", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Vector1_c7aa86a194644e57b07408803b64ebd7", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", @@ -2048,9 +2063,9 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -1237.9998779296875, - "y": 744.9999389648438, - "width": 172.0, + "x": -1237.0, + "y": 753.0, + "width": 171.99998474121095, "height": 142.0 } }, @@ -2183,6 +2198,47 @@ ] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SubGraphNode", + "m_ObjectId": "4177ee1cab5b432b94f24cad8c3cafb0", + "m_Group": { + "m_Id": "" + }, + "m_Name": "DecodeVector1ToVector3", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1518.0, + "y": -148.00001525878907, + "width": 208.0, + "height": 278.0 + } + }, + "m_Slots": [ + { + "m_Id": "284c9f5598ee4145938bd61ffab50baa" + }, + { + "m_Id": "e78abbe7b9df407ea285f6a0b2b764db" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedSubGraph": "{\n \"subGraph\": {\n \"fileID\": -5475051401550479605,\n \"guid\": \"7f3356cfbf53f3741b12d5aa82ff460a\",\n \"type\": 3\n }\n}", + "m_PropertyGuids": [ + "9bf172a7-cce3-4c15-b3c5-10db50121814" + ], + "m_PropertyIds": [ + 1192378022 + ] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", @@ -2836,29 +2892,17 @@ { "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", - "m_ObjectId": "5e78cda84b034004945d34da219c9a6b", + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "5e7c8686ec53471ca1d3d2b523b75a19", "m_Id": 2, "m_DisplayName": "Alpha", "m_SlotType": 1, "m_Hidden": false, "m_ShaderOutputName": "Alpha", "m_StageCapability": 3, - "m_Value": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_DefaultValue": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_Labels": [ - "X", - "Y", - "Z" - ] + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] } { @@ -2989,9 +3033,9 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -1980.0, - "y": -172.00003051757813, - "width": 157.99998474121095, + "x": -1957.0, + "y": -173.00001525878907, + "width": 158.0, "height": 34.0 } }, @@ -3114,10 +3158,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -1872.9998779296875, - "y": 860.9999389648438, + "x": -1850.0, + "y": 864.0, "width": 208.0, - "height": 126.99999237060547 + "height": 127.00000762939453 } }, "m_Slots": [ @@ -3356,47 +3400,6 @@ "m_SerializedDescriptor": "SurfaceDescription.NormalTS" } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.SubGraphNode", - "m_ObjectId": "78836319debc4bd88eaaa22e16d981cd", - "m_Group": { - "m_Id": "" - }, - "m_Name": "DecodeFloatToFloat3", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": -1542.0, - "y": -147.00001525878907, - "width": 208.0, - "height": 278.0 - } - }, - "m_Slots": [ - { - "m_Id": "d39aa5bc230343b8871723ace888b86b" - }, - { - "m_Id": "c948b5b786944569bdc898f9537e0589" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_SerializedSubGraph": "{\n \"subGraph\": {\n \"fileID\": -5475051401550479605,\n \"guid\": \"18ce5782075ebe745a6c31bffe3ff85e\",\n \"type\": 3\n }\n}", - "m_PropertyGuids": [ - "000a9ca6-880e-4eee-a436-af6921fc25b8" - ], - "m_PropertyIds": [ - 654627568 - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", @@ -4136,9 +4139,9 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -1420.999755859375, - "y": 743.9999389648438, - "width": 118.99999237060547, + "x": -1380.0, + "y": 753.0, + "width": 119.0, "height": 77.0 } }, @@ -4594,8 +4597,8 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -1960.0, - "y": -76.00001525878906, + "x": -1937.0, + "y": -77.0, "width": 136.0, "height": 34.0 } @@ -4692,9 +4695,9 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -2136.0, - "y": -188.0, - "width": 144.99998474121095, + "x": -2113.0, + "y": -189.00001525878907, + "width": 145.0, "height": 130.0 } }, @@ -4824,33 +4827,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", - "m_ObjectId": "c948b5b786944569bdc898f9537e0589", - "m_Id": 1, - "m_DisplayName": "Vector3", - "m_SlotType": 1, - "m_Hidden": false, - "m_ShaderOutputName": "Vector3", - "m_StageCapability": 3, - "m_Value": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_DefaultValue": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_Labels": [ - "X", - "Y", - "Z" - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", @@ -5163,23 +5139,6 @@ "m_DefaultType": 0 } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", - "m_ObjectId": "d39aa5bc230343b8871723ace888b86b", - "m_Id": 654627568, - "m_DisplayName": "Vector1", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "Vector1_771ac3b08a1144b086078a0d07c220da", - "m_StageCapability": 3, - "m_Value": 0.23919999599456788, - "m_DefaultValue": 0.0, - "m_Labels": [ - "X" - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", @@ -5736,6 +5695,29 @@ "m_Labels": [] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "e78abbe7b9df407ea285f6a0b2b764db", + "m_Id": 1, + "m_DisplayName": "Vector3", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Vector3", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", diff --git a/Runtime/Shaders/HLSL/VectorEncodingDecoding.hlsl b/Runtime/Shaders/HLSL/VectorEncodingDecoding.hlsl index bc47907..49a2d10 100644 --- a/Runtime/Shaders/HLSL/VectorEncodingDecoding.hlsl +++ b/Runtime/Shaders/HLSL/VectorEncodingDecoding.hlsl @@ -6,62 +6,17 @@ #define V_TWO_PI 6.28318530718f #define V_HALF_PI 1.57079632679f -void EncodeFloat3ToFloat1_float(float3 f3, out float f1) -{ - float z = sqrt(f3.z * 8 + 8); - float y = (f3.y / z + 0.5f) * 31; - float x = floor((f3.x / z + 0.5f) * 31) * 32; - f1 = (x + y) / 1023; -} - -void DecodeFloat1ToFloat2_float(float f1, out float2 f2) -{ - f1 *= 1024; - f2.x = floor(f1 / 32.0) / 31.5; - f2.y = (f1 - (floor(f1 / 32.0) * 32.0)) / 31.5; -} - -void DecodeFloat2ToFloat3_float(float f2, out float3 f3) -{ - f2 *= 4; - f2 -= 2; - float f2dot = dot(f2, f2); - f3.xy = sqrt(1 - (f2dot / 4.0)) * f2; - f3.z = 1 - (f2dot / 2.0); - f3 = clamp(f3, -1.0, 1.0); -} - -void DecodeFloat1ToFloat3_float(float f1, out float3 f3) -{ - float2 f2; - DecodeFloat1ToFloat2_float(f1, f2); - DecodeFloat2ToFloat3_float(f2, f3); -} - -// Ref: -// https://answers.unity.com/questions/733677/cg-shader-float3-to-float-packunpack-functions.html -// http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ -void Encode2Float3ToFloat1_float(float3 f3, out float f1) -{ - f1 = (dot(round((f3) * 255), float3(65536, 256, 1))); -} - -void Decode2Float1ToFloat3_float(float f1, out float3 f3) -{ - f3 = (frac((f1) / float3(16777216, 65536, 256))); -} - -// Custom +// Custom Packing. // Encode float3 to 0..1 float. void Float3ToFloat2_float(float3 f3, out float2 f2) { //float3 rotation = normalize(float3(f3.x, 0, f3.y)); float3 rotation = normalize(float3(f3.x, 0, f3.z)); - f2.x = acos (dot(rotation, float3(1, 0, 0))) * sign(f3.z); + f2.x = acos(dot(rotation, float3(1, 0, 0))) * sign(f3.z); f2.x = ((f2.x / V_PI) + 1) * 0.5f; - - f2.y = acos(f3.y) / V_PI; + + f2.y = acos(f3.y) / V_PI; f2 *= 15; f2.x = round(f2.x); @@ -94,12 +49,12 @@ void Float2ToFloat3_float(float2 f2, out float3 f3) { float dist = 1 - abs((f2.y - 0.5f) * 2); float temp = (f2.x * V_TWO_PI) - V_PI; - + f3.x = sin(temp + V_TWO_PI) * dist; f3.z = cos((temp - V_PI) + V_TWO_PI) * dist; f3.y = (f2.y - 0.5f) * -2; - + f3 = normalize(f3); } @@ -110,4 +65,53 @@ void FloatToFloat3_float(float f1, out float3 f3) Float2ToFloat3_float(f2, f3); } +// Houdini Style Packing. +// Encode. +void EncodeFloat3ToFloat1_float(float3 f3, out float f1) +{ + float z = sqrt(f3.z * 8 + 8); + float y = (f3.y / z + 0.5f) * 31; + float x = floor((f3.x / z + 0.5f) * 31) * 32; + f1 = (x + y) / 1023; +} + +// Decode. +void DecodeFloat1ToFloat2_float(float f1, out float2 f2) +{ + f1 *= 1024; + f2.x = floor(f1 / 32.0) / 31.5; + f2.y = (f1 - (floor(f1 / 32.0) * 32.0)) / 31.5; +} + +void DecodeFloat2ToFloat3_float(float2 f2, out float3 f3) +{ + f2 *= 4; + f2 -= 2; + float f2dot = dot(f2, f2); + f3.xy = sqrt(1 - (f2dot / 4.0)) * f2; + f3.z = 1 - (f2dot / 2.0); + f3 = clamp(f3, -1.0, 1.0); +} + +void DecodeFloat1ToFloat3_float(float f1, out float3 f3) +{ + float2 f2; + DecodeFloat1ToFloat2_float(f1, f2); + DecodeFloat2ToFloat3_float(f2, f3); +} + +// Test Packing. +// Ref: +// https://answers.unity.com/questions/733677/cg-shader-float3-to-float-packunpack-functions.html +// http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ +void Encode2Float3ToFloat1_float(float3 f3, out float f1) +{ + f1 = (dot(round((f3) * 255), float3(65536, 256, 1))); +} + +void Decode2Float1ToFloat3_float(float f1, out float3 f3) +{ + f3 = (frac((f1) / float3(16777216, 65536, 256))); +} + #endif \ No newline at end of file diff --git a/Runtime/Shaders/HLSL/VertexAnimation.hlsl b/Runtime/Shaders/HLSL/VertexAnimation.hlsl index f07add3..5cfece6 100644 --- a/Runtime/Shaders/HLSL/VertexAnimation.hlsl +++ b/Runtime/Shaders/HLSL/VertexAnimation.hlsl @@ -25,7 +25,7 @@ float2 VA_UV_float(float2 uv, int maxFrames, float time) } void VA_float(float2 uv, SamplerState texSampler, Texture2D positionMap, float time, int maxFrames, - out float3 position, out float3 alpha) + out float3 position, out float alpha) { float2 uvPosition = VA_UV_float(uv, maxFrames, time); @@ -39,7 +39,7 @@ void VA_float(float2 uv, SamplerState texSampler, Texture2D positionMap, float t } void VA_ARRAY_float(float2 uv, SamplerState texSampler, Texture2DArray positionMap, float positionMapIndex, float time, int maxFrames, - out float3 position, out float3 alpha) + out float3 position, out float alpha) { float2 uvPosition = VA_UV_float(uv, maxFrames, time); diff --git a/Runtime/Shaders/SubGraphs/VA.shadersubgraph b/Runtime/Shaders/SubGraphs/VA.shadersubgraph index 8033f1d..178b714 100644 --- a/Runtime/Shaders/SubGraphs/VA.shadersubgraph +++ b/Runtime/Shaders/SubGraphs/VA.shadersubgraph @@ -196,7 +196,7 @@ "m_Id": "b89a68670a6642e19ae1063415132848" }, { - "m_Id": "68e1750097114f2d9801fda29c1a4a1a" + "m_Id": "55359b5ca883410595a9cc7689b25421" } ], "synonyms": [], @@ -340,6 +340,21 @@ "m_StageCapability": 3 } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "55359b5ca883410595a9cc7689b25421", + "m_Id": 2, + "m_DisplayName": "Alpha", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Alpha", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.PropertyNode", @@ -374,33 +389,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", - "m_ObjectId": "68e1750097114f2d9801fda29c1a4a1a", - "m_Id": 2, - "m_DisplayName": "Alpha", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "Alpha", - "m_StageCapability": 3, - "m_Value": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_DefaultValue": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_Labels": [ - "X", - "Y", - "Z" - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", @@ -463,7 +451,7 @@ "m_Id": "f08b7a93deeb46548e0a57309906d22a" }, { - "m_Id": "f3afc10b499a42c4bbcd332b713c9635" + "m_Id": "fe7d42cad1e74435a269788bd8805aab" } ], "synonyms": [], @@ -759,33 +747,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", - "m_ObjectId": "f3afc10b499a42c4bbcd332b713c9635", - "m_Id": 10, - "m_DisplayName": "alpha", - "m_SlotType": 1, - "m_Hidden": false, - "m_ShaderOutputName": "alpha", - "m_StageCapability": 3, - "m_Value": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_DefaultValue": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_Labels": [ - "X", - "Y", - "Z" - ] -} - { "m_SGVersion": 1, "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", @@ -809,6 +770,21 @@ } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "fe7d42cad1e74435a269788bd8805aab", + "m_Id": 10, + "m_DisplayName": "alpha", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "alpha", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", diff --git a/Runtime/Shaders/SubGraphs/VA_ARRAY.shadersubgraph b/Runtime/Shaders/SubGraphs/VA_ARRAY.shadersubgraph index 9a56504..ea74693 100644 --- a/Runtime/Shaders/SubGraphs/VA_ARRAY.shadersubgraph +++ b/Runtime/Shaders/SubGraphs/VA_ARRAY.shadersubgraph @@ -216,7 +216,7 @@ "m_Id": "b89a68670a6642e19ae1063415132848" }, { - "m_Id": "7106fc4a9e6e4a0a8bdd678ceb7f4f1c" + "m_Id": "5c5241600e5b40d998b82d09856f71a9" } ], "synonyms": [], @@ -356,29 +356,17 @@ { "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", - "m_ObjectId": "7106fc4a9e6e4a0a8bdd678ceb7f4f1c", + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "5c5241600e5b40d998b82d09856f71a9", "m_Id": 2, "m_DisplayName": "Alpha", "m_SlotType": 0, "m_Hidden": false, "m_ShaderOutputName": "Alpha", "m_StageCapability": 3, - "m_Value": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_DefaultValue": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_Labels": [ - "X", - "Y", - "Z" - ] + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] } { @@ -405,6 +393,21 @@ ] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "7fcf2701605d41ac92b93ad9bffa69f0", + "m_Id": 10, + "m_DisplayName": "alpha", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "alpha", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", @@ -446,7 +449,7 @@ "m_Id": "c2b10d98649f477bb79b359db258f55a" }, { - "m_Id": "c1454b74eac5469eb14d403b66a8283a" + "m_Id": "7fcf2701605d41ac92b93ad9bffa69f0" } ], "synonyms": [], @@ -663,33 +666,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", - "m_ObjectId": "c1454b74eac5469eb14d403b66a8283a", - "m_Id": 10, - "m_DisplayName": "alpha", - "m_SlotType": 1, - "m_Hidden": false, - "m_ShaderOutputName": "alpha", - "m_StageCapability": 3, - "m_Value": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_DefaultValue": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_Labels": [ - "X", - "Y", - "Z" - ] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", diff --git a/Runtime/Shaders/SubGraphs/VectorEncodingDecoding/DecodeVector1ToVector3.shadersubgraph b/Runtime/Shaders/SubGraphs/VectorEncodingDecoding/DecodeVector1ToVector3.shadersubgraph index cb968bc..693f90b 100644 --- a/Runtime/Shaders/SubGraphs/VectorEncodingDecoding/DecodeVector1ToVector3.shadersubgraph +++ b/Runtime/Shaders/SubGraphs/VectorEncodingDecoding/DecodeVector1ToVector3.shadersubgraph @@ -194,7 +194,7 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -803.0, + "x": -762.0, "y": 38.0, "width": 115.0, "height": 34.0 @@ -251,8 +251,8 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -669.0, - "y": -1.0, + "x": -628.0, + "y": -2.0, "width": 142.0, "height": 94.0 }