Fix: VSE timeline strip rounded corner outlines not pixel correct
PR #122576 added rounded corners to VSE timeline strips, but they were not "snapped" to pixel grid so the outline that is normally 1px was sometimes falling in between pixels and was blurred out. Fix by rounding all SDF related coordinates inside the shader to the pixel grid. Pull Request: https://projects.blender.org/blender/blender/pulls/122764
This commit is contained in:
committed by
Aras Pranckevicius
parent
fb98edf322
commit
91fa37fecb
@@ -44,11 +44,13 @@ void main()
|
||||
vec2 center = vec2(strip.right_handle + strip.left_handle, strip.top + strip.bottom) * 0.5;
|
||||
|
||||
/* Transform strip rectangle into pixel coordinates, so that
|
||||
* rounded corners have proper aspect ratio and can be expressed in pixels. */
|
||||
* rounded corners have proper aspect ratio and can be expressed in pixels.
|
||||
* Also snap to pixel grid coorinates, so that outline/border is clear
|
||||
* non-fractional pixel sizes. */
|
||||
vec2 view_to_pixel = vec2(context_data.inv_pixelx, context_data.inv_pixely);
|
||||
size *= view_to_pixel;
|
||||
center *= view_to_pixel;
|
||||
vec2 pos = co * view_to_pixel;
|
||||
size = round(size * view_to_pixel);
|
||||
center = round(center * view_to_pixel);
|
||||
vec2 pos = round(co * view_to_pixel);
|
||||
|
||||
float radius = context_data.round_radius;
|
||||
if (radius > size.x) {
|
||||
|
||||
@@ -9,11 +9,10 @@ void main()
|
||||
int vid = gl_VertexID;
|
||||
SeqStripDrawData strip = strip_data[id];
|
||||
vec4 rect = vec4(strip.left_handle, strip.bottom, strip.right_handle, strip.top);
|
||||
/* Expand rasterized rectangle by 1px so that we can do outlines. */
|
||||
rect.x -= context_data.pixelx;
|
||||
rect.z += context_data.pixelx;
|
||||
rect.y -= context_data.pixely;
|
||||
rect.w += context_data.pixely;
|
||||
/* Expand by 2px to fit possible outline and pixel grid rounding. */
|
||||
vec2 expand = vec2(context_data.pixelx, context_data.pixely) * 2.0;
|
||||
rect.xy -= expand;
|
||||
rect.zw += expand;
|
||||
|
||||
vec2 co;
|
||||
if (vid == 0) {
|
||||
|
||||
Reference in New Issue
Block a user