diff options
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl | 6 |
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; |