[Bf-blender-cvs] [ecfb0b12732] greasepencil-refactor: GPencil: Refactor: Fix 3D stroke offset

Clément Foucault noreply at git.blender.org
Fri Dec 13 21:25:22 CET 2019


Commit: ecfb0b12732c229e12db543669a49e0f8c647373
Author: Clément Foucault
Date:   Fri Dec 13 21:25:07 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBecfb0b12732c229e12db543669a49e0f8c647373

GPencil: Refactor: Fix 3D stroke offset

The offset was way too big.

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

M	source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl

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

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
index 8d3a34d545d..d07a0df6c06 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
@@ -216,6 +216,8 @@ void stroke_vertex()
   if (strokeOrder3D) {
     /* Use the fragment depth (see fragment shader). */
     depth = -1.0;
+    /* We still offset the fills a little to avoid overlaps */
+    gl_Position.z -= (stroke_id1 + 1) * 0.000002;
   }
   else if (GP_FLAG_TEST(materials[m].flag, GP_STROKE_OVERLAP)) {
     /* Use the index of the point as depth.
@@ -238,7 +240,6 @@ void fill_vertex()
 
   vec3 wpos = transform_point(model_mat, pos1.xyz);
   gl_Position = point_world_to_ndc(wpos);
-  gl_Position.z += 1e-2;
 
   int m = int(ma1.x);
 
@@ -256,6 +257,8 @@ void fill_vertex()
   if (strokeOrder3D) {
     /* Use the fragment depth (see fragment shader). */
     depth = -1.0;
+    /* We still offset the fills a little to avoid overlaps */
+    gl_Position.z -= stroke_id1 * 0.000002;
   }
   else {
     /* Use the index of first point of the stroke as depth. */



More information about the Bf-blender-cvs mailing list