render borders using shader#93
Conversation
|
This is great, @debris. Besides improving quality, it should reduce the amount of primitives too. Thank you! I have noticed the border color was affecting the background color when the border width was Please, take a look and let me know! |
good catch! but it's easily solvable even without branching :) |
|
I forced push to this branch, I hope you don't mind. changes overwritten by the push vec4 c = bg_color;
float alpha = d > 0 ? clamp(radius + s - d, 0, 1) : 1;
if(frame_width > 0) {
float inner_radius = radius - frame_width;
float mix_factor = smoothstep(inner_radius - s, inner_radius + s, d);
c = mix(c, frame_color, mix_factor);
}
return vec4(c.xyz, c.w * alpha);now float inner_radius = radius - frame_width;
float alpha = 1.0 - smoothstep(radius - s, radius + s, d);
float mix_factor = smoothstep(inner_radius - s, inner_radius + s, d);
vec4 c = mix(bg_color, frame_color, min(frame_width, mix_factor));
return vec4(c.xyz, c.w * alpha); |
|
Ah, I just realised that |
|
Oh, I see. I thought
Yeah, I think this is currently a bug present in |
|
I think it should be fine now |
This pr enables quad shader to render borders. This enables
icedto easily add border param to all elements (e.g.Button) and makes the border more smooth than 2 quads rendered on top of each other.e.g.
before:
now: