[Bf-blender-cvs] [187d8f4] blender2.8: OpenGL: fix smooth point fringe

Mike Erwin noreply at git.blender.org
Sat Oct 8 09:34:40 CEST 2016


Commit: 187d8f473a16a657505dfb7a2b53606d0631fca8
Author: Mike Erwin
Date:   Sat Oct 8 03:34:05 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB187d8f473a16a657505dfb7a2b53606d0631fca8

OpenGL: fix smooth point fringe

Smooth edge was fading to transparent black instead of transparent color. My bad.

===================================================================

M	source/blender/gpu/shaders/gpu_shader_point_uniform_color_outline_smooth_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_point_uniform_color_smooth_frag.glsl

===================================================================

diff --git a/source/blender/gpu/shaders/gpu_shader_point_uniform_color_outline_smooth_frag.glsl b/source/blender/gpu/shaders/gpu_shader_point_uniform_color_outline_smooth_frag.glsl
index 605235b..f83785de 100644
--- a/source/blender/gpu/shaders/gpu_shader_point_uniform_color_outline_smooth_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_point_uniform_color_outline_smooth_frag.glsl
@@ -27,8 +27,10 @@ void main() {
 
 	float midStroke = 0.5 * (radii[1] + radii[2]);
 
-	if (dist > midStroke)
-		fragColor = mix(outlineColor, vec4(0.0), smoothstep(radii[1], radii[0], dist));
+	if (dist > midStroke) {
+		fragColor.rgb = outlineColor.rgb;
+		fragColor.a = mix(outlineColor.a, 0.0, smoothstep(radii[1], radii[0], dist));
+	}
 	else
 		fragColor = mix(color, outlineColor, smoothstep(radii[3], radii[2], dist));
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_point_uniform_color_smooth_frag.glsl b/source/blender/gpu/shaders/gpu_shader_point_uniform_color_smooth_frag.glsl
index dd8ecd6..8c8d81f 100644
--- a/source/blender/gpu/shaders/gpu_shader_point_uniform_color_smooth_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_point_uniform_color_smooth_frag.glsl
@@ -20,5 +20,6 @@ void main() {
 // ...
 // dist = 0 at center of point
 
-	fragColor = mix(color, vec4(0.0), smoothstep(radii[1], radii[0], dist));
+	fragColor.rgb = color.rgb;
+	fragColor.a = mix(color.a, 0.0, smoothstep(radii[1], radii[0], dist));
 }




More information about the Bf-blender-cvs mailing list