From d5d7f9b91b7745e99b1df650d7d0a33986836b1e Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Wed, 22 Jan 2025 21:32:07 +0000 Subject: [PATCH] missed glsl shader changes missed a few glsl shader changes fixed gradient to look correct with selected underlay colour --- .../fixedFunction/gl/roundedRectangleP.glsl | 15 +++++++++------ .../shaders/fixedFunction/roundedRectangleP.hlsl | 7 +++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/roundedRectangleP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/roundedRectangleP.glsl index af422ebdf..0b69a4736 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/roundedRectangleP.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/roundedRectangleP.glsl @@ -65,9 +65,12 @@ void main() { float blendX = (1.0 - texCoord.x); float blendY = texCoord.y; - + float gamma = 2.4; + blendX = pow(abs(blendX), gamma); + blendY = pow(abs(blendY), 1/gamma); + vec4 interpolatedColor = mix(mix(baseColor,vec4(1.0f, 1.0f, 1.0f, 1.0f), blendX),vec4(0.0f, 0.0f, 0.0f, 1.0f), blendY); - baseColor = interpolatedColor; + baseColor = interpolatedColor; } if(cornerRadius > 0.0 || halfBorder > 0.0) @@ -78,20 +81,20 @@ void main() { if(sdf < 0.0) { - toColor = color; + toColor = baseColor; sdf = abs(sdf) - borderSize; } } else{ - fromColor = color; + fromColor = baseColor; } float alpha = smoothstep(-1.0, 1.0, sdf); - OUT_col = mix(fromColor, toColor, alpha); + OUT_col = mix(fromColor, baseColor, alpha); } else { - OUT_col = color; + OUT_col = baseColor; } } \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/roundedRectangleP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/roundedRectangleP.hlsl index 71968bfad..618dd2137 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/roundedRectangleP.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/roundedRectangleP.hlsl @@ -69,9 +69,12 @@ float4 main(Conn IN) : TORQUE_TARGET0 if(gradientFill > 0.5f) { - float blendX = (1.0 - IN.texCoord.x); + float blendX = 1.0 - IN.texCoord.x; float blendY = IN.texCoord.y; - + float gamma = 2.4; + blendX = pow(abs(blendX), gamma); + blendY = pow(abs(blendY), 1/gamma); + float4 interpolatedColor = lerp(lerp(baseColor,float4(1.0f, 1.0f, 1.0f, 1.0f), blendX),float4(0.0f, 0.0f, 0.0f, 1.0f), blendY); baseColor = interpolatedColor; }