diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 8f47595..44056ac 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -684,6 +684,111 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 40} m_Pivot: {x: 0.5, y: 1} +--- !u!1 &1135370673 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1135370677} + - component: {fileID: 1135370676} + - component: {fileID: 1135370675} + - component: {fileID: 1135370674} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &1135370674 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1135370673} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &1135370675 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1135370673} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &1135370676 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1135370673} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1135370677 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1135370673} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0.27807525, z: -0, w: 0.9605593} + m_LocalPosition: {x: 2.75, y: -2.44, z: 22.24} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: -32.291, z: 0} --- !u!1 &1417301779 GameObject: m_ObjectHideFlags: 0 @@ -2072,3 +2177,4 @@ SceneRoots: - {fileID: 1632218256} - {fileID: 77912386} - {fileID: 1753403299} + - {fileID: 1135370677} diff --git a/Assets/Test.meta b/Assets/Test.meta new file mode 100644 index 0000000..309bdb3 --- /dev/null +++ b/Assets/Test.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d216514662ec145bda6a472c853204b4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Test/InverLerp.shadergraph b/Assets/Test/InverLerp.shadergraph new file mode 100644 index 0000000..b7637cd --- /dev/null +++ b/Assets/Test/InverLerp.shadergraph @@ -0,0 +1,875 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "9cfed3735ca24c199d148d820f54d309", + "m_Properties": [], + "m_Keywords": [], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "c41367cace5a44ed8e59c394d0bf4373" + } + ], + "m_Nodes": [ + { + "m_Id": "8b0a0119110c458cac2f36515086e400" + }, + { + "m_Id": "132507e1d7f4464bb9b5d32ce2e2a75d" + }, + { + "m_Id": "7f2ebdfdff064c7fb3a5ecc3d1ed0a57" + }, + { + "m_Id": "98d2a930413748dbad6fdecbb6317678" + }, + { + "m_Id": "94dddb7fd8694040ac64092b3885ccf3" + }, + { + "m_Id": "86f69aac6fab45a58a69ab18064d1cad" + }, + { + "m_Id": "b02e131dd45e4f99aa8b174434835e91" + }, + { + "m_Id": "ce089a31b6434c1b9e47e3df706685a6" + }, + { + "m_Id": "7a85363740164a16867e57280d680c0a" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7a85363740164a16867e57280d680c0a" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "86f69aac6fab45a58a69ab18064d1cad" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "86f69aac6fab45a58a69ab18064d1cad" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b02e131dd45e4f99aa8b174434835e91" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "94dddb7fd8694040ac64092b3885ccf3" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "86f69aac6fab45a58a69ab18064d1cad" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b02e131dd45e4f99aa8b174434835e91" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "98d2a930413748dbad6fdecbb6317678" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "ce089a31b6434c1b9e47e3df706685a6" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "86f69aac6fab45a58a69ab18064d1cad" + }, + "m_SlotId": 1 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "8b0a0119110c458cac2f36515086e400" + }, + { + "m_Id": "132507e1d7f4464bb9b5d32ce2e2a75d" + }, + { + "m_Id": "7f2ebdfdff064c7fb3a5ecc3d1ed0a57" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "98d2a930413748dbad6fdecbb6317678" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"fileID\":10210,\"guid\":\"0000000000000000e000000000000000\",\"type\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_ActiveTargets": [ + { + "m_Id": "8dd7a161127a4f0a905666cd57e19606" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "05e56b721cc84b668e627b1ecc4fe679", + "m_Id": 0, + "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_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "132507e1d7f4464bb9b5d32ce2e2a75d", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "80a1629fd1ae48c98fdcdccea6d68833" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "22209addcf20456599c5f2bdf5153234", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "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", + "m_ObjectId": "24af054c61914d32bb38e109fe48fe01", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "25df8096ea0c4e8e87e68ecbb0a329b3", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "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_Space": 0 +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", + "m_ObjectId": "3936d147b1854f11ac69d7fe9f77524c" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "479117b29d0a4afe8cc6b97f94bf1534", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "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", + "m_ObjectId": "5428aa8b5c0e4e3ca39e7655d707c6c4", + "m_Id": 2, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SliderNode", + "m_ObjectId": "7a85363740164a16867e57280d680c0a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Slider", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -371.0, + "y": -13.0, + "width": 232.0, + "height": 146.0 + } + }, + "m_Slots": [ + { + "m_Id": "83b3d660f2c54be7b6ea77cc499ea895" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Value": { + "x": 0.23999999463558198, + "y": 0.0, + "z": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "7f2ebdfdff064c7fb3a5ecc3d1ed0a57", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "25df8096ea0c4e8e87e68ecbb0a329b3" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "80a1629fd1ae48c98fdcdccea6d68833", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "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_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "83b3d660f2c54be7b6ea77cc499ea895", + "m_Id": 0, + "m_DisplayName": "Out", + "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.InverseLerpNode", + "m_ObjectId": "86f69aac6fab45a58a69ab18064d1cad", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Inverse Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -215.0, + "y": 293.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "9d09328a46a347a8b58c7ec60679ffa4" + }, + { + "m_Id": "24af054c61914d32bb38e109fe48fe01" + }, + { + "m_Id": "22209addcf20456599c5f2bdf5153234" + }, + { + "m_Id": "b743dec036c24328b93cc2b13b126d94" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8a7b9e999cd44f1aa27763b6d21c9b82", + "m_Id": 4, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "8b0a0119110c458cac2f36515086e400", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "9685e4a8901d4a0b922994b4892646a5" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8c0ed9729d184af7997c9aa72ad5f695", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "8dd7a161127a4f0a905666cd57e19606", + "m_Datas": [], + "m_ActiveSubTarget": { + "m_Id": "3936d147b1854f11ac69d7fe9f77524c" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_SupportsLODCrossFade": false, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8efd71be67bd4ecb90c0a589c97ae208", + "m_Id": 3, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVNode", + "m_ObjectId": "94dddb7fd8694040ac64092b3885ccf3", + "m_Group": { + "m_Id": "" + }, + "m_Name": "UV", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -579.0, + "y": 241.0, + "width": 208.0, + "height": 313.0 + } + }, + "m_Slots": [ + { + "m_Id": "05e56b721cc84b668e627b1ecc4fe679" + } + ], + "synonyms": [ + "texcoords", + "coords", + "coordinates" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_OutputChannel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "9685e4a8901d4a0b922994b4892646a5", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "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_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "98d2a930413748dbad6fdecbb6317678", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "d7557dd620aa46fba50fef6bbfadc3e0" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "9d09328a46a347a8b58c7ec60679ffa4", + "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.Vector1MaterialSlot", + "m_ObjectId": "a567b6e9f1874abbb9d292367b59bf64", + "m_Id": 1, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SplitNode", + "m_ObjectId": "b02e131dd45e4f99aa8b174434835e91", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Split", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 39.0, + "y": 353.0, + "width": 120.0, + "height": 149.0 + } + }, + "m_Slots": [ + { + "m_Id": "479117b29d0a4afe8cc6b97f94bf1534" + }, + { + "m_Id": "a567b6e9f1874abbb9d292367b59bf64" + }, + { + "m_Id": "5428aa8b5c0e4e3ca39e7655d707c6c4" + }, + { + "m_Id": "8efd71be67bd4ecb90c0a589c97ae208" + }, + { + "m_Id": "8a7b9e999cd44f1aa27763b6d21c9b82" + } + ], + "synonyms": [ + "separate" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b743dec036c24328b93cc2b13b126d94", + "m_Id": 3, + "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.CategoryData", + "m_ObjectId": "c41367cace5a44ed8e59c394d0bf4373", + "m_Name": "", + "m_ChildObjectList": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SliderNode", + "m_ObjectId": "ce089a31b6434c1b9e47e3df706685a6", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Slider", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -371.0, + "y": 147.0, + "width": 232.0, + "height": 146.0 + } + }, + "m_Slots": [ + { + "m_Id": "8c0ed9729d184af7997c9aa72ad5f695" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Value": { + "x": 0.7860000133514404, + "y": 0.0, + "z": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "d7557dd620aa46fba50fef6bbfadc3e0", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + diff --git a/Assets/Test/InverLerp.shadergraph.meta b/Assets/Test/InverLerp.shadergraph.meta new file mode 100644 index 0000000..e272b92 --- /dev/null +++ b/Assets/Test/InverLerp.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 6dae9b46c2add4940867c806b0665857 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/Packages/zzwater/Mats/Ocean_tess.mat b/Packages/zzwater/Mats/Ocean_tess.mat index 2be9166..95cb11f 100644 --- a/Packages/zzwater/Mats/Ocean_tess.mat +++ b/Packages/zzwater/Mats/Ocean_tess.mat @@ -107,14 +107,14 @@ Material: - _GlossyReflections: 0 - _HorizonDistance: 26.6 - _InterscetionSpeed: 1 - - _IntersectionClipping: 0.735 + - _IntersectionClipping: 0.407 - _IntersectionDurationMulti: 1 - - _IntersectionDurationMulti1: 3.45 - - _IntersectionDurationMulti2: 1.45 - - _IntersectionFalloff: 0.451 - - _IntersectionLength: 1.43 - - _IntersectionSpeed: -0.21 - - _IntersectionTiling: 1.27 + - _IntersectionDurationMulti1: 2.53 + - _IntersectionDurationMulti2: 0.83 + - _IntersectionFalloff: 0.73 + - _IntersectionLength: 2.03 + - _IntersectionSpeed: 0.2 + - _IntersectionTiling: 0.82 - _Metallic: 0 - _OcclusionStrength: 1 - _Parallax: 0.005 @@ -133,31 +133,37 @@ Material: - _Surface: 0 - _TessMax: 15 - _TessMin: 0 - - _TessValue: 19.2 + - _TessValue: 16 - _TranslucencyCurvatureMask: 0.708 - _TranslucencyExp: 10 - _TranslucencyReflectionMask: 0.764 - _TranslucencyStrength: 0.7 - _TranslucencyStrengthDirect: 0.443 - - _WaveCount: 3 - - _WaveDistance: 0.764 - - _WaveHeight: 0.17 + - _WaveCount: 2 + - _WaveDistance: 0.808 + - _WaveFoamBaseLvl: -2.66 + - _WaveFoamClipping: 0.328 + - _WaveFoamExp: 5 + - _WaveFoamLength: 1 + - _WaveHeight: 0.23 + - _WaveMesureMax: -2.51 + - _WaveMesureMin: -2.68 - _WaveNormalStr: 0.2 - - _WaveSpeed: 1.2 - - _WaveSteepness: 3.76 + - _WaveSpeed: 1 + - _WaveSteepness: 3.65 - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - _BaseColor: {r: 0.01619794, g: 0.20062576, b: 0.26415092, a: 0.9490196} - _Color: {r: 1, g: 1, b: 1, a: 1} - - _Direction: {r: 1, g: 1, b: 0, a: 0} + - _Direction: {r: 0.66, g: -1, b: 0, a: 0} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _HorizonColor: {r: 0.09376113, g: 0.10980392, b: 0.32156864, a: 1} - - _IntersectionColor: {r: 1, g: 1, b: 1, a: 1} + - _IntersectionColor: {r: 0.9622642, g: 0.9577252, b: 0.9577252, a: 1} - _ShallowColor: {r: 0.105882354, g: 0.4117647, b: 0.62352943, a: 0.9372549} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - _WaveDirection: {r: 1, g: 1, b: 1, a: 2} - - _WaveFadeDistance: {r: 0, g: 200, b: 0, a: 0} + - _WaveFadeDistance: {r: 100, g: 200, b: 0, a: 0} m_BuildTextureStacks: [] --- !u!114 &1635733923474585344 MonoBehaviour: diff --git a/Packages/zzwater/Tex/Intersection_Foam.png.meta b/Packages/zzwater/Tex/Intersection_Foam.png.meta index a4199db..611ca73 100644 --- a/Packages/zzwater/Tex/Intersection_Foam.png.meta +++ b/Packages/zzwater/Tex/Intersection_Foam.png.meta @@ -34,8 +34,8 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: 1 - aniso: 1 + filterMode: 0 + aniso: 3 mipBias: 0 wrapU: 0 wrapV: 0 diff --git a/Packages/zzwater/shaders/libs/ForwardPass.hlsl b/Packages/zzwater/shaders/libs/ForwardPass.hlsl index 5777c59..6a1e739 100644 --- a/Packages/zzwater/shaders/libs/ForwardPass.hlsl +++ b/Packages/zzwater/shaders/libs/ForwardPass.hlsl @@ -96,23 +96,34 @@ float4 ForwardPassFragment(Varyings input) : SV_Target water.alpha *= water.edgeFade; + + // Wave Mesure + + + float waveMesure = (positionWS.y - _WaveMesureMin) / (_WaveMesureMax - _WaveMesureMin); + + float2 nUV = positionWS.xz * _IntersectionTiling; + float foamTexNoise = SAMPLE_TEXTURE2D(_IntersectionNoise, sampler_IntersectionNoise, nUV + TIME_VERTEX/_IntersectionTiling * _IntersectionSpeed).r; + + // remap wave from [_WaveFoamClipping,1] to [0,1] + float waveFoamNoise = (waveMesure - _WaveFoamClipping) / (1 - _WaveFoamClipping) * foamTexNoise; + //return float4(waveFoamNoise.xxx, 1); + /* ======== // Intercection =========== */ float interSecGradient = 1-saturate(exp(scene.verticalDepth) / _IntersectionLength); - float sine1 = sin(_TimeParameters.x * _IntersectionDurationMulti1 + positionWS.x - interSecGradient ); - float sine2 = sin(_TimeParameters.x * _IntersectionDurationMulti2 + positionWS.z - interSecGradient ); - float sine = sine1 * sine2 * interSecGradient; + float intersecMesure = waveMesure * interSecGradient; - float2 nUV = positionWS.xz * _IntersectionTiling; float dist = saturate(interSecGradient / _IntersectionFalloff); - float noise = SAMPLE_TEXTURE2D(_IntersectionNoise, sampler_IntersectionNoise, nUV + TIME_VERTEX/_IntersectionTiling * _IntersectionSpeed).r; - noise = saturate(noise + sine) * dist + dist; - noise = smoothstep(_IntersectionClipping, 1, noise); - //noise = step(_IntersectionClipping, noise); + float inersecNoise = saturate(foamTexNoise + intersecMesure) * dist + dist; + inersecNoise = smoothstep(_IntersectionClipping, 1, inersecNoise); + + + float noise = saturate(inersecNoise + waveFoamNoise); water.albedo.rgb = lerp(water.albedo.rgb, _IntersectionColor.rgb, noise); water.alpha = saturate(water.alpha + interSecGradient); @@ -131,7 +142,7 @@ float4 ForwardPassFragment(Varyings input) : SV_Target float cosTheta = saturate(dot(normalWS, viewDir)); water.reflectionMask = pow(max(0.0, 1.000293 - cosTheta), _ReflectionFresnel) * _ReflectionStrength; - water.albedo = lerp(water.albedo, water.reflections.rgb, water.reflectionMask); + water.albedo = lerp(water.albedo, water.reflections.rgb, water.reflectionMask - noise); // =================== Make ApplyLight simple ========================= diff --git a/Packages/zzwater/shaders/libs/Input.hlsl b/Packages/zzwater/shaders/libs/Input.hlsl index 1f4305b..01d4f0a 100644 --- a/Packages/zzwater/shaders/libs/Input.hlsl +++ b/Packages/zzwater/shaders/libs/Input.hlsl @@ -39,8 +39,12 @@ CBUFFER_START(UnityPerMaterial) half _IntersectionSpeed; half _IntersectionClipping; half _IntersectionFalloff; - half _IntersectionDurationMulti1; - half _IntersectionDurationMulti2; + + // Wave foam + half _WaveMesureMin; + half _WaveMesureMax; + half _WaveFoamClipping; + //Waves diff --git a/Packages/zzwater/shaders/ocean.shader b/Packages/zzwater/shaders/ocean.shader index 8ee0599..8b3f8c7 100644 --- a/Packages/zzwater/shaders/ocean.shader +++ b/Packages/zzwater/shaders/ocean.shader @@ -28,10 +28,13 @@ Shader "zzwater/ocean" _IntersectionSpeed("Intersection Speed Multi", Float) = 1 _IntersectionClipping("Cutoff", Range(0.01, 1)) = 0.5 _IntersectionFalloff("Falloff", Range(0.01 , 1)) = 0.5 - _IntersectionDurationMulti1("Intersection Duration Multi 1", Range(0.01, 10)) = 0.5 - _IntersectionDurationMulti2("Intersection Duration Multi 2", Range(0.01, 10)) = 0.5 _IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2 + // Wave foam + _WaveMesureMin("Wave Mesure Min", float) = 0 + _WaveMesureMax("Wave Mesure Max", float) = 0.3 + _WaveFoamClipping("Wave Cutoff", Range(0.01,1)) = 1 + //waves _WaveSpeed("Speed", Float) = 2 diff --git a/Packages/zzwater/shaders/ocean_tess.shader b/Packages/zzwater/shaders/ocean_tess.shader index e598cfc..5f70569 100644 --- a/Packages/zzwater/shaders/ocean_tess.shader +++ b/Packages/zzwater/shaders/ocean_tess.shader @@ -34,10 +34,13 @@ Shader "zzwater/ocean_tess" _IntersectionSpeed("Intersection Speed Multi", Float) = 1 _IntersectionClipping("Cutoff", Range(0.01, 1)) = 0.5 _IntersectionFalloff("Falloff", Range(0.01 , 1)) = 0.5 - _IntersectionDurationMulti1("Intersection Duration Multi 1", Range(0.01, 10)) = 0.5 - _IntersectionDurationMulti2("Intersection Duration Multi 2", Range(0.01, 10)) = 0.5 _IntersectionLength("Intersection Distance", Range(0.01 , 5)) = 2 + // Wave foam + _WaveMesureMin("Wave Mesure Min", float) = 0 + _WaveMesureMax("Wave Mesure Max", float) = 0.3 + _WaveFoamClipping("Wave Cutoff", Range(0.01,1)) = 1 + //waves _WaveSpeed("Speed", Float) = 2