diff --git a/UnleashedRecomp/gpu/imgui/imgui_common.h b/UnleashedRecomp/gpu/imgui/imgui_common.h index b2bd3fc2..bc3c7956 100644 --- a/UnleashedRecomp/gpu/imgui/imgui_common.h +++ b/UnleashedRecomp/gpu/imgui/imgui_common.h @@ -9,6 +9,7 @@ #define IMGUI_SHADER_MODIFIER_GRAYSCALE 6 #define IMGUI_SHADER_MODIFIER_TITLE_BEVEL 7 #define IMGUI_SHADER_MODIFIER_CATEGORY_BEVEL 8 +#define IMGUI_SHADER_MODIFIER_RECTANGLE_BEVEL 9 #ifdef __cplusplus diff --git a/UnleashedRecomp/gpu/shader/imgui_ps.hlsl b/UnleashedRecomp/gpu/shader/imgui_ps.hlsl index 6750e62d..5ebc5515 100644 --- a/UnleashedRecomp/gpu/shader/imgui_ps.hlsl +++ b/UnleashedRecomp/gpu/shader/imgui_ps.hlsl @@ -146,7 +146,27 @@ float4 main(in Interpolators interpolators) : SV_Target else if (any(g_PushConstants.BoundsMin != g_PushConstants.BoundsMax)) { float2 factor = saturate((interpolators.Position.xy - g_PushConstants.BoundsMin) / (g_PushConstants.BoundsMax - g_PushConstants.BoundsMin)); - color *= lerp(DecodeColor(g_PushConstants.GradientTop), DecodeColor(g_PushConstants.GradientBottom), smoothstep(0.0, 1.0, factor.y)); + + if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_RECTANGLE_BEVEL) + { + float bevelSize = 0.9; + + float shadow = saturate((factor.x - bevelSize) / (1.0 - bevelSize)); + shadow = max(shadow, saturate((factor.y - bevelSize) / (1.0 - bevelSize))); + + float rim = saturate((1.0 - factor.x - bevelSize) / (1.0 - bevelSize)); + rim = max(rim, saturate((1.0 - factor.y - bevelSize) / (1.0 - bevelSize))); + + float3 rimColor = float3(1, 0.8, 0.29); + float3 shadowColor = float3(0.84, 0.57, 0); + + color.rgb = lerp(color.rgb, rimColor, smoothstep(0.0, 1.0, rim)); + color.rgb = lerp(color.rgb, shadowColor, smoothstep(0.0, 1.0, shadow)); + } + else + { + color *= lerp(DecodeColor(g_PushConstants.GradientTop), DecodeColor(g_PushConstants.GradientBottom), smoothstep(0.0, 1.0, factor.y)); + } } if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_GRAYSCALE) diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index 7520554c..9453ed3e 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -200,8 +200,13 @@ static void DrawTitle() drawList->AddRectFilled(rectOutlineMin, rectOutlineMax, IM_COL32(0, 0, 0, 255 * rectAlphaMotion), Scale(5)); - // TODO: apply bevel to this square (may require a new shader modifier, existing ones don't work). + SetShaderModifier(IMGUI_SHADER_MODIFIER_RECTANGLE_BEVEL); + SetGradient(rectMin, rectMax, IM_COL32_WHITE, IM_COL32_WHITE); + drawList->AddRectFilled(rectMin, rectMax, IM_COL32(255, 188, 0, 255 * rectAlphaMotion)); + + ResetGradient(); + SetShaderModifier(IMGUI_SHADER_MODIFIER_NONE); } // The flash gets rendered after the rectangle in the original game.