From 3502ec456d0131f4f6c1c9faabf01e6197a16ee1 Mon Sep 17 00:00:00 2001 From: Detze <92268414+Detze@users.noreply.github.com> Date: Mon, 26 Feb 2024 04:36:09 +0100 Subject: [PATCH 1/9] Match stable's slider border thickness more closely --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index b39092a467..6bf6776617 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy protected new float CalculatedBorderPortion // Roughly matches osu!stable's slider border portions. - => base.CalculatedBorderPortion * 0.77f; + => base.CalculatedBorderPortion * 0.84f; protected override Color4 ColourAt(float position) { From 8032ce9225950f5fc5d6dba911833e9b3f8afa93 Mon Sep 17 00:00:00 2001 From: Detze <92268414+Detze@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:37:27 +0100 Subject: [PATCH 2/9] Match stable's slider border thickness perfectly --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index 6bf6776617..af82a81e08 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -26,8 +26,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS); protected new float CalculatedBorderPortion - // Roughly matches osu!stable's slider border portions. - => base.CalculatedBorderPortion * 0.84f; + // Matches osu!stable's slider border portions. + => 0.109375f; protected override Color4 ColourAt(float position) { From 8363c39da86b4dde7f700ebf3c3a908a4dca945e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 27 Feb 2024 01:30:20 +0300 Subject: [PATCH 3/9] Revert "Match stable's slider border thickness perfectly" This reverts commit 8032ce9225950f5fc5d6dba911833e9b3f8afa93. --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index af82a81e08..6bf6776617 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -26,8 +26,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS); protected new float CalculatedBorderPortion - // Matches osu!stable's slider border portions. - => 0.109375f; + // Roughly matches osu!stable's slider border portions. + => base.CalculatedBorderPortion * 0.84f; protected override Color4 ColourAt(float position) { From e01722a266e887b6032b520ca3f0fcd0011df51e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 27 Feb 2024 01:30:20 +0300 Subject: [PATCH 4/9] Revert "Match stable's slider border thickness more closely" This reverts commit 3502ec456d0131f4f6c1c9faabf01e6197a16ee1. --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index 6bf6776617..b39092a467 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy protected new float CalculatedBorderPortion // Roughly matches osu!stable's slider border portions. - => base.CalculatedBorderPortion * 0.84f; + => base.CalculatedBorderPortion * 0.77f; protected override Color4 ColourAt(float position) { From 81e6a6d96a0f62f0ce015e232217ee8b207ea76f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 27 Feb 2024 02:11:32 +0300 Subject: [PATCH 5/9] Rewrite `LegacySliderBody` rendering to perfectly match stable --- .../Skinning/Legacy/LegacySliderBody.cs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index b39092a467..264bb3145d 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -23,29 +23,29 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private partial class LegacyDrawableSliderPath : DrawableSliderPath { - private const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS); - - protected new float CalculatedBorderPortion - // Roughly matches osu!stable's slider border portions. - => base.CalculatedBorderPortion * 0.77f; - protected override Color4 ColourAt(float position) { - float realBorderPortion = shadow_portion + CalculatedBorderPortion; - float realGradientPortion = 1 - realBorderPortion; - - if (position <= shadow_portion) - return new Color4(0f, 0f, 0f, 0.25f * position / shadow_portion); - - if (position <= realBorderPortion) - return BorderColour; - - position -= realBorderPortion; + const float aa_width = 0.5f / 64f; + const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS); + const float border_portion = 0.1875f; + Color4 shadow = new Color4(0, 0, 0, 0.25f); Color4 outerColour = AccentColour.Darken(0.1f); Color4 innerColour = lighten(AccentColour, 0.5f); - return LegacyUtils.InterpolateNonLinear(position / realGradientPortion, outerColour, innerColour, 0, 1); + if (position <= shadow_portion - aa_width) + return LegacyUtils.InterpolateNonLinear(position, Color4.Black.Opacity(0f), shadow, 0, shadow_portion - aa_width); + + if (position <= shadow_portion + aa_width) + return LegacyUtils.InterpolateNonLinear(position, shadow, BorderColour, shadow_portion - aa_width, shadow_portion + aa_width); + + if (position <= border_portion - aa_width) + return BorderColour; + + if (position <= border_portion + aa_width) + return LegacyUtils.InterpolateNonLinear(position, BorderColour, outerColour, border_portion - aa_width, border_portion + aa_width); + + return LegacyUtils.InterpolateNonLinear(position, outerColour, innerColour, border_portion + aa_width, 1); } /// From 2f547751826c391b765b9f0096f7f18b5649a5d8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 27 Feb 2024 02:16:16 +0300 Subject: [PATCH 6/9] Add stable code references --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index 264bb3145d..fa2b7863db 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -25,14 +25,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy { protected override Color4 ColourAt(float position) { + // https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Renderers/MmSliderRendererGL.cs#L99 const float aa_width = 0.5f / 64f; - const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS); - const float border_portion = 0.1875f; Color4 shadow = new Color4(0, 0, 0, 0.25f); Color4 outerColour = AccentColour.Darken(0.1f); Color4 innerColour = lighten(AccentColour, 0.5f); + // https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Renderers/MmSliderRendererGL.cs#L59-L70 + const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS); + const float border_portion = 0.1875f; + if (position <= shadow_portion - aa_width) return LegacyUtils.InterpolateNonLinear(position, Color4.Black.Opacity(0f), shadow, 0, shadow_portion - aa_width); From 18e26e39feb2fb386b433595724a4970ac841617 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 27 Feb 2024 02:20:34 +0300 Subject: [PATCH 7/9] Remove `SliderBorderSize` for simplicity --- osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs | 1 - osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs index fb31f88d3c..bda1e6cf41 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs @@ -44,7 +44,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default SnakingOut.BindTo(configSnakingOut); - BorderSize = skin.GetConfig(OsuSkinConfiguration.SliderBorderSize)?.Value ?? 1; BorderColour = skin.GetConfig(OsuSkinColour.SliderBorder)?.Value ?? Color4.White; } diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs index 77fea9d8f7..9685ab685d 100644 --- a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs +++ b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs @@ -5,7 +5,6 @@ namespace osu.Game.Rulesets.Osu.Skinning { public enum OsuSkinConfiguration { - SliderBorderSize, SliderPathRadius, CursorCentre, CursorExpand, From 83af9dfb39d222a02fa45c726f1e50d43b27867f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 27 Feb 2024 02:43:02 +0300 Subject: [PATCH 8/9] Fix `aa_width` being incorrect --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index fa2b7863db..a00014ab88 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy protected override Color4 ColourAt(float position) { // https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Renderers/MmSliderRendererGL.cs#L99 - const float aa_width = 0.5f / 64f; + const float aa_width = 3f / 256f; Color4 shadow = new Color4(0, 0, 0, 0.25f); Color4 outerColour = AccentColour.Darken(0.1f); From b3aa9e25d2f3ca99eda2f3e0ac6d7a3dedbd1f61 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 27 Feb 2024 23:18:11 +0300 Subject: [PATCH 9/9] Disable legacy slider AA for now --- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs index a00014ab88..b54bb44f94 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderBody.cs @@ -26,7 +26,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy protected override Color4 ColourAt(float position) { // https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Renderers/MmSliderRendererGL.cs#L99 - const float aa_width = 3f / 256f; + // float aaWidth = Math.Min(Math.Max(0.5f / PathRadius, 3.0f / 256.0f), 1.0f / 16.0f); + // applying the aa_width constant from stable makes sliders blurry, especially on CS>5. set to zero for now. + // this might be related to SmoothPath applying AA internally, but disabling that does not seem to have much of an effect. + const float aa_width = 0f; Color4 shadow = new Color4(0, 0, 0, 0.25f); Color4 outerColour = AccentColour.Darken(0.1f);