[Bf-blender-cvs] [3054a969810] blender2.8: Object Mode: Outlines: Fix sample coordinates.

Clément Foucault noreply at git.blender.org
Wed Apr 18 11:34:57 CEST 2018


Commit: 3054a9698104741a0d658992eb2db2873eb06c01
Author: Clément Foucault
Date:   Wed Apr 18 11:28:32 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3054a9698104741a0d658992eb2db2873eb06c01

Object Mode: Outlines: Fix sample coordinates.

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

M	source/blender/draw/modes/shaders/object_outline_detect_frag.glsl

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

diff --git a/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl b/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
index dc457100d1c..1a46e207a37 100644
--- a/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
+++ b/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
@@ -40,8 +40,8 @@ void main()
 
 #ifdef GL_ARB_texture_gather
 	vec2 texel_size = 1.0 / vec2(textureSize(outlineId, 0).xy);
-	vec2 uv1 = floor(gl_FragCoord.xy) * texel_size - texel_size;
-	vec2 uv2 = floor(gl_FragCoord.xy) * texel_size;
+	vec2 uv1 = ceil(gl_FragCoord.xy) * texel_size - texel_size;
+	vec2 uv2 = ceil(gl_FragCoord.xy) * texel_size;
 
 	/* Samples order is CW starting from top left. */
 	uvec4 tmp1 = textureGather(outlineId, uv1);
@@ -52,10 +52,10 @@ void main()
 #else
 	uvec4 id;
 	uint ref_id = texelFetch(outlineId, texel, 0).r;
-	id.x = texelFetchOffset(outlineId, texel, 0, ivec2( 1,  0)).r;
-	id.y = texelFetchOffset(outlineId, texel, 0, ivec2( 0,  1)).r;
-	id.z = texelFetchOffset(outlineId, texel, 0, ivec2(-1,  0)).r;
-	id.w = texelFetchOffset(outlineId, texel, 0, ivec2( 0, -1)).r;
+	id.x = texelFetchOffset(outlineId, texel, 0, ivec2(-1,  0)).r;
+	id.y = texelFetchOffset(outlineId, texel, 0, ivec2( 0, -1)).r;
+	id.z = texelFetchOffset(outlineId, texel, 0, ivec2( 0,  1)).r;
+	id.w = texelFetchOffset(outlineId, texel, 0, ivec2( 1,  0)).r;
 #endif
 
 	float ref_depth = texelFetch(outlineDepth, texel, 0).r;



More information about the Bf-blender-cvs mailing list