瀏覽代碼

missed glsl shader changes

missed a few glsl shader changes
fixed gradient to look correct with selected underlay colour
marauder2k7 7 月之前
父節點
當前提交
d5d7f9b91b

+ 9 - 6
Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/roundedRectangleP.glsl

@@ -65,9 +65,12 @@ void main()
     {
     {
         float blendX = (1.0 - texCoord.x);
         float blendX = (1.0 - texCoord.x);
         float blendY = texCoord.y;
         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);
         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)
     if(cornerRadius > 0.0 || halfBorder > 0.0)
@@ -78,20 +81,20 @@ void main()
         {
         {
             if(sdf < 0.0)
             if(sdf < 0.0)
             {
             {
-                toColor = color;
+                toColor = baseColor;
                 sdf = abs(sdf) - borderSize;
                 sdf = abs(sdf) - borderSize;
             } 
             } 
             
             
         } 
         } 
         else{
         else{
-            fromColor = color; 
+            fromColor = baseColor; 
         }  
         }  
 
 
         float alpha = smoothstep(-1.0, 1.0, sdf); 
         float alpha = smoothstep(-1.0, 1.0, sdf); 
-        OUT_col = mix(fromColor, toColor, alpha);
+        OUT_col = mix(fromColor, baseColor, alpha);
     }
     }
     else
     else
     {
     {
-        OUT_col = color;
+        OUT_col = baseColor; 
     }
     }
 }
 }

+ 5 - 2
Templates/BaseGame/game/core/rendering/shaders/fixedFunction/roundedRectangleP.hlsl

@@ -69,9 +69,12 @@ float4 main(Conn IN) : TORQUE_TARGET0
 
 
     if(gradientFill > 0.5f)
     if(gradientFill > 0.5f)
     {
     {
-        float blendX = (1.0 - IN.texCoord.x);
+        float blendX = 1.0 - IN.texCoord.x;
         float blendY = IN.texCoord.y;
         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);
         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;
         baseColor = interpolatedColor;
     }
     }