From 568413b4b4f478fba715d5ebd2aac217e6e7154a Mon Sep 17 00:00:00 2001 From: reng Date: Sat, 13 Sep 2025 11:00:00 +0800 Subject: [PATCH] add amplitude control light --- Assets/Scenes/SampleScene.unity | 373 ++++++++++++++---- Assets/Scripts/OscHandler.cs | 8 +- Assets/Scripts/SetLightStrength.cs | 81 ++++ Assets/Scripts/SetLightStrength.cs.meta | 11 + Assets/Scripts/UploadToGoogleDrive.cs | 21 +- Assets/Shaders/Material-light.mat | 90 +++++ Assets/Shaders/Material-light.mat.meta | 8 + Assets/Shaders/Material-shader-postcard.mat | 2 +- Assets/Shaders/Material-shader.mat | 2 +- Assets/Shaders/blur.shader | 240 ++++++----- ...s.Auth.OAuth2.Responses.TokenResponse-user | 2 +- 11 files changed, 616 insertions(+), 222 deletions(-) create mode 100644 Assets/Scripts/SetLightStrength.cs create mode 100644 Assets/Scripts/SetLightStrength.cs.meta create mode 100644 Assets/Shaders/Material-light.mat create mode 100644 Assets/Shaders/Material-light.mat.meta diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index f0efa24..dbd951c 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -154,10 +154,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 453325069} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.00024414062} - m_SizeDelta: {x: 0, y: 0.0014648} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 883, y: 1245} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &73630331 MonoBehaviour: @@ -227,10 +227,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 453325069} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.00024414062} - m_SizeDelta: {x: 0, y: 0.0014648} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 883, y: 1245} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &106855361 MonoBehaviour: @@ -244,7 +244,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: 182ca57371037e346a13b9481c557c30, type: 2} + m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} @@ -1166,8 +1166,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 97.5, y: 0} - m_SizeDelta: {x: 195, y: 0} + m_AnchoredPosition: {x: 70, y: 0} + m_SizeDelta: {x: 140, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &366298495 MonoBehaviour: @@ -1834,7 +1834,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.size - value: 14 + value: 16 objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: actions.List.Array.data[0].name @@ -1894,39 +1894,47 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[5].member - value: localScale + value: alpha objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[6].member - value: localPosition + value: ImageOffsetY objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[7].member - value: alpha + value: FadeDuration objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[8].member - value: ImageOffsetY + value: FlashDuration objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[9].member - value: FadeDuration + value: MinFadeAmount objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[10].member - value: FlashDuration + value: FlashCount objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[11].member - value: MinFadeAmount + value: GoogleDriveFolderId objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[12].member - value: FlashCount + value: GradientEnd objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[13].member - value: GoogleDriveFolderId + value: LightPositionY + objectReference: {fileID: 0} + - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} + propertyPath: controls.List.Array.data[14].member + value: TopColor + objectReference: {fileID: 0} + - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} + propertyPath: controls.List.Array.data[15].member + value: BottomColor objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[0].instance @@ -1951,15 +1959,15 @@ PrefabInstance: - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[5].instance value: - objectReference: {fileID: 1473564382} + objectReference: {fileID: 1786403753} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[6].instance value: - objectReference: {fileID: 1473564382} + objectReference: {fileID: 1995476945} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[7].instance value: - objectReference: {fileID: 1786403753} + objectReference: {fileID: 1995476945} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[8].instance value: @@ -1991,15 +1999,23 @@ PrefabInstance: - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[11].instance value: - objectReference: {fileID: 1995476945} + objectReference: {fileID: 364051447} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[12].instance value: - objectReference: {fileID: 1995476945} + objectReference: {fileID: 697235291} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[13].instance value: - objectReference: {fileID: 364051447} + objectReference: {fileID: 697235291} + - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} + propertyPath: controls.List.Array.data[14].instance + value: + objectReference: {fileID: 697235291} + - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} + propertyPath: controls.List.Array.data[15].instance + value: + objectReference: {fileID: 697235291} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[0].displayPath value: _fadeDuration @@ -2042,31 +2058,31 @@ PrefabInstance: objectReference: {fileID: 761374004} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[5].displayPath - value: localScale + value: alpha objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[5].preInstance value: - objectReference: {fileID: 1473564382} + objectReference: {fileID: 1786403753} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[6].displayPath - value: localPosition + value: ImageOffsetY objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[6].preInstance value: - objectReference: {fileID: 1473564382} + objectReference: {fileID: 1995476945} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[7].displayPath - value: alpha + value: FadeDuration objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[7].preInstance value: - objectReference: {fileID: 1786403753} + objectReference: {fileID: 1995476945} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[8].displayPath - value: ImageOffsetY + value: FlashDuration objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[8].preInstance @@ -2074,7 +2090,7 @@ PrefabInstance: objectReference: {fileID: 1995476945} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[9].displayPath - value: FadeDuration + value: MinFadeAmount objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[9].preInstance @@ -2082,7 +2098,7 @@ PrefabInstance: objectReference: {fileID: 1995476945} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[10].displayPath - value: FlashDuration + value: FlashCount objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[10].preInstance @@ -2090,28 +2106,44 @@ PrefabInstance: objectReference: {fileID: 1995476945} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[11].displayPath - value: MinFadeAmount + value: GoogleDriveFolderId objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[11].preInstance value: - objectReference: {fileID: 1995476945} + objectReference: {fileID: 364051447} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[12].displayPath - value: FlashCount + value: GradientEnd objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[12].preInstance value: - objectReference: {fileID: 1995476945} + objectReference: {fileID: 697235291} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[13].displayPath - value: GoogleDriveFolderId + value: LightPositionY objectReference: {fileID: 0} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: controls.List.Array.data[13].preInstance value: - objectReference: {fileID: 364051447} + objectReference: {fileID: 697235291} + - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} + propertyPath: controls.List.Array.data[14].displayPath + value: TopColor + objectReference: {fileID: 0} + - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} + propertyPath: controls.List.Array.data[14].preInstance + value: + objectReference: {fileID: 697235291} + - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} + propertyPath: controls.List.Array.data[15].displayPath + value: BottomColor + objectReference: {fileID: 0} + - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} + propertyPath: controls.List.Array.data[15].preInstance + value: + objectReference: {fileID: 697235291} - target: {fileID: 5748129664144205097, guid: 7aba709da85d1c2439af18a2c2e1548c, type: 3} propertyPath: actions.List.Array.data[0].Event.m_PersistentCalls.m_Calls.Array.size value: 1 @@ -2562,6 +2594,7 @@ RectTransform: m_Children: - {fileID: 243707688} - {fileID: 1995476943} + - {fileID: 697235288} - {fileID: 129014403} - {fileID: 1473564382} - {fileID: 2028163026} @@ -2791,9 +2824,9 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 453325069} - {fileID: 974213766} - {fileID: 406932986} - - {fileID: 453325069} - {fileID: 1918656957} - {fileID: 1053697756} - {fileID: 946211682} @@ -2894,16 +2927,16 @@ RectTransform: m_GameObject: {fileID: 550776837} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 + m_LocalScale: {x: 1.1, y: 1.1, z: 1.1} + m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 243707688} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} + m_SizeDelta: {x: 1080, y: 1920} + m_Pivot: {x: 0.5, y: 0} --- !u!114 &550776839 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3045,8 +3078,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0.00028801, y: 225} - m_SizeDelta: {x: 1241, y: 2206} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1245, y: 1755} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &580836535 MonoBehaviour: @@ -3060,7 +3093,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: 115ec6e5c38076447ad803c5bef69618, type: 2} + m_Material: {fileID: 2100000, guid: 182ca57371037e346a13b9481c557c30, type: 2} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} @@ -3379,8 +3412,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 468, y: -195} - m_SizeDelta: {x: 156, y: 0} + m_AnchoredPosition: {x: 511.7143, y: -140} + m_SizeDelta: {x: 170.57144, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &696492449 MonoBehaviour: @@ -3451,6 +3484,162 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 696492447} m_CullTransparentMesh: 1 +--- !u!1 &697235287 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 697235288} + - component: {fileID: 697235290} + - component: {fileID: 697235289} + - component: {fileID: 697235291} + - component: {fileID: 697235292} + m_Layer: 5 + m_Name: light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &697235288 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 697235287} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.874976, y: 1.874976, z: 1.874976} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 473271735} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: -24, y: 0} + m_SizeDelta: {x: 1080, y: 1080} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &697235289 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 697235287} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: 05d79a93433eefe488f50f53cd1fa17a, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 0} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &697235290 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 697235287} + m_CullTransparentMesh: 1 +--- !u!114 &697235291 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 697235287} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 834012601375dd14aa63a60e116710ea, type: 3} + m_Name: + m_EditorClassIdentifier: + GradientEnd: 0.8 + LightPositionY: 1.25 + TopColor: {r: 1, g: 0.8584145, b: 0.5801887, a: 0.6666667} + BottomColor: {r: 0.5377358, g: 0.4067989, b: 0.24096651, a: 0} +--- !u!114 &697235292 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 697235287} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 51f8f979447c54247bcba0d5441e6081, type: 3} + m_Name: + m_EditorClassIdentifier: + _connection: {fileID: 11400000, guid: 403214990dd9b8f499d3a894e1575167, type: 2} + _oscAddress: /amplitude + _dataType: 3 + _event: + m_PersistentCalls: + m_Calls: [] + _intEvent: + m_PersistentCalls: + m_Calls: [] + _floatEvent: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 697235291} + m_TargetAssemblyTypeName: SetLightStrength, Assembly-CSharp + m_MethodName: setStrength + m_Mode: 0 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + _vector2Event: + m_PersistentCalls: + m_Calls: [] + _vector3Event: + m_PersistentCalls: + m_Calls: [] + _vector4Event: + m_PersistentCalls: + m_Calls: [] + _vector2IntEvent: + m_PersistentCalls: + m_Calls: [] + _vector3IntEvent: + m_PersistentCalls: + m_Calls: [] + _stringEvent: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 697235291} + m_TargetAssemblyTypeName: SetLightStrength, Assembly-CSharp + m_MethodName: onReceiveStrength + m_Mode: 0 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &708745129 GameObject: m_ObjectHideFlags: 0 @@ -3879,8 +4068,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchoredPosition: {x: 106.60715, y: 0} + m_SizeDelta: {x: 140, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &830016229 MonoBehaviour: @@ -4575,8 +4764,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 97.5, y: 0} - m_SizeDelta: {x: 195, y: 0} + m_AnchoredPosition: {x: 70, y: 0} + m_SizeDelta: {x: 140, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1060364296 MonoBehaviour: @@ -5428,10 +5617,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 453325069} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.00024414062} - m_SizeDelta: {x: 0, y: 0.0014648} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 883, y: 1245} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1351235762 MonoBehaviour: @@ -5445,7 +5634,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: 182ca57371037e346a13b9481c557c30, type: 2} + m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} @@ -5594,6 +5783,7 @@ GameObject: - component: {fileID: 1391781193} - component: {fileID: 1391781195} - component: {fileID: 1391781194} + - component: {fileID: 1391781196} m_Layer: 5 m_Name: Image-Default m_TagString: Untagged @@ -5609,16 +5799,16 @@ RectTransform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1391781192} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 175.40001} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1327556356} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.5} - m_AnchorMax: {x: 1, y: 0.5} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 2116} + m_SizeDelta: {x: 1245, y: 1755} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1391781194 MonoBehaviour: @@ -5632,7 +5822,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: 182ca57371037e346a13b9481c557c30, type: 2} + m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} @@ -5640,7 +5830,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Texture: {fileID: 2800000, guid: 50c4d83bd5fd7e0499753e3b7d19c7f1, type: 3} + m_Texture: {fileID: 0} m_UVRect: serializedVersion: 2 x: 0 @@ -5655,6 +5845,19 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1391781192} m_CullTransparentMesh: 1 +--- !u!114 &1391781196 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1391781192} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3e47ac129448e9f4488c01f5b7182798, type: 3} + m_Name: + m_EditorClassIdentifier: + imagePath: ./Material/Postcard/default.jpg --- !u!1 &1457143871 GameObject: m_ObjectHideFlags: 0 @@ -6077,7 +6280,7 @@ VideoPlayer: m_AudioOutputMode: 2 m_TargetAudioSources: [] m_DirectAudioVolumes: [] - m_Url: file://./Material/Intro.mp4 + m_Url: file://../Material/Intro.mp4 m_EnabledAudioTracks: m_DirectAudioMutes: m_ControlledAudioTrackCount: 0 @@ -6566,8 +6769,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 292.5, y: 0} - m_SizeDelta: {x: 219.375, y: 0} + m_AnchoredPosition: {x: 319.82144, y: 0} + m_SizeDelta: {x: 157.5, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1811530096 MonoBehaviour: @@ -6649,6 +6852,7 @@ GameObject: - component: {fileID: 1814244731} - component: {fileID: 1814244733} - component: {fileID: 1814244732} + - component: {fileID: 1814244734} m_Layer: 5 m_Name: Image-Discard m_TagString: Untagged @@ -6664,16 +6868,16 @@ RectTransform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1814244730} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 175.40001} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1327556356} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.5} - m_AnchorMax: {x: 1, y: 0.5} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 2116} + m_SizeDelta: {x: 1245, y: 1755} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1814244732 MonoBehaviour: @@ -6687,7 +6891,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: 182ca57371037e346a13b9481c557c30, type: 2} + m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} @@ -6695,7 +6899,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Texture: {fileID: 2800000, guid: 53b217500b4d7fe478d05cd63b600446, type: 3} + m_Texture: {fileID: 0} m_UVRect: serializedVersion: 2 x: 0 @@ -6710,6 +6914,19 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1814244730} m_CullTransparentMesh: 1 +--- !u!114 &1814244734 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1814244730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3e47ac129448e9f4488c01f5b7182798, type: 3} + m_Name: + m_EditorClassIdentifier: + imagePath: ./Material/Postcard/discard.png --- !u!1 &1853931819 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/OscHandler.cs b/Assets/Scripts/OscHandler.cs index 5014359..9ce04de 100644 --- a/Assets/Scripts/OscHandler.cs +++ b/Assets/Scripts/OscHandler.cs @@ -129,12 +129,12 @@ public class OscHandler : MonoBehaviour case "reset": intro.alpha = 0f; main.alpha = 0f; - light_mask.alpha = 0f; + // light_mask.alpha = 0f; hint.alpha = 0f; setChoiceEffect?.Reset(); break; case "intro": - StartCoroutine(FadeCanvasGroup(light_mask, 0f, 1f, _maskDuration)); + // StartCoroutine(FadeCanvasGroup(light_mask, 0f, 1f, _maskDuration)); StartCoroutine(FadeCanvasGroup(intro, 0f, 1f, _fadeDuration, _maskDuration)); @@ -150,7 +150,7 @@ public class OscHandler : MonoBehaviour break; case "go": - if (light_mask.alpha < 1f) StartCoroutine(FadeCanvasGroup(light_mask, light_mask.alpha, 1f, _fadeDuration)); + // if (light_mask.alpha < 1f) StartCoroutine(FadeCanvasGroup(light_mask, light_mask.alpha, 1f, _fadeDuration)); StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 0f, _fadeDuration)); StartCoroutine(FadeCanvasGroup(main, main.alpha, 1f, _fadeDuration)); @@ -158,7 +158,7 @@ public class OscHandler : MonoBehaviour case "end": if (intro.alpha > 0f) StartCoroutine(FadeCanvasGroup(intro, 1f, 0f, _fadeDuration)); StartCoroutine(FadeCanvasGroup(main, 1f, 0f, _fadeDuration)); - StartCoroutine(FadeCanvasGroup(light_mask, 1f, 0f, _maskDuration, _fadeDuration)); + // StartCoroutine(FadeCanvasGroup(light_mask, 1f, 0f, _maskDuration, _fadeDuration)); if (hint.alpha > 0f) { coroutine_hint = FadeCanvasGroup(hint, hint.alpha, 0f, _hintDuration); diff --git a/Assets/Scripts/SetLightStrength.cs b/Assets/Scripts/SetLightStrength.cs new file mode 100644 index 0000000..6a32b1f --- /dev/null +++ b/Assets/Scripts/SetLightStrength.cs @@ -0,0 +1,81 @@ +using System.Collections; +using System.Collections.Generic; +using Unity.Mathematics; +using UnityEngine; +using UnityEngine.UI; + +public class SetLightStrength : MonoBehaviour +{ + + public float GradientEnd = 0.5f; + public float LightPositionY = 1.2f; + + public Color TopColor = new Color(1f, 1f, 1f, 1f); + public Color BottomColor = new Color(0f, 0f, 0f, 0f); + + + RawImage rawImage; + Material material; + // Start is called before the first frame update + void Start() + { + rawImage = GetComponent(); + if (rawImage != null) + { + material = rawImage.material; + } + else + { + Debug.LogError("RawImage component not found on this GameObject."); + } + } + + // Update is called once per frame + void Update() + { + + if (material != null) + { + if (material != null) + { + material.SetFloat("_GradientEnd", GradientEnd); + material.SetFloat("_LightPositionY", LightPositionY); + material.SetColor("_TopColor", TopColor); + material.SetColor("_BottomColor", BottomColor); + } + } + else + { + Debug.LogError("Material not assigned!"); + rawImage = GetComponent(); + if (rawImage != null) + { + material = rawImage.material; + } + else + { + Debug.LogError("RawImage component not found on this GameObject."); + } + } + } + + public void setStrength(float strength) + { + + + if (material != null) + { + material.SetFloat("_Strength", strength); + } + } + + public void onReceiveStrength(string strength) + { + Debug.Log("Received strength: " + strength); + if (float.TryParse(strength, out float result)) + { + // setStrength(Mathf.Lerp(material.GetFloat("_Strength"), result, Time.deltaTime * 5f)); + setStrength(result); + } + } +} diff --git a/Assets/Scripts/SetLightStrength.cs.meta b/Assets/Scripts/SetLightStrength.cs.meta new file mode 100644 index 0000000..cacd67b --- /dev/null +++ b/Assets/Scripts/SetLightStrength.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 834012601375dd14aa63a60e116710ea +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UploadToGoogleDrive.cs b/Assets/Scripts/UploadToGoogleDrive.cs index 76529a2..e931d41 100644 --- a/Assets/Scripts/UploadToGoogleDrive.cs +++ b/Assets/Scripts/UploadToGoogleDrive.cs @@ -58,13 +58,8 @@ public class UploadToGoogleDrive : MonoBehaviour // Update is called once per frame void Update() { - if (latest_input != null) - { - Export(latest_input); - latest_input = null; - } - } + } public void Save(string input_text) { @@ -117,7 +112,7 @@ public class UploadToGoogleDrive : MonoBehaviour TextNumber.ForceMeshUpdate(); TextSummary.ForceMeshUpdate(); - latest_input= new UploadRequest() + latest_input = new UploadRequest() { uploadDest = uploadDest, id = id, @@ -126,7 +121,17 @@ public class UploadToGoogleDrive : MonoBehaviour discard = discard, default_image = default_image }; - } + StartCoroutine(ExportAfterFrame(latest_input)); +} + +private IEnumerator ExportAfterFrame(UploadRequest uploadRequest) +{ + // Wait for the end of the current frame, after all Update and LateUpdate calls have finished. + yield return new WaitForEndOfFrame(); + + // Now, call the Export function. + Export(uploadRequest); +} public void Export(UploadRequest uploadRequest = null) { diff --git a/Assets/Shaders/Material-light.mat b/Assets/Shaders/Material-light.mat new file mode 100644 index 0000000..b635a9a --- /dev/null +++ b/Assets/Shaders/Material-light.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Material-light + m_Shader: {fileID: 4800000, guid: 86d6803e621c0cb4ab4566eaa6d160e2, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _GradientEnd: 0.8 + - _Metallic: 0 + - _Mode: 0 + - _NoiseScale1: 12 + - _NoiseScale2: 2.6 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Strength: 0 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _BottomColor: {r: 0.5377358, g: 0.4067989, b: 0.24096651, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _LightPostion: {r: 0.5, g: 1.5, b: 0, a: 0} + - _TopColor: {r: 1, g: 0.8584145, b: 0.5801887, a: 0.6666667} + m_BuildTextureStacks: [] diff --git a/Assets/Shaders/Material-light.mat.meta b/Assets/Shaders/Material-light.mat.meta new file mode 100644 index 0000000..15e3fef --- /dev/null +++ b/Assets/Shaders/Material-light.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 05d79a93433eefe488f50f53cd1fa17a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Shaders/Material-shader-postcard.mat b/Assets/Shaders/Material-shader-postcard.mat index aa7e25d..1fb6223 100644 --- a/Assets/Shaders/Material-shader-postcard.mat +++ b/Assets/Shaders/Material-shader-postcard.mat @@ -88,6 +88,6 @@ Material: m_Colors: - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - - _Resolution: {r: 730, g: 1245, b: 0, a: 0} + - _Resolution: {r: 1241, g: 1755, b: 0, a: 0} - _TintColor: {r: 1, g: 1, b: 1, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Shaders/Material-shader.mat b/Assets/Shaders/Material-shader.mat index 2b84fd0..583f040 100644 --- a/Assets/Shaders/Material-shader.mat +++ b/Assets/Shaders/Material-shader.mat @@ -69,7 +69,7 @@ Material: - _Cutoff: 0.5 - _DetailNormalMapScale: 1 - _DstBlend: 0 - - _FadeAmount: 0 + - _FadeAmount: 1 - _FisheyeStrength: 1.1 - _FlashAmount: 0 - _GlossMapScale: 1 diff --git a/Assets/Shaders/blur.shader b/Assets/Shaders/blur.shader index e1abbc0..cdb1203 100644 --- a/Assets/Shaders/blur.shader +++ b/Assets/Shaders/blur.shader @@ -1,147 +1,129 @@ // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' -Shader "RapidBlurEffect" +Shader "Unlit/LightEffect" { Properties { _MainTex("Base (RGB)", 2D) = "white" {} + _Strength("Gradient Strength", Range(0,1)) = 1 + _TopColor("Top Color", Color) = (1,1,1,1) + _BottomColor("Bottom Color", Color) = (0,0,0,0) + _GradientEnd("Gradient End Position", Range(0,1)) = 1 + _LightPostion("Light Position", Vector) = (0.5, 1.0, 0, 0) + _NoiseScale1("Noise Scale 1", Float) = 12.0 + _NoiseScale2("Noise Scale 2", Float) = 2.0 } SubShader { - ZWrite Off - Blend Off - - Pass - { - ZTest Off - Cull Off - - CGPROGRAM - #pragma vertex vert_DownSmpl - #pragma fragment frag_DownSmpl - ENDCG - } - - Pass - { - ZTest Always - Cull Off - - CGPROGRAM - #pragma vertex vert_BlurVertical - #pragma fragment frag_Blur - ENDCG - } - + Tags { "RenderType"="Transparent" "Queue"="Transparent" } + LOD 100 Pass { - ZTest Always - Cull Off + Blend SrcAlpha OneMinusSrcAlpha + ZWrite Off CGPROGRAM - #pragma vertex vert_BlurHorizontal - #pragma fragment frag_Blur + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; + }; + + sampler2D _MainTex; + float _Strength; + float4 _TopColor; + float4 _BottomColor; + float _GradientEnd; + float4 _LightPostion; + float _NoiseScale1; + float _NoiseScale2; + + v2f vert(appdata v) + { + v2f o; + o.pos = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + return o; + } + // Perlin noise implementation + float fade(float t) { + return t * t * t * (t * (t * 6 - 15) + 10); + } + + float lerp(float a, float b, float t) { + return a + t * (b - a); + } + + float grad(int hash, float x, float y) { + int h = hash & 7; + float u = h < 4 ? x : y; + float v = h < 4 ? y : x; + return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); + } + + int perm(int x) { + // Simple permutation function for shader use + return (x * 34 + 1) * x % 289; + } + + float noise(float2 uv) + { + float2 p = floor(uv); + float2 f = frac(uv); + + int X = int(p.x); + int Y = int(p.y); + + int A = perm(X) + Y; + int B = perm(X + 1) + Y; + + float res = lerp( + lerp(grad(perm(A), f.x, f.y), grad(perm(B), f.x - 1, f.y), fade(f.x)), + lerp(grad(perm(A + 1), f.x, f.y - 1), grad(perm(B + 1), f.x - 1, f.y - 1), fade(f.x)), + fade(f.y) + ); + return res * 0.5 + 0.5; // Normalize to [0,1] + } + + fixed4 frag(v2f i) : SV_Target + { + // Remap uv.y so gradient ends at _GradientEnd + // float t = saturate(i.uv.y / max(_GradientEnd, 0.0001)); + // float2 center = float2(0.5, 1.0); + float noiseValue = noise(i.uv*_NoiseScale1 + float2(_Time.x*1.3, _Time.y*0.2)); + float2 uvNorm = (i.uv - _LightPostion.xy + 0.1*float2(noiseValue, noiseValue)); + //uvNorm.x /= (_GradientEnd); // scale x to match circle aspect + float dist = 1.0 - length(uvNorm); + // dist=1.0-(pow(1.0 - dist, 2.0)); // Sharpen the edge + float t = saturate((dist - (1.0 - _GradientEnd)) / _GradientEnd); + + + // Apply ease (smoothstep) for non-linear gradient + t = smoothstep(0.0, 1.0-_Strength*0.5, t); + float n = noise(i.uv *_NoiseScale2 + _Time.yx * 0.8); + t *= n; // Adjust 0.1 for edge softness + t = saturate(t); + t=1.0-pow(1.0 - t, 1.5); // Make the gradient more pronounced + + + float4 gradColor = _BottomColor*(1.0-t)+_TopColor*t; + // float4 texColor = tex2D(_MainTex, i.uv); + // return lerp(float4(0.0, 0.0, 0.0, 0.0), gradColor, _Strength); + return gradColor; + // return gradColor; + } ENDCG } } - - CGINCLUDE - - #include "UnityCG.cginc" - - sampler2D _MainTex; - uniform half4 _MainTex_TexelSize; - uniform half _DownSampleValue; - - struct VertexInput - { - float4 vertex : POSITION; - half2 texcoord : TEXCOORD0; - }; - - struct VertexOutput_DownSmpl - { - float4 pos : SV_POSITION; - half2 uv20 : TEXCOORD0; - half2 uv21 : TEXCOORD1; - half2 uv22 : TEXCOORD2; - half2 uv23 : TEXCOORD3; - }; - - static const half4 GaussWeight[7] = - { - half4(0.0205,0.0205,0.0205,0), - half4(0.0855,0.0855,0.0855,0), - half4(0.232,0.232,0.232,0), - half4(0.324,0.324,0.324,1), - half4(0.232,0.232,0.232,0), - half4(0.0855,0.0855,0.0855,0), - half4(0.0205,0.0205,0.0205,0) - }; - - VertexOutput_DownSmpl vert_DownSmpl(VertexInput v) - { - VertexOutput_DownSmpl o; - o.pos = UnityObjectToClipPos(v.vertex); - o.uv20 = v.texcoord + _MainTex_TexelSize.xy* half2(0.5h, 0.5h);; - o.uv21 = v.texcoord + _MainTex_TexelSize.xy * half2(-0.5h, -0.5h); - o.uv22 = v.texcoord + _MainTex_TexelSize.xy * half2(0.5h, -0.5h); - o.uv23 = v.texcoord + _MainTex_TexelSize.xy * half2(-0.5h, 0.5h); - return o; - } - - fixed4 frag_DownSmpl(VertexOutput_DownSmpl i) : SV_Target - { - fixed4 color = (0,0,0,0); - color += tex2D(_MainTex, i.uv20); - color += tex2D(_MainTex, i.uv21); - color += tex2D(_MainTex, i.uv22); - color += tex2D(_MainTex, i.uv23); - return color / 4; - } - - struct VertexOutput_Blur - { - float4 pos : SV_POSITION; - half4 uv : TEXCOORD0; - half2 offset : TEXCOORD1; - }; - - VertexOutput_Blur vert_BlurHorizontal(VertexInput v) - { - VertexOutput_Blur o; - o.pos = UnityObjectToClipPos(v.vertex); - o.uv = half4(v.texcoord.xy, 1, 1); - o.offset = _MainTex_TexelSize.xy * half2(1.0, 0.0) * _DownSampleValue; - return o; - } - - VertexOutput_Blur vert_BlurVertical(VertexInput v) - { - VertexOutput_Blur o; - o.pos = UnityObjectToClipPos(v.vertex); - o.uv = half4(v.texcoord.xy, 1, 1); - o.offset = _MainTex_TexelSize.xy * half2(0.0, 1.0) * _DownSampleValue; - return o; - } - - half4 frag_Blur(VertexOutput_Blur i) : SV_Target - { - half2 uv = i.uv.xy; - half2 OffsetWidth = i.offset; - half2 uv_withOffset = uv - OffsetWidth * 3.0; - half4 color = 0; - for (int j = 0; j< 7; j++) - { - half4 texCol = tex2D(_MainTex, uv_withOffset); - color += texCol * GaussWeight[j]; - uv_withOffset += OffsetWidth; - } - return color; - } - - ENDCG - - FallBack Off } diff --git a/Material/token.json/Google.Apis.Auth.OAuth2.Responses.TokenResponse-user b/Material/token.json/Google.Apis.Auth.OAuth2.Responses.TokenResponse-user index eabbb78..19f8f4a 100644 --- a/Material/token.json/Google.Apis.Auth.OAuth2.Responses.TokenResponse-user +++ b/Material/token.json/Google.Apis.Auth.OAuth2.Responses.TokenResponse-user @@ -1 +1 @@ -{"access_token":"ya29.a0AS3H6NwRUsoFAQHYoCUxiG8MZloceVHP0rBERc4LrTytdN8IExp5dR5NJ1cZUyRLC7tBgJ_VpPFY0YjHNz3_w2jlxdE3InDzEha0WowTa8JsL2t29ukowQ-YPTP9HuRPMmD_a8-o5_ZunyjfviFiJJdWhQdKTMEhCMG9dpfOPrbbrHaEE_N3chnlTofJb6bNXTjWWqXWaCgYKASwSARESFQHGX2Mi0WuAalhD_HzlFf0jEK3Vng0207","token_type":"Bearer","expires_in":3599,"refresh_token":"1//0e-urCtqMVSK6CgYIARAAGA4SNwF-L9IrTWfNUsKFuBn8-mJmQxbXhkBlRW8776bD9xuFk1rFTaMH0dA9yRyESXHTchyXJDAJgkU","scope":"https://www.googleapis.com/auth/drive","Issued":"2025-09-12T11:04:03.046+08:00","IssuedUtc":"2025-09-12T03:04:03.046Z"} \ No newline at end of file +{"access_token":"ya29.a0AS3H6NxVIL2h8eKBgPqrDArFW0EH7QHYdU2AqolTgYiCMZXh4wkCdFt8bNWijX4y2DWgetcIyRGw-P-2N3mMgS5Zdbwvk3f3heekt3rjYvyOUM9vmTY7Prw1uGdtT2H_X7qjsv5RSesMWEaB0prENq-PEi962Ao4KQjBsyAoFAGbniy1-cSq2sOvJ6TW72I0jt1BQPQZaCgYKAW8SARESFQHGX2MiquVKBRv8Nvw-g6RlyOsbfw0207","token_type":"Bearer","expires_in":3599,"refresh_token":"1//0e-urCtqMVSK6CgYIARAAGA4SNwF-L9IrTWfNUsKFuBn8-mJmQxbXhkBlRW8776bD9xuFk1rFTaMH0dA9yRyESXHTchyXJDAJgkU","scope":"https://www.googleapis.com/auth/drive","Issued":"2025-09-12T16:31:55.048+08:00","IssuedUtc":"2025-09-12T08:31:55.048Z"} \ No newline at end of file