This new shader is able to emulate smooth wide lines drawing using a geometry shader. This shader needs viewportSize and lineWidth uniforms to be set. There is multiple variants to replace the usage of wide lines for most shaders. This patch only fix the gizmo_types files and the navigation gizmo. Other areas could be fixed afterward, I just limited the patch size. Fix T57570. Reviewed By: billreynish Differential Revision: https://developer.blender.org/D7487
25 lines
408 B
GLSL
25 lines
408 B
GLSL
|
|
uniform float lineWidth;
|
|
|
|
in vec4 finalColor;
|
|
noperspective in float smoothline;
|
|
#ifdef CLIP
|
|
in float clip;
|
|
#endif
|
|
|
|
out vec4 fragColor;
|
|
|
|
#define SMOOTH_WIDTH 1.0
|
|
|
|
void main()
|
|
{
|
|
#ifdef CLIP
|
|
if (clip < 0.0) {
|
|
discard;
|
|
}
|
|
#endif
|
|
fragColor = finalColor;
|
|
fragColor.a *= clamp((lineWidth + SMOOTH_WIDTH) * 0.5 - abs(smoothline), 0.0, 1.0);
|
|
fragColor = blender_srgb_to_framebuffer_space(fragColor);
|
|
}
|