[Bf-blender-cvs] [edef141d0bf] blender2.8: GP: Add small offset to stroke over surface.

Antonioya noreply at git.blender.org
Thu Aug 30 10:18:00 CEST 2018


Commit: edef141d0bf4a9fef986f57fdd7dec43ca6949bd
Author: Antonioya
Date:   Thu Aug 30 10:17:29 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBedef141d0bf4a9fef986f57fdd7dec43ca6949bd

GP: Add small offset to stroke over surface.

This small offset helps to keep the stroke over the surface and avoid the stoke is "inside" the face of the surface.

We could add this as a parameter in the UI, but after doing a lot of test, the valid values are very limited and don't worth the change, so a hardcoded value works fine.

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

M	source/blender/editors/gpencil/gpencil_paint.c

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 4bd8c28a85c..ef70608d99c 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -369,6 +369,15 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
 
 	/* in 3d-space - pt->x/y/z are 3 side-by-side floats */
 	if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) {
+
+		/* add small offset to keep stroke over the surface.
+		* This could be a UI parameter, but the value is too sensitive for
+		* the user to use it and don't improve the result.
+		*/
+		if (depth) {
+			*depth *= 0.99998f;
+		}
+
 		if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval, out, 0, depth))) {
 			/* projecting onto 3D-Geometry
 			 *	- nothing more needs to be done here, since view_autodist_simple() has already done it



More information about the Bf-blender-cvs mailing list