From d4eb08d7edd622a232237c9ae35064305c5f5c99 Mon Sep 17 00:00:00 2001 From: Jean Lamarre Date: Sat, 29 Oct 2022 03:54:34 -0400 Subject: [PATCH] =?UTF-8?q?fix=20menu=20UI=20cass=C3=A9=20a=20cause=20Shad?= =?UTF-8?q?er=20+=20fineTouch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Material/CRTBlit.mat | 16 +++++++++----- Assets/Prefabs/MainMenuButtons.prefab | 6 ++--- Assets/Scenes/MainMenu.unity | 16 +++++++++----- Assets/Shaders/CRTShader.shader | 32 ++++++++++++++++++--------- 4 files changed, 46 insertions(+), 24 deletions(-) diff --git a/Assets/Material/CRTBlit.mat b/Assets/Material/CRTBlit.mat index d0b02ec..ca98651 100644 --- a/Assets/Material/CRTBlit.mat +++ b/Assets/Material/CRTBlit.mat @@ -117,18 +117,21 @@ Material: - _Surface: 0 - _WorkflowMode: 1 - _ZWrite: 1 - - u_bend: 2.21 + - u_bend: 3.15 + - u_blue_offset_y: 0.00403 + - u_green_offset_y: 0 - u_noise_amount: 0.012 - u_noise_size: 337 - - u_scanlin_transparence1: 0.38 + - u_red_offset_y: -0.00409 + - u_scanlin_transparence1: 0.194 - u_scanlin_transparence2: 0.098 - u_scanline_amount: 0.019 - u_scanline_size_1: 308 - u_scanline_size_2: 521 - u_scanline_speed_1: 94.13 - - u_scanline_speed_2: 14.83 + - u_scanline_speed_2: 30 - u_time: 15.95 - - u_vignette_edge_round: 7 + - u_vignette_edge_round: 8.5 - u_vignette_size: 1.89 - u_vignette_smoothness: 0.56 m_Colors: @@ -137,6 +140,9 @@ Material: - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - u_blue_offset: {r: 0, g: 0.002, b: 0, a: 0} + - u_blue_offset_y: {r: 0.25, g: 0.5, b: 0.5, a: 0} - u_green_offset: {r: 0, g: 0, b: 0, a: 0} - - u_red_offset: {r: 0, g: 0.002, b: 0, a: 0} + - u_green_offset_y: {r: 0.25, g: 0.5, b: 0.5, a: 0} + - u_red_offset: {r: 0, g: -0.002, b: 0, a: 0} + - u_red_offset_y: {r: 0.25, g: 0.5, b: 0.5, a: 0} m_BuildTextureStacks: [] diff --git a/Assets/Prefabs/MainMenuButtons.prefab b/Assets/Prefabs/MainMenuButtons.prefab index c5a3450..466c398 100644 --- a/Assets/Prefabs/MainMenuButtons.prefab +++ b/Assets/Prefabs/MainMenuButtons.prefab @@ -237,9 +237,9 @@ MonoBehaviour: m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_HighlightedColor: {r: 0.5377358, g: 0.5377358, b: 0.5377358, a: 1} + m_PressedColor: {r: 0.5754717, g: 0.3441972, b: 0.3441972, a: 1} + m_SelectedColor: {r: 0.5283019, g: 0.5283019, b: 0.5283019, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 diff --git a/Assets/Scenes/MainMenu.unity b/Assets/Scenes/MainMenu.unity index 0a9c0f0..15dbccc 100644 --- a/Assets/Scenes/MainMenu.unity +++ b/Assets/Scenes/MainMenu.unity @@ -380,7 +380,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} m_Name: m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} + m_FirstSelected: {fileID: 1335784365} m_sendNavigationEvents: 1 m_DragThreshold: 10 --- !u!4 &185700930 @@ -698,7 +698,7 @@ MonoBehaviour: m_BlockingObjects: 0 m_BlockingMask: serializedVersion: 2 - m_Bits: 4294967295 + m_Bits: 255 --- !u!114 &753457326 MonoBehaviour: m_ObjectHideFlags: 0 @@ -918,7 +918,7 @@ PrefabInstance: - target: {fileID: 5917528464183523172, guid: 0bdc45a9254ade843b7ba60aaab62301, type: 3} propertyPath: m_fontSize - value: 11.85 + value: 10.05 objectReference: {fileID: 0} - target: {fileID: 5917528464644539588, guid: 0bdc45a9254ade843b7ba60aaab62301, type: 3} @@ -1073,7 +1073,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -77.453, y: -53.482} + m_AnchoredPosition: {x: -77.453, y: -53.481995} m_SizeDelta: {x: 154.907, y: 106.963} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1281004662 @@ -1173,6 +1173,12 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1281004660} m_CullTransparentMesh: 1 +--- !u!1 &1335784365 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5917528464644539588, guid: 0bdc45a9254ade843b7ba60aaab62301, + type: 3} + m_PrefabInstance: {fileID: 5917528464004223745} + m_PrefabAsset: {fileID: 0} --- !u!1 &1451380979 GameObject: m_ObjectHideFlags: 0 @@ -1293,7 +1299,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 82.547, y: -53.407} + m_AnchoredPosition: {x: 82.547, y: -53.407013} m_SizeDelta: {x: -165.09, y: -106.81} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1703051055 diff --git a/Assets/Shaders/CRTShader.shader b/Assets/Shaders/CRTShader.shader index 016437d..8ae1136 100644 --- a/Assets/Shaders/CRTShader.shader +++ b/Assets/Shaders/CRTShader.shader @@ -10,16 +10,16 @@ u_scanline_speed_1("Scanline Speed 1",float) = 0.5 u_scanlin_transparence2("Scanline 2 Transparence",range(0, 1)) = 0.5 u_scanline_size_2("Scanline Size 2",range(0, 750)) = 0.5 - u_scanline_speed_2("Scanline Speed2",float) = 0.5 + u_scanline_speed_2("Scanline Speed 2",float) = 0.5 u_scanline_amount("Scanline Amount",range(0, 1)) = 0.5 u_vignette_size("Vignette Size",range(0, 10)) = 0.5 u_vignette_smoothness("Vignette Smoothness",range(0, 2)) = 0.5 u_vignette_edge_round("Vignette Edge Round",range(0, 100)) = 0.5 u_noise_size("Noise Size",range(0, 500 )) = 0.5 u_noise_amount("Noise Amount",range(0, 0.3)) = 0.5 - [ShowAsVector2] u_red_offset("Red Offset",Vector) = (.25, .5, .5, 0) - [ShowAsVector2] u_green_offset("Green Offset",Vector) = (.25, .5, .5, 0) - [ShowAsVector2] u_blue_offset("Blue Offset",Vector) = (.25, .5, .5, 0) + u_red_offset_y("Red Offset",range(-0.01,0.01)) = 0 + u_green_offset_y("Green Offset",range(-0.01,0.01)) = 0 + u_blue_offset_y("Blue Offset",range(-0.01,0.01)) = 0 } // The Unity Editor uses the class ExampleCustomEditor to configure the Inspector for this shader asset @@ -74,18 +74,28 @@ uniform float u_vignette_edge_round; uniform float u_noise_size; uniform float u_noise_amount; - uniform half2 u_red_offset; - uniform half2 u_green_offset; - uniform half2 u_blue_offset; + uniform float u_red_offset_y; + uniform float u_green_offset_y; + uniform float u_blue_offset_y; + + half2 u_color_offset(float offset) + { + return half2(0,offset); + } half2 crt_coords(half2 uv, float bend) { + // By subtracting 0.5, we go from 0 to 1 into -0.5 to 0.5 uv -= 0.5; + // Multiplying by puts us in -1 to 1 space. uv *= 2.; + + // Curves lines uv.x *= 1. + pow(abs(uv.y) / bend, 2.); uv.y *= 1. + pow(abs(uv.x) / bend, 2.); - uv /= 2.5; + //return coordinates to 0 to 1 space. + uv /= 2; return uv + 0.5; } @@ -129,9 +139,9 @@ u_time = _Time; half2 crt_uv = crt_coords(i.uv, u_bend); fixed4 col; - col.r = tex2D(_MainTex, crt_uv + u_red_offset).r; - col.g = tex2D(_MainTex, crt_uv + u_green_offset).g; - col.b = tex2D(_MainTex, crt_uv + u_blue_offset).b; + col.r = tex2D(_MainTex, crt_uv + u_color_offset(u_red_offset_y)).r; + col.g = tex2D(_MainTex, crt_uv + u_color_offset(u_green_offset_y)).g; + col.b = tex2D(_MainTex, crt_uv + u_color_offset(u_blue_offset_y)).b; col.a = tex2D(_MainTex, crt_uv).a; float s1 = scanline(i.uv, u_scanline_size_1, u_scanline_speed_1, u_scanlin_transparence1);