Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Leno <lone_noel>2021-06-22 23:21:53 +0300
committerHans Goudey <h.goudey@me.com>2021-06-22 23:21:53 +0300
commit187e217b5a72ec7a1e66ee3e1dc2a7910a5feea9 (patch)
tree7c023e8bb8d444ac598cba2d663ff803ed12af77 /source/blender/gpu
parentfa1868ae971c2dc50efb2f5dbf8ed2b2b6f08d08 (diff)
UI: Fix widget emboss: Also fade on the right side
Currently the emboss is only fading on left side of the widget, resulting in the emboss extending vertically on the right side and ending abruptly. This patch fixes this by also fading the emboss on the right side and making it symmetric. Differential Revision: https://developer.blender.org/D10810
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
index 21c7f79a57c..6dd0201535d 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
@@ -36,6 +36,9 @@ vec3 compute_masks(vec2 uv)
corner_rad = right_half ? outRoundCorners.y : outRoundCorners.x;
}
+ /* Fade emboss at the border. */
+ float emboss_size = upper_half ? 0.0 : min(1.0, uv_sdf.x / (corner_rad * ratio));
+
/* Signed distance field from the corner (in pixel).
* inner_sdf is sharp and outer_sdf is rounded. */
uv_sdf -= corner_rad;
@@ -43,9 +46,6 @@ vec3 compute_masks(vec2 uv)
float outer_sdf = -length(min(uv_sdf, 0.0));
float sdf = inner_sdf + outer_sdf + corner_rad;
- /* Fade emboss at the border. */
- float emboss_size = clamp((upper_half) ? 0.0 : (uv.x / corner_rad), 0.0, 1.0);
-
/* Clamp line width to be at least 1px wide. This can happen if the projection matrix
* has been scaled (i.e: Node editor)... */
float line_width = (lineWidth > 0.0) ? max(fwidth(uv.y), lineWidth) : 0.0;