[Bf-blender-cvs] [39aa122a0e6] blender-v2.83-release: DRW: Selection: Extend small object selection workaround to all overlays

Clément Foucault noreply at git.blender.org
Mon May 25 19:35:17 CEST 2020


Commit: 39aa122a0e6d8ff744bec9a245b23d8e9eb2387d
Author: Clément Foucault
Date:   Mon May 25 19:35:07 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB39aa122a0e6d8ff744bec9a245b23d8e9eb2387d

DRW: Selection: Extend small object selection workaround to all overlays

Fix T77015 box select doesnt select cameras when zoomed out, lasso and circle select do work.

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

M	source/blender/draw/engines/overlay/shaders/extra_vert.glsl
M	source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl

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

diff --git a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl
index 035fab1040e..1662e6519c7 100644
--- a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl
@@ -221,6 +221,11 @@ void main()
   /* Convert to screen position [0..sizeVp]. */
   edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;
 
+  /* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the
+   * wire to at least create one fragment that will pass the occlusion query. */
+  /* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */
+  gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
+
 #ifdef USE_WORLD_CLIP_PLANES
   world_clip_planes_calc_clip_distance(world_pos);
 #endif
diff --git a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl
index 474f3254389..9598f8b2814 100644
--- a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl
@@ -17,6 +17,11 @@ void main()
   vec3 world_pos = point_object_to_world(pos);
   gl_Position = point_world_to_ndc(world_pos);
 
+  /* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the
+   * wire to at least create one fragment that will pass the occlusion query. */
+  /* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */
+  gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
+
   stipple_coord = stipple_start = screen_position(gl_Position);
 
 #ifdef OBJECT_WIRE



More information about the Bf-blender-cvs mailing list