From 6a92f38064981ea5153f14ec46ba95ca895fdfd1 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 27 Feb 2025 19:55:24 +0900 Subject: [PATCH] _ShadingShiftFactor --- .../Assets/TinyMToonAlphaBlend.shadergraph | 126 +++++++- .../Assets/TinyMToonOpaque.shadergraph | 134 +++++++- .../Assets/TinyMToon_SubGraph.shadersubgraph | 296 ++++++++++++++++-- .../VRM10Viewer/TinyMToonMaterialContext.cs | 6 + .../VRM10Viewer/TinyMToonMaterialImporter.cs | 1 + .../VRM10Viewer/VRM10VisualPrimitive.cs | 4 +- 6 files changed, 526 insertions(+), 41 deletions(-) diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToonAlphaBlend.shadergraph b/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToonAlphaBlend.shadergraph index 146731b20..beef056c3 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToonAlphaBlend.shadergraph +++ b/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToonAlphaBlend.shadergraph @@ -17,6 +17,9 @@ }, { "m_Id": "025d73c9fe2e47b3853bf9a00d126af4" + }, + { + "m_Id": "245594752a2f40a9a0b592ea1d772667" } ], "m_Keywords": [], @@ -59,6 +62,9 @@ }, { "m_Id": "df96d56bdf664324a1b96c21e76b4a17" + }, + { + "m_Id": "9e996b1a054f4a0caf78c639f3d104ac" } ], "m_GroupDatas": [], @@ -134,6 +140,20 @@ "m_SlotId": 2016068918 } }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9e996b1a054f4a0caf78c639f3d104ac" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "0776e82cf5bc4372962108bf3847d1d0" + }, + "m_SlotId": 592166105 + } + }, { "m_OutputSlot": { "m_Node": { @@ -362,6 +382,9 @@ { "m_Id": "ead31769aa464a4e8aae7a3cfa026b2c" }, + { + "m_Id": "5fe8cab7980244fcaefd3eaf8f1b4057" + }, { "m_Id": "e6c1845b1ff7420192f4e36917f71689" }, @@ -383,14 +406,16 @@ "d2495ca0-f5eb-484a-bd18-dca0589774e3", "916faab9-cc1c-4621-84b8-9c47171bf8e8", "ad5cc3fe-a5f8-4a48-9956-35d13519f07e", - "fa354438-5a66-4424-a53f-da950e75c488" + "fa354438-5a66-4424-a53f-da950e75c488", + "d3263a66-e96d-45f6-bbbd-9b3869d2008d" ], "m_PropertyIds": [ 1340748427, -643094866, 2016068918, 1221667242, - -1559276299 + -1559276299, + 592166105 ], "m_Dropdowns": [], "m_DropdownSelectedEntries": [] @@ -432,6 +457,34 @@ } } +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "245594752a2f40a9a0b592ea1d772667", + "m_Guid": { + "m_GuidSerialized": "8664794b-d0c4-43d3-831d-d05580ae7250" + }, + "m_Name": "ShadingShiftFactor", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "ShadingShiftFactor", + "m_DefaultReferenceName": "_ShadingShiftFactor", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", @@ -629,6 +682,21 @@ "m_DefaultType": 0 } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "5fe8cab7980244fcaefd3eaf8f1b4057", + "m_Id": 592166105, + "m_DisplayName": "ShadingShiftFactor", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_ShadingShiftFactor", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", @@ -716,6 +784,9 @@ }, { "m_Id": "025d73c9fe2e47b3853bf9a00d126af4" + }, + { + "m_Id": "245594752a2f40a9a0b592ea1d772667" } ] } @@ -846,6 +917,57 @@ } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "9e996b1a054f4a0caf78c639f3d104ac", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -16.0, + "y": 258.0, + "width": 176.66668701171876, + "height": 36.0 + } + }, + "m_Slots": [ + { + "m_Id": "ac0a28cfdb9d4ec78f68744c66110f8d" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "245594752a2f40a9a0b592ea1d772667" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "ac0a28cfdb9d4ec78f68744c66110f8d", + "m_Id": 0, + "m_DisplayName": "ShadingShiftFactor", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.PropertyNode", diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToonOpaque.shadergraph b/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToonOpaque.shadergraph index 6bcdfb896..8ae490825 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToonOpaque.shadergraph +++ b/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToonOpaque.shadergraph @@ -23,6 +23,9 @@ }, { "m_Id": "d39873e6759a47c2a923dde640e6f4f6" + }, + { + "m_Id": "f0d45de1f0c94cd794a750a329950f35" } ], "m_Keywords": [], @@ -77,6 +80,9 @@ }, { "m_Id": "9096c7ad43b94e54b6b3240398f1dab5" + }, + { + "m_Id": "2f23a09054324cf1aaa3cf24eb9c7df9" } ], "m_GroupDatas": [], @@ -152,6 +158,20 @@ "m_SlotId": -1559276299 } }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2f23a09054324cf1aaa3cf24eb9c7df9" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "0776e82cf5bc4372962108bf3847d1d0" + }, + "m_SlotId": 592166105 + } + }, { "m_OutputSlot": { "m_Node": { @@ -437,10 +457,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": 240.66665649414063, - "y": 95.33334350585938, - "width": 265.3334045410156, - "height": 377.3332824707031 + "x": 231.33335876464845, + "y": 77.33333587646485, + "width": 265.33331298828127, + "height": 401.33331298828127 } }, "m_Slots": [ @@ -459,6 +479,9 @@ { "m_Id": "ead31769aa464a4e8aae7a3cfa026b2c" }, + { + "m_Id": "7392f5e248684e5c93520870021f5631" + }, { "m_Id": "7207d851d0d54d9dbec558d8350cbcf5" }, @@ -480,14 +503,16 @@ "d2495ca0-f5eb-484a-bd18-dca0589774e3", "916faab9-cc1c-4621-84b8-9c47171bf8e8", "ad5cc3fe-a5f8-4a48-9956-35d13519f07e", - "fa354438-5a66-4424-a53f-da950e75c488" + "fa354438-5a66-4424-a53f-da950e75c488", + "d3263a66-e96d-45f6-bbbd-9b3869d2008d" ], "m_PropertyIds": [ 1340748427, -643094866, 2016068918, 1221667242, - -1559276299 + -1559276299, + 592166105 ], "m_Dropdowns": [], "m_DropdownSelectedEntries": [] @@ -594,6 +619,42 @@ "m_Labels": [] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "2f23a09054324cf1aaa3cf24eb9c7df9", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -16.0, + "y": 258.0, + "width": 176.6666717529297, + "height": 36.00006103515625 + } + }, + "m_Slots": [ + { + "m_Id": "d053c162e1e64e7b8ff3f91b45ecc824" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "f0d45de1f0c94cd794a750a329950f35" + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", @@ -875,6 +936,21 @@ "m_Labels": [] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "7392f5e248684e5c93520870021f5631", + "m_Id": 592166105, + "m_DisplayName": "ShadingShiftFactor", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_ShadingShiftFactor", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", @@ -953,6 +1029,9 @@ }, { "m_Id": "d39873e6759a47c2a923dde640e6f4f6" + }, + { + "m_Id": "f0d45de1f0c94cd794a750a329950f35" } ] } @@ -1373,6 +1452,21 @@ "m_ObjectId": "cd81c525151142c89a6af7f574fd628b" } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d053c162e1e64e7b8ff3f91b45ecc824", + "m_Id": 0, + "m_DisplayName": "ShadingShiftFactor", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", @@ -1533,6 +1627,34 @@ "m_Labels": [] } +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "f0d45de1f0c94cd794a750a329950f35", + "m_Guid": { + "m_GuidSerialized": "d7b412ec-0586-4bd1-ad66-16ccf23249fb" + }, + "m_Name": "ShadingShiftFactor", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "ShadingShiftFactor", + "m_DefaultReferenceName": "_ShadingShiftFactor", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToon_SubGraph.shadersubgraph b/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToon_SubGraph.shadersubgraph index 462a1b670..55e89168d 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToon_SubGraph.shadersubgraph +++ b/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyMToon_SubGraph.shadersubgraph @@ -17,6 +17,9 @@ }, { "m_Id": "22a4bb49b85e452a8db5595bcbeb91c5" + }, + { + "m_Id": "7e09a1dd20fa45cfb744461ff4274fe3" } ], "m_Keywords": [], @@ -86,6 +89,12 @@ }, { "m_Id": "4efbc3bbf016413e94e4c9ac65dd4789" + }, + { + "m_Id": "564e3bc994554c0895bbd2cba3c0915d" + }, + { + "m_Id": "e97ebd89b37649bbbbb6bce779b31161" } ], "m_GroupDatas": [], @@ -100,21 +109,7 @@ }, "m_InputSlot": { "m_Node": { - "m_Id": "9e8ee3e30f75499087e513eaac81b463" - }, - "m_SlotId": 1 - } - }, - { - "m_OutputSlot": { - "m_Node": { - "m_Id": "193173a2eded42af802f4085a1ba700a" - }, - "m_SlotId": 0 - }, - "m_InputSlot": { - "m_Node": { - "m_Id": "ac0d7130cca947dfa64b9b4e4869b270" + "m_Id": "564e3bc994554c0895bbd2cba3c0915d" }, "m_SlotId": 0 } @@ -175,6 +170,34 @@ "m_SlotId": 0 } }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "564e3bc994554c0895bbd2cba3c0915d" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9e8ee3e30f75499087e513eaac81b463" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "564e3bc994554c0895bbd2cba3c0915d" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "ac0d7130cca947dfa64b9b4e4869b270" + }, + "m_SlotId": 0 + } + }, { "m_OutputSlot": { "m_Node": { @@ -399,6 +422,20 @@ "m_SlotId": 1 } }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e97ebd89b37649bbbbb6bce779b31161" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "564e3bc994554c0895bbd2cba3c0915d" + }, + "m_SlotId": 1 + } + }, { "m_OutputSlot": { "m_Node": { @@ -591,10 +628,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -241.3332977294922, - "y": 66.00003051757813, - "width": 185.33326721191407, - "height": 36.000022888183597 + "x": -352.0, + "y": 290.6667175292969, + "width": 185.33334350585938, + "height": 35.999969482421878 } }, "m_Slots": [ @@ -919,6 +956,30 @@ "m_Labels": [] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "365fece80463494f884dfba1ea141896", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", @@ -979,10 +1040,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -241.3332977294922, - "y": -6.000007152557373, - "width": 148.66659545898438, - "height": 36.00001907348633 + "x": -240.6666717529297, + "y": -167.99998474121095, + "width": 148.6666717529297, + "height": 36.0 } }, "m_Slots": [ @@ -1250,10 +1311,56 @@ }, { "m_Id": "22a4bb49b85e452a8db5595bcbeb91c5" + }, + { + "m_Id": "7e09a1dd20fa45cfb744461ff4274fe3" } ] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.AddNode", + "m_ObjectId": "564e3bc994554c0895bbd2cba3c0915d", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Add", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -131.99998474121095, + "y": 266.6667175292969, + "width": 127.33331298828125, + "height": 120.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "365fece80463494f884dfba1ea141896" + }, + { + "m_Id": "9809a78c448345959ba93247b69dd7bc" + }, + { + "m_Id": "d43d943ea3ac4cf3955a6aff64035bcc" + } + ], + "synonyms": [ + "addition", + "sum", + "plus" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", @@ -1535,6 +1642,34 @@ "m_Labels": [] } +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "7e09a1dd20fa45cfb744461ff4274fe3", + "m_Guid": { + "m_GuidSerialized": "d3263a66-e96d-45f6-bbbd-9b3869d2008d" + }, + "m_Name": "ShadingShiftFactor", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "ShadingShiftFactor", + "m_DefaultReferenceName": "_ShadingShiftFactor", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", @@ -1717,6 +1852,30 @@ "m_Labels": [] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "9809a78c448345959ba93247b69dd7bc", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", @@ -1890,10 +2049,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": 38.66663360595703, - "y": 242.66673278808595, - "width": 129.3333740234375, - "height": 95.99998474121094 + "x": 38.666690826416019, + "y": 194.66668701171876, + "width": 129.33331298828126, + "height": 96.00003051757813 } }, "m_Slots": [ @@ -2144,6 +2303,21 @@ } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "c586599eb94844e8852ace67749001b7", + "m_Id": 0, + "m_DisplayName": "ShadingShiftFactor", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.MainLightDirectionNode", @@ -2349,6 +2523,30 @@ } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d43d943ea3ac4cf3955a6aff64035bcc", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -2385,10 +2583,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -241.3332977294922, - "y": 30.00001335144043, - "width": 177.99990844726563, - "height": 36.00001525878906 + "x": -240.6666717529297, + "y": -119.9999771118164, + "width": 178.0, + "height": 35.999969482421878 } }, "m_Slots": [ @@ -2686,6 +2884,42 @@ "m_Labels": [] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "e97ebd89b37649bbbbb6bce779b31161", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -352.0, + "y": 326.66668701171877, + "width": 102.66665649414063, + "height": 36.000030517578128 + } + }, + "m_Slots": [ + { + "m_Id": "c586599eb94844e8852ace67749001b7" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "7e09a1dd20fa45cfb744461ff4274fe3" + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.PropertyNode", diff --git a/Assets/VRM10_Samples/VRM10Viewer/TinyMToonMaterialContext.cs b/Assets/VRM10_Samples/VRM10Viewer/TinyMToonMaterialContext.cs index d74440732..09c162aab 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/TinyMToonMaterialContext.cs +++ b/Assets/VRM10_Samples/VRM10Viewer/TinyMToonMaterialContext.cs @@ -22,6 +22,7 @@ namespace UniVRM10.VRM10Viewer private static readonly int ShadingColorFactorProp = Shader.PropertyToID("_ShadingColor"); private static readonly int ShadingMapProp = Shader.PropertyToID("_ShadingMap"); private static readonly int ShadingToonyFactorProp = Shader.PropertyToID("_ShadingToonyFactor"); + private static readonly int ShadingShiftFactorProp = Shader.PropertyToID("_ShadingShiftFactor"); /// /// float = 1.0 @@ -92,6 +93,11 @@ namespace UniVRM10.VRM10Viewer get => Material.GetFloat(ShadingToonyFactorProp); set => Material.SetFloat(ShadingToonyFactorProp, value); } + public float ShadingShiftFactor + { + get => Material.GetFloat(ShadingShiftFactorProp); + set => Material.SetFloat(ShadingShiftFactorProp, value); + } public float BumpScale { diff --git a/Assets/VRM10_Samples/VRM10Viewer/TinyMToonMaterialImporter.cs b/Assets/VRM10_Samples/VRM10Viewer/TinyMToonMaterialImporter.cs index bd467cd5d..b1a5c381b 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/TinyMToonMaterialImporter.cs +++ b/Assets/VRM10_Samples/VRM10Viewer/TinyMToonMaterialImporter.cs @@ -101,6 +101,7 @@ namespace UniVRM10.VRM10Viewer } context.ShadingToonyFactor = mtoon.ShadingToonyFactor.GetValueOrDefault(); + context.ShadingShiftFactor = mtoon.ShadingToonyFactor.GetValueOrDefault(); var shadeColor = mtoon.ShadeColorFactor?.ToColor3(UniGLTF.ColorSpace.Linear, UniGLTF.ColorSpace.sRGB); context.ShadingColorFactorSrgb = shadeColor.GetValueOrDefault(Color.white); if (mtoon is { ShadeMultiplyTexture: { Index: >= 0 } }) diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10VisualPrimitive.cs b/Assets/VRM10_Samples/VRM10Viewer/VRM10VisualPrimitive.cs index b87a30f79..668701c3b 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/VRM10VisualPrimitive.cs +++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10VisualPrimitive.cs @@ -37,8 +37,8 @@ namespace UniVRM10.VRM10Viewer if (_urpMaterialForGrayscale != null) { var m = Instantiate(_urpMaterialForGrayscale); - m.SetFloat("_Metallic", 0); - m.SetFloat("_Roughness", 1); + // m.SetFloat("_Metallic", 0); + // m.SetFloat("_Roughness", 1); visual.GetComponent().material = m; } }